From 335f2147e508e849246bd17896c961beed5af636 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 29 Jun 2009 22:01:01 -0600 Subject: [PATCH] new recipes for inquirer and uncrate by Darko Miletic --- src/calibre/gui2/images/news/inquirer_net.png | Bin 0 -> 837 bytes src/calibre/gui2/images/news/uncrate.png | Bin 0 -> 269 bytes src/calibre/web/feeds/recipes/__init__.py | 2 +- .../web/feeds/recipes/recipe_inquirer_net.py | 61 ++++++++++++++++++ .../web/feeds/recipes/recipe_uncrate.py | 47 ++++++++++++++ 5 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 src/calibre/gui2/images/news/inquirer_net.png create mode 100644 src/calibre/gui2/images/news/uncrate.png create mode 100644 src/calibre/web/feeds/recipes/recipe_inquirer_net.py create mode 100644 src/calibre/web/feeds/recipes/recipe_uncrate.py diff --git a/src/calibre/gui2/images/news/inquirer_net.png b/src/calibre/gui2/images/news/inquirer_net.png new file mode 100644 index 0000000000000000000000000000000000000000..0653c9f4e6f44f75015d846a72fd8616eeb8f2a7 GIT binary patch literal 837 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GXl47#jk7LR=ZR+oKmgck`Wj^4L9* z{L9`wcP1^oBJZ>H{ny_{6_-m3)@iACtvK`1xB9ZE)w~C{Usf%77(M%O=a!ebDa$6! zJSmlY*0|%2OyxE2hfUPu&Q zv8}vd*>c-|>I2uw50zb4*RFk)Pk#2VXIW^aizERV=;YGUdstBX5)~XJjX@^~v3B=``0Yai>wjE@R`FH*UOAsJ>pf z?seVPH=5P=ye8cXo%bwt+4F}F-eoL!?9zTqH0R3cWB0!P{8w7Gt!~+4sr(CRRr}1E zZvW|G^!#iUKEU&gr9(2(2hSODKifnr`ZU0FfX(%%B*pL@7g z2dVO!vn9(Ww%U{$U%M6M>hI^rU&-bwtIm0w<6=f=~bUJT3Olb=L;(0Bs23CNXDG{`S7aDp=pd~ zqO3f5c)U7;syJ(o?laW;q{?^m<~^Q?6A!+c`0CZGBrhGOsAYvdJg)>2^5;)VdY6_I zbY?;mn*j?$UyY+R!?R3Jp#N1%Tq8=7i&7IyQgu^+1cQ-*fu*j2nXZv#h>@X{sj-!b x0g!8DV34VJ&<&;`H$NpatrA0nfu)tHr4>*!SVOHV_imsD22WQ%mvv4FO#q^7ZOH%t literal 0 HcmV?d00001 diff --git a/src/calibre/gui2/images/news/uncrate.png b/src/calibre/gui2/images/news/uncrate.png new file mode 100644 index 0000000000000000000000000000000000000000..74cb9ee91f70cc23271e1c1ea92f09f7d5acbf1a GIT binary patch literal 269 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6n3BBRT^Rni_n+Ah2>S z4={E+nQaFWEGuwK2hw1@3^B*n9tLu(JY5_^G|nfd{5anrZeVD@!_2C~1aTF*39=HMKIb0CKGi3?}aX_7J8aH$NpatrA0nfu)tPv6Yb# VM1#qWqIjSN22WQ%mvv4FO#qJtM^yj- literal 0 HcmV?d00001 diff --git a/src/calibre/web/feeds/recipes/__init__.py b/src/calibre/web/feeds/recipes/__init__.py index af776493f8..6e4c27a5dd 100644 --- a/src/calibre/web/feeds/recipes/__init__.py +++ b/src/calibre/web/feeds/recipes/__init__.py @@ -50,7 +50,7 @@ recipe_modules = ['recipe_' + r for r in ( 'marca', 'kellog_faculty', 'kellog_insight', 'theeconomictimes_india', '7dias', 'buenosaireseconomico', 'diagonales', 'miradasalsur', 'newsweek_argentina', 'veintitres', - 'gva_be', 'hln', 'tijd', 'degentenaar', + 'gva_be', 'hln', 'tijd', 'degentenaar', 'inquirer_net', 'uncrate', )] import re, imp, inspect, time, os diff --git a/src/calibre/web/feeds/recipes/recipe_inquirer_net.py b/src/calibre/web/feeds/recipes/recipe_inquirer_net.py new file mode 100644 index 0000000000..5a7109e6fb --- /dev/null +++ b/src/calibre/web/feeds/recipes/recipe_inquirer_net.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = '2009, Darko Miletic ' +''' +www.inquirer.net +''' + +from calibre.web.feeds.recipes import BasicNewsRecipe +from calibre.ebooks.BeautifulSoup import Tag + +class InquirerNet(BasicNewsRecipe): + title = 'Inquirer.net' + __author__ = 'Darko Miletic' + description = 'News from Philipines' + oldest_article = 2 + max_articles_per_feed = 100 + no_stylesheets = True + use_embedded_content = False + encoding = 'cp1252' + publisher = 'inquirer.net' + category = 'news, politics, philipines' + lang = 'en' + language = _('English') + extra_css = ' .fontheadline{font-size: x-large} .fontsubheadline{font-size: large} .fontkick{font-size: medium}' + + html2lrf_options = [ + '--comment', description + , '--category', category + , '--publisher', publisher + , '--ignore-tables' + ] + + html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"\nlinearize_tables=True' + + remove_tags = [dict(name=['object','link','script','iframe','form'])] + + feeds = [ + (u'Breaking news', u'http://services.inquirer.net/rss/breakingnews.xml' ) + ,(u'Top stories' , u'http://services.inquirer.net/rss/topstories.xml' ) + ,(u'Sports' , u'http://services.inquirer.net/rss/brk_breakingnews.xml' ) + ,(u'InfoTech' , u'http://services.inquirer.net/rss/infotech_tech.xml' ) + ,(u'InfoTech' , u'http://services.inquirer.net/rss/infotech_tech.xml' ) + ,(u'Business' , u'http://services.inquirer.net/rss/inq7money_breaking_news.xml' ) + ,(u'Editorial' , u'http://services.inquirer.net/rss/opinion_editorial.xml' ) + ,(u'Global Nation', u'http://services.inquirer.net/rss/globalnation_breakingnews.xml') + ] + + def preprocess_html(self, soup): + mlang = Tag(soup,'meta',[("http-equiv","Content-Language"),("content",self.lang)]) + mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=utf-8")]) + soup.head.insert(0,mlang) + soup.head.insert(1,mcharset) + for item in soup.findAll(style=True): + del item['style'] + return soup + + def print_version(self, url): + rest, sep, art = url.rpartition('/view/') + art_id, sp, rrest = art.partition('/') + return 'http://services.inquirer.net/print/print.php?article_id=' + art_id diff --git a/src/calibre/web/feeds/recipes/recipe_uncrate.py b/src/calibre/web/feeds/recipes/recipe_uncrate.py new file mode 100644 index 0000000000..ac0c54cd37 --- /dev/null +++ b/src/calibre/web/feeds/recipes/recipe_uncrate.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = '2009, Darko Miletic ' +''' +www.uncrate.com +''' + +from calibre.web.feeds.recipes import BasicNewsRecipe +from calibre.ebooks.BeautifulSoup import BeautifulSoup, Tag + +class Uncrate(BasicNewsRecipe): + title = 'Uncrate' + __author__ = 'Darko Miletic' + description = 'Uncrate is a web magazine for guys who love stuff. Our team digs up the best gadgets, clothes, cars, DVDs and more. New items are posted daily. Enjoy responsively.' + oldest_article = 7 + max_articles_per_feed = 100 + no_stylesheets = True + use_embedded_content = False + encoding = 'utf-8' + publisher = 'Zombie corp.' + category = 'news, gadgets, clothes, cars, DVDs' + lang = 'en-US' + language = _('English') + + html2lrf_options = [ + '--comment', description + , '--category', category + , '--publisher', publisher + ] + + html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"' + + keep_only_tags = [dict(name='div', attrs={'class':'lefttext'})] + remove_tags_after = dict(name='div', attrs={'class':'serif'}) + remove_tags = [dict(name=['object','link','script','iframe','form'])] + + feeds = [(u'Articles', u'http://feeds.feedburner.com/uncrate')] + + def preprocess_html(self, soup): + mlang = Tag(soup,'meta',[("http-equiv","Content-Language"),("content",self.lang)]) + mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=utf-8")]) + soup.head.insert(0,mlang) + soup.head.insert(1,mcharset) + for item in soup.findAll(style=True): + del item['style'] + return self.adeify_images(soup)