mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
fix pyflakes errors
This commit is contained in:
parent
42b2eeb3bc
commit
8f69acf446
@ -1,4 +1,3 @@
|
|||||||
import re
|
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
class JerusalemPost(BasicNewsRecipe):
|
class JerusalemPost(BasicNewsRecipe):
|
||||||
@ -14,31 +13,10 @@ class JerusalemPost(BasicNewsRecipe):
|
|||||||
max_articles_per_feed = 10
|
max_articles_per_feed = 10
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
|
|
||||||
feeds = [ ('Front Page', 'http://www.jpost.com/Rss/RssFeedsFrontPage.aspx'),
|
feeds = [('Front Page', 'http://www.jpost.com/Rss/RssFeedsFrontPage.aspx'),
|
||||||
('Israel News', 'http://www.jpost.com/Rss/RssFeedsIsraelNews.aspx'),
|
('Israel News', 'http://www.jpost.com/Rss/RssFeedsIsraelNews.aspx'),
|
||||||
('Middle East News', 'http://www.jpost.com/Rss/RssFeedsMiddleEastNews.aspx'),
|
('Middle East News', 'http://www.jpost.com/Rss/RssFeedsMiddleEastNews.aspx'),
|
||||||
('International News', 'http://www.jpost.com/Rss/RssFeedsInternationalNews.aspx'),
|
('International News', 'http://www.jpost.com/Rss/RssFeedsInternationalNews.aspx'),
|
||||||
('Editorials', 'http://www.jpost.com/Rss/RssFeedsEditorialsNews.aspx'),
|
('Editorials', 'http://www.jpost.com/Rss/RssFeedsEditorialsNews.aspx'),
|
||||||
]
|
]
|
||||||
|
|
||||||
#remove_tags = [
|
|
||||||
#dict(id=lambda x: x and 'ads.' in x),
|
|
||||||
#dict(attrs={'class':['printinfo', 'tt1']}),
|
|
||||||
#dict(onclick='DoPrint()'),
|
|
||||||
#dict(name='input'),
|
|
||||||
#]
|
|
||||||
|
|
||||||
#conversion_options = {'linearize_tables':True}
|
|
||||||
|
|
||||||
#def preprocess_html(self, soup):
|
|
||||||
#for tag in soup.findAll('form'):
|
|
||||||
#tag.name = 'div'
|
|
||||||
#return soup
|
|
||||||
|
|
||||||
#def print_version(self, url):
|
|
||||||
#m = re.search(r'(ID|id)=(\d+)', url)
|
|
||||||
#if m is not None:
|
|
||||||
#id_ = m.group(2)
|
|
||||||
#return 'http://www.jpost.com/LandedPages/PrintArticle.aspx?id=%s'%id_
|
|
||||||
#return url
|
|
||||||
|
|
||||||
|
@ -9,9 +9,7 @@ __description__ = 'PCMag (www.pcmag.com) delivers authoritative, labs-based comp
|
|||||||
'''
|
'''
|
||||||
http://www.pcmag.com/
|
http://www.pcmag.com/
|
||||||
'''
|
'''
|
||||||
import re
|
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
from calibre.ebooks.BeautifulSoup import Comment
|
|
||||||
|
|
||||||
class pcMag(BasicNewsRecipe):
|
class pcMag(BasicNewsRecipe):
|
||||||
__author__ = 'Lorenzo Vigentini'
|
__author__ = 'Lorenzo Vigentini'
|
||||||
|
@ -8,7 +8,7 @@ __copyright__ = 'tomashnyk@gmail.com'
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
from calibre.web.feeds.recipes import BasicNewsRecipe
|
from calibre.web.feeds.recipes import BasicNewsRecipe
|
||||||
from calibre.ebooks.BeautifulSoup import BeautifulSoup,Tag
|
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
||||||
#This imports the version bundled with Calibre
|
#This imports the version bundled with Calibre
|
||||||
import lxml
|
import lxml
|
||||||
from lxml.builder import E
|
from lxml.builder import E
|
||||||
|
@ -8,9 +8,9 @@ __copyright__ = 'tomashnyk@gmail.com'
|
|||||||
|
|
||||||
import re,os,datetime
|
import re,os,datetime
|
||||||
from calibre.web.feeds.recipes import BasicNewsRecipe
|
from calibre.web.feeds.recipes import BasicNewsRecipe
|
||||||
from calibre.ebooks.BeautifulSoup import BeautifulSoup,Tag
|
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
||||||
from calibre.constants import config_dir, CONFIG_DIR_MODE
|
from calibre.constants import config_dir
|
||||||
#This imports the version bundled with Calibre
|
# This imports the version bundled with Calibre
|
||||||
import lxml
|
import lxml
|
||||||
from lxml.builder import E
|
from lxml.builder import E
|
||||||
|
|
||||||
@ -30,10 +30,10 @@ class respektWebRecipe(BasicNewsRecipe):
|
|||||||
p.indent_first_line {text-indent:30px;}'
|
p.indent_first_line {text-indent:30px;}'
|
||||||
remove_tags_before = dict(name='div',attrs={'class':['l']})
|
remove_tags_before = dict(name='div',attrs={'class':['l']})
|
||||||
remove_tags_after = dict(id='text')
|
remove_tags_after = dict(id='text')
|
||||||
remove_tags = [dict(name='ul', attrs={'class':['tabs-d'],'id':['comm']}), \
|
remove_tags = [dict(name='ul', attrs={'class':['tabs-d'],'id':['comm']}),
|
||||||
dict(name='div',attrs={'class':['slot','reklama','date']}), \
|
dict(name='div',attrs={'class':['slot','reklama','date']}),
|
||||||
dict(name='span', attrs={'class':['detail-vykrik']}), \
|
dict(name='span', attrs={'class':['detail-vykrik']}),
|
||||||
dict(name='p', attrs={'class':['detail-vykrik']}), \
|
dict(name='p', attrs={'class':['detail-vykrik']}),
|
||||||
dict(name='div', attrs={'id':['col123d-video','col123d-infographic','col123d-gallery','col12d-discussion']}), # soup>lxml>soup in prprocess requires this
|
dict(name='div', attrs={'id':['col123d-video','col123d-infographic','col123d-gallery','col12d-discussion']}), # soup>lxml>soup in prprocess requires this
|
||||||
dict(name='strong', attrs={'class':['detail-vykrik']}),
|
dict(name='strong', attrs={'class':['detail-vykrik']}),
|
||||||
dict(name='script')]
|
dict(name='script')]
|
||||||
@ -49,13 +49,13 @@ class respektWebRecipe(BasicNewsRecipe):
|
|||||||
def parse_index(self):
|
def parse_index(self):
|
||||||
# Read already downloaded articles
|
# Read already downloaded articles
|
||||||
recipe_dir = os.path.join(config_dir,'recipes')
|
recipe_dir = os.path.join(config_dir,'recipes')
|
||||||
old_articles = os.path.join(recipe_dir,self.title.encode('utf-8').replace('/',':'))
|
old_articles = os.path.join(recipe_dir,self.title)
|
||||||
past_items = []
|
past_items = []
|
||||||
if os.path.exists(old_articles):
|
if os.path.exists(old_articles):
|
||||||
with file(old_articles) as f:
|
with file(old_articles) as f:
|
||||||
for h in f:
|
for h in f:
|
||||||
l = h.strip().split(" ")
|
l = h.strip().split(" ")
|
||||||
past_items.append((l[0]," ".join(l[1:])))
|
past_items.append((l[0]," ".join(l[1:])))
|
||||||
old_urls = [x[0] for x in past_items]
|
old_urls = [x[0] for x in past_items]
|
||||||
count_items = {}
|
count_items = {}
|
||||||
current_items = []
|
current_items = []
|
||||||
@ -112,7 +112,7 @@ class respektWebRecipe(BasicNewsRecipe):
|
|||||||
if section[1] == 'Respekt DJ':
|
if section[1] == 'Respekt DJ':
|
||||||
if list_of_articles:
|
if list_of_articles:
|
||||||
if datetime.datetime.today().weekday() in range(0,5) and 6 < datetime.datetime.utcnow().hour < 17:
|
if datetime.datetime.today().weekday() in range(0,5) and 6 < datetime.datetime.utcnow().hour < 17:
|
||||||
#list_of_articles = list_of_articles[:-1]
|
# list_of_articles = list_of_articles[:-1]
|
||||||
current_items = current_items[:-1]
|
current_items = current_items[:-1]
|
||||||
if list_of_articles:
|
if list_of_articles:
|
||||||
ans.append((section[1],list_of_articles))
|
ans.append((section[1],list_of_articles))
|
||||||
@ -156,7 +156,7 @@ class respektWebRecipe(BasicNewsRecipe):
|
|||||||
for i in root.xpath("//h2[@class='d-dj-t']"):
|
for i in root.xpath("//h2[@class='d-dj-t']"):
|
||||||
i.attrib['class'] = ''
|
i.attrib['class'] = ''
|
||||||
E.style = "font-size:60%;font-weight:normal;"
|
E.style = "font-size:60%;font-weight:normal;"
|
||||||
time = E('span',i.getprevious().text_content(),style = E.style)
|
time = E('span',i.getprevious().text_content(),style=E.style)
|
||||||
# Time should be ahead of the title
|
# Time should be ahead of the title
|
||||||
time.tail = ' ' + i.text
|
time.tail = ' ' + i.text
|
||||||
i.text = ''
|
i.text = ''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user