Update Countryfile

This commit is contained in:
Kovid Goyal 2012-10-07 23:12:28 +05:30
parent 10d371230d
commit d02bc17075

View File

@ -1,11 +1,13 @@
from calibre import browser from calibre import browser
from calibre.web.feeds.news import BasicNewsRecipe from calibre.web.feeds.news import BasicNewsRecipe
import re
class AdvancedUserRecipe1325006965(BasicNewsRecipe): class AdvancedUserRecipe1325006965(BasicNewsRecipe):
title = u'Countryfile.com' title = u'Countryfile.com'
#cover_url = 'http://www.countryfile.com/sites/default/files/imagecache/160px_wide/cover/2_1.jpg' #cover_url = 'http://www.countryfile.com/sites/default/files/imagecache/160px_wide/cover/2_1.jpg'
__author__ = 'Dave Asbury' __author__ = 'Dave Asbury'
description = 'The official website of Countryfile Magazine' description = 'The official website of Countryfile Magazine'
# last updated 9/9//12 # last updated 7/10/12
language = 'en_GB' language = 'en_GB'
oldest_article = 30 oldest_article = 30
max_articles_per_feed = 25 max_articles_per_feed = 25
@ -13,12 +15,14 @@ class AdvancedUserRecipe1325006965(BasicNewsRecipe):
no_stylesheets = True no_stylesheets = True
auto_cleanup = True auto_cleanup = True
#articles_are_obfuscated = True #articles_are_obfuscated = True
ignore_duplicate_articles = {'title'}
def get_cover_url(self): def get_cover_url(self):
soup = self.index_to_soup('http://www.countryfile.com/') soup = self.index_to_soup('http://www.countryfile.com/')
cov = soup.find(attrs={'class' : 'imagecache imagecache-160px_wide imagecache-linked imagecache-160px_wide_linked'})
cov = soup.find(attrs={'width' : '160', 'class' : re.compile('imagecache imagecache-160px_wide')})
print '******** ',cov,' ***' print '******** ',cov,' ***'
cov2 = str(cov) cov2 = str(cov)
cov2=cov2[140:223] cov2=cov2[10:101]
print '******** ',cov2,' ***' print '******** ',cov2,' ***'
#cov2='http://www.countryfile.com/sites/default/files/imagecache/160px_wide/cover/1b_0.jpg' #cov2='http://www.countryfile.com/sites/default/files/imagecache/160px_wide/cover/1b_0.jpg'
# try to get cover - if can't get known cover # try to get cover - if can't get known cover
@ -40,3 +44,6 @@ class AdvancedUserRecipe1325006965(BasicNewsRecipe):
(u'Country News', u'http://www.countryfile.com/rss/news'), (u'Country News', u'http://www.countryfile.com/rss/news'),
(u'Countryside', u'http://www.countryfile.com/rss/countryside'), (u'Countryside', u'http://www.countryfile.com/rss/countryside'),
] ]