diff --git a/personal_data/main.py b/personal_data/main.py index 86acbce..30e916e 100644 --- a/personal_data/main.py +++ b/personal_data/main.py @@ -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!')