New recipes for Gizmodo, News Straits Times, Read It Later, TidBits by Darko Miletic

This commit is contained in:
Kovid Goyal 2010-02-03 10:54:23 -07:00
parent 9ea276be20
commit 4ecab6bc9e
8 changed files with 192 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 640 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 816 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 810 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 783 B

View File

@ -0,0 +1,40 @@
__license__ = 'GPL v3'
__copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>'
'''
gizmodo.com
'''
from calibre.web.feeds.news import BasicNewsRecipe
class Gizmodo(BasicNewsRecipe):
title = 'Gizmodo'
__author__ = 'Darko Miletic'
description = "Gizmodo, the gadget guide. So much in love with shiny new toys, it's unnatural."
publisher = 'gizmodo.com'
category = 'news, IT, Internet, gadgets'
oldest_article = 2
max_articles_per_feed = 100
no_stylesheets = True
encoding = 'utf-8'
use_embedded_content = True
language = 'en'
masthead_url = 'http://cache.gawkerassets.com/assets/gizmodo.com/img/logo.png'
extra_css = ' body{font-family: "Lucida Grande",Helvetica,Arial,sans-serif} img{margin-bottom: 1em} '
conversion_options = {
'comment' : description
, 'tags' : category
, 'publisher' : publisher
, 'language' : language
}
remove_attributes = ['width','height']
remove_tags = [dict(name='div',attrs={'class':'feedflare'})]
remove_tags_after = dict(name='div',attrs={'class':'feedflare'})
feeds = [(u'Articles', u'http://feeds.gawker.com/gizmodo/full')]
def preprocess_html(self, soup):
return self.adeify_images(soup)

View File

@ -0,0 +1,35 @@
__license__ = 'GPL v3'
__copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>'
'''
www.nst.com.my
'''
from calibre.web.feeds.news import BasicNewsRecipe
class Newstraitstimes(BasicNewsRecipe):
title = 'New Straits Times from Malaysia'
__author__ = 'Darko Miletic'
description = 'Learning Curve, Sunday People, New Straits Times from Malaysia'
publisher = 'nst.com.my'
category = 'news, politics, Malaysia'
oldest_article = 2
max_articles_per_feed = 100
no_stylesheets = True
encoding = 'cp1252'
use_embedded_content = False
language = 'en'
masthead_url = 'http://www.nst.com.my/Current_News/NST/Images/new-nstonline.jpg'
conversion_options = {
'comment' : description
, 'tags' : category
, 'publisher' : publisher
, 'language' : language
}
remove_tags = [dict(name=['link','table'])]
keep_only_tags = dict(name='div',attrs={'id':'haidah'})
feeds = [(u'Articles', u'http://www.nst.com.my/rss/allSec')]

View File

@ -0,0 +1,64 @@
__license__ = 'GPL v3'
__copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>'
'''
readitlaterlist.com
'''
from calibre import strftime
from calibre.web.feeds.news import BasicNewsRecipe
class Readitlater(BasicNewsRecipe):
title = 'Read It Later'
__author__ = 'Darko Miletic'
description = '''Personalized news feeds. Go to readitlaterlist.com to
setup up your news. Fill in your account
username, and optionally you can add password.'''
publisher = 'readitlater.com'
category = 'news, custom'
oldest_article = 7
max_articles_per_feed = 100
no_stylesheets = True
use_embedded_content = False
needs_subscription = True
INDEX = u'http://readitlaterlist.com'
LOGIN = INDEX + u'/l'
feeds = [(u'Unread articles' , INDEX + u'/unread')]
def get_browser(self):
br = BasicNewsRecipe.get_browser()
if self.username is not None:
br.open(self.LOGIN)
br.select_form(nr=0)
br['feed_id'] = self.username
if self.password is not None:
br['password'] = self.password
br.submit()
return br
def parse_index(self):
totalfeeds = []
lfeeds = self.get_feeds()
for feedobj in lfeeds:
feedtitle, feedurl = feedobj
self.report_progress(0, _('Fetching feed')+' %s...'%(feedtitle if feedtitle else feedurl))
articles = []
soup = self.index_to_soup(feedurl)
ritem = soup.find('ul',attrs={'id':'list'})
for item in ritem.findAll('li'):
description = ''
atag = item.find('a',attrs={'class':'text'})
if atag and atag.has_key('href'):
url = self.INDEX + atag['href']
title = self.tag_to_string(item.div)
date = strftime(self.timefmt)
articles.append({
'title' :title
,'date' :date
,'url' :url
,'description':description
})
totalfeeds.append((feedtitle, articles))
return totalfeeds

View File

@ -0,0 +1,53 @@
__license__ = 'GPL v3'
__copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>'
'''
db.tidbits.com
'''
from calibre.web.feeds.news import BasicNewsRecipe
class TidBITS(BasicNewsRecipe):
title = 'TidBITS: Mac News for the Rest of Us'
__author__ = 'Darko Miletic'
description = 'Insightful news, reviews, and analysis of the Macintosh and Internet worlds'
publisher = 'TidBITS Publishing Inc.'
category = 'news, Apple, Macintosh, IT, Internet'
oldest_article = 2
max_articles_per_feed = 100
no_stylesheets = True
encoding = 'utf-8'
use_embedded_content = True
language = 'en'
remove_empty_feeds = True
masthead_url = 'http://db.tidbits.com/images/tblogo9.gif'
extra_css = ' body{font-family: Georgia,"Times New Roman",Times,serif} '
conversion_options = {
'comment' : description
, 'tags' : category
, 'publisher' : publisher
, 'language' : language
}
remove_attributes = ['width','height']
remove_tags = [dict(name='small')]
remove_tags_after = dict(name='small')
feeds = [
(u'Business Apps' , u'http://db.tidbits.com/feeds/business.rss' )
,(u'Entertainment' , u'http://db.tidbits.com/feeds/entertainment.rss')
,(u'External Links' , u'http://db.tidbits.com/feeds/links.rss' )
,(u'Home Mac' , u'http://db.tidbits.com/feeds/home.rss' )
,(u'Inside TidBITS' , u'http://db.tidbits.com/feeds/inside.rss' )
,(u'iPod & iPhone' , u'http://db.tidbits.com/feeds/ipod-iphone.rss' )
,(u'Just for Fun' , u'http://db.tidbits.com/feeds/fun.rss' )
,(u'Macs & Mac OS X' , u'http://db.tidbits.com/feeds/macs.rss' )
,(u'Media Creation' , u'http://db.tidbits.com/feeds/creative.rss' )
,(u'Networking & Communications', u'http://db.tidbits.com/feeds/net.rss' )
,(u'Opinion & Editorial' , u'http://db.tidbits.com/feeds/opinion.rss' )
,(u'Support & Problem Solving' , u'http://db.tidbits.com/feeds/support.rss' )
,(u'Safe Computing' , u'http://db.tidbits.com/feeds/security.rss' )
,(u'Tech News' , u'http://db.tidbits.com/feeds/tech.rss' )
,(u'Software Watchlist' , u'http://db.tidbits.com/feeds/watchlist.rss' )
]