diff --git a/recipes/liberation.recipe b/recipes/liberation.recipe index cf404710f8..ce6f7e8c62 100644 --- a/recipes/liberation.recipe +++ b/recipes/liberation.recipe @@ -2,14 +2,15 @@ liberation.fr ''' -import json, base64, time, locale - -from mechanize import Request +import base64 +import json +import time from datetime import datetime, timedelta -from urllib.parse import quote, urlparse, urlencode +from urllib.parse import quote, urlencode, urlparse from calibre import browser from calibre.web.feeds.news import BasicNewsRecipe +from mechanize import Request def resize(x): @@ -24,7 +25,6 @@ def json_to_html(raw): sub = '

' + data['subheadlines']['basic'] + '

' auth = '

{}

\n' - locale.setlocale(locale.LC_TIME, 'fr_FR.UTF-8') dt = datetime.fromisoformat(data['last_updated_date'][:-1]) + timedelta(seconds=time.timezone) dt = dt.strftime('%b %d, %Y, %H:%M') a = [x['name'] for x in data['credits']['by']] @@ -34,7 +34,7 @@ def json_to_html(raw): auth = auth.format(dt) lede = '' - if data['promo_items']['basic'].get('type', '') == 'image': + if data['promo_items']['basic'].get('type', '') == 'image': lede = '
{}
\n'.format( resize(data['promo_items']['basic']['resized_image_urls']), data['promo_items']['basic'].get('caption', '') @@ -107,7 +107,7 @@ class Liberation(BasicNewsRecipe): ] def get_obfuscated_article(self, url): - slug = urlparse(url).path + slug = urlparse(url).path br = browser() b64 = base64.b64decode(self.key) query = {