mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
pep8
This commit is contained in:
parent
c7f0e65fa7
commit
7597538345
@ -6,12 +6,13 @@ https://www.economist.com/the-world-in-brief
|
||||
import json
|
||||
from urllib.parse import quote, urlencode
|
||||
|
||||
from html5_parser import parse
|
||||
from lxml import etree
|
||||
|
||||
from calibre import replace_entities
|
||||
from calibre.ebooks.BeautifulSoup import NavigableString, Tag
|
||||
from calibre.ptempfile import PersistentTemporaryFile
|
||||
from calibre.web.feeds.news import BasicNewsRecipe
|
||||
from html5_parser import parse
|
||||
from lxml import etree
|
||||
|
||||
|
||||
def E(parent, name, text='', **attrs):
|
||||
|
@ -8,6 +8,7 @@ engadget.com
|
||||
|
||||
from calibre.web.feeds.news import BasicNewsRecipe
|
||||
|
||||
|
||||
def classes(classes):
|
||||
q = frozenset(classes.split(' '))
|
||||
return dict(attrs={'class': lambda x: x and frozenset(x.split()).intersection(q)})
|
||||
@ -37,7 +38,7 @@ class Engadget(BasicNewsRecipe):
|
||||
remove_tags = [
|
||||
dict(name='div', attrs={'class':'caas-content-byline-wrapper'}),
|
||||
dict(name='div', attrs={'data-component':'ArticleAuthorInfo'}),
|
||||
classes('commerce-module caas-header caas-prestige-bottom-share caas-share-buttons caas-da caas-3p-blocked commerce-disclaimer notification-upsell-push article-slideshow athena-button email-form')
|
||||
classes('commerce-module caas-header caas-prestige-bottom-share caas-share-buttons caas-da caas-3p-blocked commerce-disclaimer notification-upsell-push article-slideshow athena-button email-form') # noqa
|
||||
]
|
||||
|
||||
feeds = [(u'Posts', u'https://www.engadget.com/rss.xml')]
|
||||
@ -86,7 +87,6 @@ class Engadget(BasicNewsRecipe):
|
||||
except KeyError:
|
||||
continue
|
||||
# Reorder the "title" and "content" elements
|
||||
body_tag = soup.find('body')
|
||||
title_div = soup.find("div", {"class": "caas-title-wrapper"})
|
||||
content_div = soup.find("div", {"class": "caas-content-wrapper"})
|
||||
if title_div and content_div:
|
||||
@ -94,4 +94,3 @@ class Engadget(BasicNewsRecipe):
|
||||
soup.body.append(title_div)
|
||||
soup.body.append(content_div)
|
||||
return soup
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
#!/usr/bin/env python
|
||||
import re
|
||||
import json
|
||||
import re
|
||||
import time
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from calibre.web.feeds.news import BasicNewsRecipe
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user