Recipe for Time (thanks to Darko Miletic)

This commit is contained in:
Kovid Goyal 2008-12-21 09:59:40 -08:00
parent 849c32fa1e
commit 81f2edc740
3 changed files with 43 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

View File

@ -19,6 +19,7 @@ recipe_modules = [
'clarin', 'financial_times', 'heise', 'le_monde', 'harpers', 'science_aas',
'science_news', 'the_nation', 'lrb', 'harpers_full', 'liberation',
'linux_magazine', 'telegraph_uk', 'utne', 'sciencedaily', 'forbes',
'time',
]
import re, imp, inspect, time, os

View File

@ -0,0 +1,42 @@
#!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
'''
time.com
'''
from calibre.ebooks.BeautifulSoup import BeautifulSoup
from calibre.web.feeds.news import BasicNewsRecipe
class Time(BasicNewsRecipe):
title = u'Time'
__author__ = 'Darko Miletic'
description = 'Weekly magazine'
oldest_article = 7
max_articles_per_feed = 100
no_stylesheets = False
use_embedded_content = False
cover_url = 'http://img.timeinc.net/time/rd/trunk/www/web/feds/i/logo_time_home.gif'
keep_only_tags = [dict(name='div', attrs={'class':'tout1'})]
feeds = [
(u'Top Stories', u'http://feedproxy.google.com/time/topstories')
,(u'Nation', u'http://feedproxy.google.com/time/nation')
,(u'Business & Tech', u'http://feedproxy.google.com/time/business')
,(u'Science & Tech', u'http://feedproxy.google.com/time/scienceandhealth')
,(u'World', u'http://feedproxy.google.com/time/world')
,(u'Entertainment', u'http://feedproxy.google.com/time/entertainment')
,(u'Politics', u'http://feedproxy.google.com/time/politics')
,(u'Travel', u'http://feedproxy.google.com/time/travel')
]
def print_version(self, url):
raw = self.browser.open(url).read()
soup = BeautifulSoup(raw.decode('utf8', 'replace'))
print_link = soup.find('a', {'id':'prt'})
if print_link is None:
return ''
return 'http://www.time.com' + print_link['href']