Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release
cache/
6 changes: 4 additions & 2 deletions db/tests/test_scrape_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from unittest.mock import MagicMock, patch

import utils.scrape_utils as scrape_utils
from utils.scrape_utils import (
_needs_playwright,
close_browser,
Expand Down Expand Up @@ -88,8 +89,9 @@ def test_fetch_url_with_existing_session(tmp_cache_dir):


def test_fetch_url_playwright_route(tmp_cache_dir):
url = f'https://{PLAYWRIGHT_REQUIRED_HOSTS[0]}/page'
with patch('utils.scrape_utils._fetch_with_playwright', return_value='<html>pw</html>') as mock_pw:
url = 'https://pw-only.example.com/page'
with patch.object(scrape_utils, 'PLAYWRIGHT_REQUIRED_HOSTS', ['pw-only.example.com']), \
patch('utils.scrape_utils._fetch_with_playwright', return_value='<html>pw</html>') as mock_pw:
result = fetch_url(url)
assert result == '<html>pw</html>'
mock_pw.assert_called_once_with(url)
Expand Down
6 changes: 4 additions & 2 deletions db/utils/scrape_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
'Upgrade-Insecure-Requests': '1'
}

# Sites that require Playwright (real browser) due to TLS fingerprinting
PLAYWRIGHT_REQUIRED_HOSTS = ['repo.mariocube.com']
# Sites that require Playwright (real browser) due to TLS fingerprinting.
# repo.mariocube.com flipped: Cloudflare now challenges headless Chromium
# but passes cloudscraper, so it uses the default path again.
PLAYWRIGHT_REQUIRED_HOSTS = []

# Rate limiting settings
MAX_RETRIES = 5
Expand Down