mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Update Daily Express
This commit is contained in:
parent
db54fbeca0
commit
0715c663f9
@ -1,5 +1,6 @@
|
|||||||
# vim:fileencoding=UTF-8
|
# vim:fileencoding=UTF-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
@ -8,6 +9,7 @@ from calibre import browser
|
|||||||
class AdvancedUserRecipe1390132023(BasicNewsRecipe):
|
class AdvancedUserRecipe1390132023(BasicNewsRecipe):
|
||||||
title = u'Daily Express'
|
title = u'Daily Express'
|
||||||
__author__ = 'Dave Asbury'
|
__author__ = 'Dave Asbury'
|
||||||
|
# 1.8.15 official feedburner feeds live again
|
||||||
# 27.6.15 using feed43 as rss feeds dead
|
# 27.6.15 using feed43 as rss feeds dead
|
||||||
# feed 43 string = <div {*}<a href="{%}"{*}<h4>{%}</h4>
|
# feed 43 string = <div {*}<a href="{%}"{*}<h4>{%}</h4>
|
||||||
oldest_article = 1.5
|
oldest_article = 1.5
|
||||||
@ -22,40 +24,56 @@ class AdvancedUserRecipe1390132023(BasicNewsRecipe):
|
|||||||
|
|
||||||
preprocess_regexps = [
|
preprocess_regexps = [
|
||||||
(re.compile(r'\| [\w].+?\| [\w].+?\| Daily Express', re.IGNORECASE | re.DOTALL), lambda match: ''),
|
(re.compile(r'\| [\w].+?\| [\w].+?\| Daily Express', re.IGNORECASE | re.DOTALL), lambda match: ''),
|
||||||
]
|
|
||||||
|
|
||||||
feeds = [
|
|
||||||
(u'UK News', u'http://feed43.com/3460616116055543.xml'),
|
|
||||||
# http://feeds.feedburner.com/daily-express-uk-news'),#http://www.express.co.uk/posts/rss/1/uk'),
|
|
||||||
(u'World News',u'http://feed43.com/5650105317448722.xml'),
|
|
||||||
# http://www.express.co.uk/posts/rss/78/world'),
|
|
||||||
(u'Showbiz News',u'http://feed43.com/2564008080442425.xml'),
|
|
||||||
(u'Finance',u'http://feed43.com/8636615325246501.xml'),
|
|
||||||
# http://www.express.co.uk/posts/rss/21/finance'),
|
|
||||||
(u'Sport - Boxing',u'http://feed43.com/7570233481503246.xml'),
|
|
||||||
(u'Sport - Rugby Union',u'http://feed43.com/4235483647118470.xml'),
|
|
||||||
(u'Sport - Others',u'http://feed43.com/6106345668326737.xml'),
|
|
||||||
# http://www.express.co.uk/posts/rss/65/sport'),
|
|
||||||
(u'Entertainment',u'http://feed43.com/8864645080210731.xml'),
|
|
||||||
# http://www.express.co.uk/posts/rss/18/entertainment'),
|
|
||||||
(u'Lifestyle',u'http://feed43.com/8705161426770855.xml'),
|
|
||||||
# http://www.express.co.uk/posts/rss/8/life&style'),
|
|
||||||
(u'Travel',u'http://feed43.com/6547373884767554.xml'),
|
|
||||||
]
|
]
|
||||||
|
feeds = [
|
||||||
|
|
||||||
|
# (u'UK News', u'http://feed43.com/3460616116055543.xml'),
|
||||||
|
(u'UK News',u'http://feeds.feedburner.com/daily-express-uk-news'), # http://www.express.co.uk/posts/rss/1/uk'),
|
||||||
|
(u'World News',u'http://feeds.feedburner.com/daily-express-world-news'),
|
||||||
|
# (u'World News',u'http://feed43.com/5650105317448722.xml'),
|
||||||
|
# http://www.express.co.uk/posts/rss/78/world'),
|
||||||
|
(u'Showbiz News',u'http://feeds.feedburner.com/daily-express-showbiz-news'),
|
||||||
|
# (u'Showbiz News',u'http://feed43.com/2564008080442425.xml'),
|
||||||
|
(u'Finance',u'http://feeds.feedburner.com/daily-express-finance-news'),
|
||||||
|
# (u'Finance',u'http://feed43.com/8636615325246501.xml'),
|
||||||
|
# http://www.express.co.uk/posts/rss/21/finance'),
|
||||||
|
# (u'Sport - Boxing',u'http://feed43.com/7570233481503246.xml'),
|
||||||
|
(u'Sport - Boxing',u'http://feeds.feedburner.com/daily-express-boxing-news'),
|
||||||
|
(u'Sport - Rugby Union',u'http://feeds.feedburner.com/daily-express-rugby-union-news'),
|
||||||
|
# (u'Sport - Rugby Union',u'http://feed43.com/4235483647118470.xml'),
|
||||||
|
# (u'Sport - Others',u'http://feed43.com/6106345668326737.xml'),
|
||||||
|
(u'Sport - Others',u'http://feeds.feedburner.com/daily-express-other-sport-news'),
|
||||||
|
# http://www.express.co.uk/posts/rss/65/sport'),
|
||||||
|
(u'Entertainment',u'http://feeds.feedburner.com/daily-express-entertainment-news'),
|
||||||
|
# (u'Entertainment',u'http://feed43.com/8864645080210731.xml'),
|
||||||
|
# http://www.express.co.uk/posts/rss/18/entertainment'),
|
||||||
|
(u'Lifestyle',u'http://feeds.feedburner.com/daily-express-life-and-style-news'),
|
||||||
|
# (u'Lifestyle',u'http://feed43.com/8705161426770855.xml'),
|
||||||
|
# http://www.express.co.uk/posts/rss/8/life&style'),
|
||||||
|
(u'Travel',u'http://feeds.feedburner.com/daily-express-travel'),
|
||||||
|
# (u'Travel',u'http://feed43.com/6547373884767554.xml'),
|
||||||
|
]
|
||||||
|
# starsons code
|
||||||
|
def parse_feeds(self):
|
||||||
|
feeds = BasicNewsRecipe.parse_feeds(self)
|
||||||
|
for feed in feeds:
|
||||||
|
for article in feed.articles[:]:
|
||||||
|
print 'article.title is: ', article.title
|
||||||
|
if 'WATCH:' in article.title.upper():
|
||||||
|
feed.articles.remove(article)
|
||||||
|
|
||||||
|
return feeds
|
||||||
|
|
||||||
def get_cover_url(self):
|
def get_cover_url(self):
|
||||||
print '============Cover ================='
|
|
||||||
print
|
|
||||||
soup = self.index_to_soup('http://www.express.co.uk/ourpaper/')
|
soup = self.index_to_soup('http://www.express.co.uk/ourpaper/')
|
||||||
cov = soup.find(attrs={'src' : re.compile('http://cdn.images.express.co.uk/img/covers/')})
|
cov = soup.find(attrs={'src' : re.compile('http://cdn.images.express.co.uk/img/covers/')})
|
||||||
cov=str(cov)
|
cov=str(cov)
|
||||||
print '^^^^^^^', cov
|
|
||||||
cov2 = re.findall('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', cov)
|
cov2 = re.findall('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', cov)
|
||||||
|
|
||||||
cov=str(cov2)
|
cov=str(cov2)
|
||||||
cov=cov[2:len(cov)-2]
|
cov=cov[2:len(cov)-2]
|
||||||
|
|
||||||
print '&&&&&&&&',cov,'***'
|
|
||||||
# cover_url=cov
|
# cover_url=cov
|
||||||
br = browser()
|
br = browser()
|
||||||
br.set_handle_redirect(False)
|
br.set_handle_redirect(False)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user