From 71b858f0c56575c28987e6db26d826f5500a3907 Mon Sep 17 00:00:00 2001 From: Henrik Holm Date: Mon, 5 Dec 2022 22:59:08 +0100 Subject: [PATCH] Set 'needs_subscription' to 'optional' and add get_browser() method --- recipes/fokus.recipe | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/recipes/fokus.recipe b/recipes/fokus.recipe index cb9ba9b6d3..b7f66baee8 100644 --- a/recipes/fokus.recipe +++ b/recipes/fokus.recipe @@ -43,7 +43,7 @@ class Fokus(BasicNewsRecipe): masthead_url = 'https://cdn.fokus.se/app/uploads/fokus/2022/05/12214931/fokus-logo.svg' no_stylesheets = True compress_news_images = True - needs_subscription = False + needs_subscription = 'optional' max_age = 7 # days remove_empty_feeds = True extra_css = 'img { display: block; width: 100%; height: auto }' @@ -88,6 +88,16 @@ class Fokus(BasicNewsRecipe): def __init__(self, *args, **kwargs): BasicNewsRecipe.__init__(self, *args, **kwargs) + def get_browser(self): + br = BasicNewsRecipe.get_browser(self) + if self.username and self.password: + br.open('https://www.fokus.se/auth/logga-in') + br.select_form(name='loginForm') + br['j_username'] = self.username + br['j_password'] = self.password + br.submit() + return br + def parse_article_blurb(self, article_blurb): desc = '' if a_tag := article_blurb.find('a', href=True):