1
0

Improved cookiejar handling for now
All checks were successful
Run Python tests (through Pytest) / Test (push) Successful in 36s
Verify Python project can be installed, loaded and have version checked / Test (push) Successful in 32s

This commit is contained in:
Jon Michael Aanes 2025-03-16 00:18:44 +01:00
parent af42e3ba90
commit e787779b58

View File

@ -91,6 +91,19 @@ def available_scraper_names() -> list[str]:
return [scraper_cls.__name__ for scraper_cls in available_scrapers()]
def get_cookiejar(use_cookiejar: bool):
if use_cookiejar:
logger.warning('Got cookiejar from firefox')
cookiejar = browsercookie.firefox()
if len(cookiejar) > 10:
return cookiejar
browsercookie.firefox(['/home/jmaa/.cachy/mbui5xg7.default-release/cookies.sqlite'])
if len(cookiejar) > 10:
return cookiejar
logger.warning('No cookiejar is used')
return []
def main(
scraper_filter: frozenset[str],
*,
@ -98,12 +111,8 @@ def main(
ignore_cache: bool,
notification_types: frozenset[notification.NotificationType],
) -> None:
if use_cookiejar:
cookiejar = browsercookie.firefox()
logger.info('Got cookiejar from firefox: %s cookies', len(cookiejar))
else:
cookiejar = []
logger.warning('No cookiejar is used')
cookiejar = get_cookiejar(use_cookiejar)
logger.warning('Cookiejar has %s cookies', len(cookiejar))
if len(notification_types) == 0:
logger.info('No notifications enabled: Notifications will not be sent!')