From d5d8ec6a9c4a5f76743df75c5aeba85549c20b0c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 17 Feb 2010 09:00:21 -0700 Subject: [PATCH] Wired UK by Darko Miletic --- resources/images/news/wired_uk.png | Bin 0 -> 647 bytes resources/recipes/wired_uk.recipe | 74 +++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 resources/images/news/wired_uk.png create mode 100644 resources/recipes/wired_uk.recipe diff --git a/resources/images/news/wired_uk.png b/resources/images/news/wired_uk.png new file mode 100644 index 0000000000000000000000000000000000000000..c807e36d1f47825ea779e09f82da8baece2f56ba GIT binary patch literal 647 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b zK-vS0-A-oPfdtD69Mgd`SU*F|v9*U87#KHrx;TbdoIX0));}arpl$xl--3cMk6G`i z9?@XkwR>S?q)={7PS4uT*0oy=&Hiv(|8MxmENpGrkNU)^@)(3=(mV?`fUC+(oBPE|jh=S~l!mT+9?nX<5TYi%^sAFss62gF1^_ZB8~ z2nT!2nlF^Ka6@5&g_m~ti4=)xX;Z?M_^?H;oi5RH+BR@oecx++i9au$^P=WNRCONh zmDsX)KjSfpC(|P=*5}AZee2uwb@qLovmTL|70GOUhA;Sajvw0?^L@p9(ML<}2)&oE zX|xWn=?iwR|G>|=bMwI!lV(r%X5Kze&_$;owj-z7xRx=M_@#%mbgZgq$HN4S|t~y0x1R~149E{10!8S^AH0I zD%(2h_me>FVdQ&MBb@ E0I~N1wg3PC literal 0 HcmV?d00001 diff --git a/resources/recipes/wired_uk.recipe b/resources/recipes/wired_uk.recipe new file mode 100644 index 0000000000..d0429f9573 --- /dev/null +++ b/resources/recipes/wired_uk.recipe @@ -0,0 +1,74 @@ + +__license__ = 'GPL v3' +__copyright__ = '2010, Darko Miletic ' +''' +www.wired.co.uk +''' + +from calibre import strftime +from calibre.web.feeds.news import BasicNewsRecipe + +class Wired_UK(BasicNewsRecipe): + title = 'Wired Magazine - UK edition' + __author__ = 'Darko Miletic' + description = 'Gaming news' + publisher = 'Conde Nast Digital' + category = 'news, games, IT, gadgets' + oldest_article = 32 + max_articles_per_feed = 100 + no_stylesheets = True + encoding = 'utf-8' + use_embedded_content = False + masthead_url = 'http://www.wired.co.uk/_/media/wired-logo_UK.gif' + language = 'en_GB' + extra_css = ' body{font-family: Palatino,"Palatino Linotype","Times New Roman",Times,serif} img{margin-bottom: 0.8em } .img-descr{font-family: Tahoma,Arial,Helvetica,sans-serif; font-size: 0.6875em; display: block} ' + index = 'http://www.wired.co.uk/wired-magazine.aspx' + + conversion_options = { + 'comment' : description + , 'tags' : category + , 'publisher' : publisher + , 'language' : language + } + + keep_only_tags = [dict(name='div', attrs={'class':'article-box'})] + remove_tags = [ + dict(name=['object','embed','iframe','link']) + ,dict(attrs={'class':['opts','comment','stories']}) + ] + remove_tags_after = dict(name='div',attrs={'class':'stories'}) + remove_attributes = ['height','width'] + + + def parse_index(self): + totalfeeds = [] + soup = self.index_to_soup(self.index) + maincontent = soup.find('div',attrs={'class':'main-content'}) + mfeed = [] + if maincontent: + st = maincontent.find(attrs={'class':'most-wired-box'}) + if st: + for itt in st.findAll('a',href=True): + url = 'http://www.wired.co.uk' + itt['href'] + title = self.tag_to_string(itt) + description = '' + date = strftime(self.timefmt) + mfeed.append({ + 'title' :title + ,'date' :date + ,'url' :url + ,'description':description + }) + totalfeeds.append(('Articles',mfeed)) + return totalfeeds + + def get_cover_url(self): + cover_url = None + soup = self.index_to_soup(self.index) + cover_item = soup.find('span',attrs={'class':'cover'}) + if cover_item: + cover_url = cover_item.img['src'] + return cover_url + + def print_version(self, url): + return url + '?page=all'