mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-01-06 03:05:05 +01:00
67 lines
2.3 KiB
Text
67 lines
2.3 KiB
Text
|
|
__license__ = 'GPL v3'
|
|
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
|
|
'''
|
|
www.azstarnet.com
|
|
'''
|
|
|
|
from calibre.web.feeds.news import BasicNewsRecipe
|
|
|
|
class Azstarnet(BasicNewsRecipe):
|
|
title = 'Arizona Daily Star'
|
|
__author__ = 'Darko Miletic'
|
|
description = 'news from Arizona'
|
|
language = 'en'
|
|
publisher = 'azstarnet.com'
|
|
category = 'news, politics, Arizona, USA'
|
|
delay = 1
|
|
oldest_article = 3
|
|
max_articles_per_feed = 100
|
|
no_stylesheets = True
|
|
use_embedded_content = False
|
|
encoding = 'utf-8'
|
|
needs_subscription = True
|
|
|
|
conversion_options = {
|
|
'comment' : description
|
|
, 'tags' : category
|
|
, 'publisher' : publisher
|
|
, 'language' : language
|
|
}
|
|
|
|
|
|
def get_browser(self):
|
|
br = BasicNewsRecipe.get_browser()
|
|
if self.username is not None and self.password is not None:
|
|
br.open('http://azstarnet.com/registration/retro.php')
|
|
br.select_form(nr=1)
|
|
br['email'] = self.username
|
|
br['pass' ] = self.password
|
|
br.submit()
|
|
return br
|
|
|
|
|
|
keep_only_tags = [dict(name='div', attrs={'id':'storycontent'})]
|
|
|
|
remove_tags = [
|
|
dict(name=['object','link','iframe','base','img'])
|
|
,dict(name='div',attrs={'class':'bannerinstory'})
|
|
]
|
|
|
|
|
|
feeds = [
|
|
(u'Tucson Region', u'http://rss.azstarnet.com/index.php?site=metro')
|
|
,(u'Sports' , u'http://rss.azstarnet.com/index.php?site=sports')
|
|
,(u'Business' , u'http://rss.azstarnet.com/index.php?site=biz-topheadlines')
|
|
,(u'Nation-World' , u'http://rss.azstarnet.com/index.php?site=news')
|
|
,(u'Opinion' , u'http://rss.azstarnet.com/index.php?site=opinion')
|
|
,(u'Lifestyle' , u'http://rss.azstarnet.com/index.php?site=accent')
|
|
,(u'Food' , u'http://rss.azstarnet.com/index.php?site=food')
|
|
]
|
|
|
|
def preprocess_html(self, soup):
|
|
for item in soup.findAll(style=True):
|
|
del item['style']
|
|
return soup
|
|
|
|
|