mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update recipe for Arizone Daily Star. Fixes #5009 (News Source Error - Arizona Daily Star)
This commit is contained in:
parent
5e068530cd
commit
37db157f85
@ -1,10 +1,10 @@
|
|||||||
|
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
|
__copyright__ = '2009-2010, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
'''
|
'''
|
||||||
www.azstarnet.com
|
azstarnet.com
|
||||||
'''
|
'''
|
||||||
|
import urllib
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
class Azstarnet(BasicNewsRecipe):
|
class Azstarnet(BasicNewsRecipe):
|
||||||
@ -14,12 +14,12 @@ class Azstarnet(BasicNewsRecipe):
|
|||||||
language = 'en'
|
language = 'en'
|
||||||
publisher = 'azstarnet.com'
|
publisher = 'azstarnet.com'
|
||||||
category = 'news, politics, Arizona, USA'
|
category = 'news, politics, Arizona, USA'
|
||||||
delay = 1
|
|
||||||
oldest_article = 3
|
oldest_article = 3
|
||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
encoding = 'utf-8'
|
encoding = 'utf-8'
|
||||||
|
masthead_url = 'http://azstarnet.com/content/tncms/live/global/resources/images/logo.gif'
|
||||||
needs_subscription = True
|
needs_subscription = True
|
||||||
|
|
||||||
conversion_options = {
|
conversion_options = {
|
||||||
@ -32,31 +32,27 @@ class Azstarnet(BasicNewsRecipe):
|
|||||||
|
|
||||||
def get_browser(self):
|
def get_browser(self):
|
||||||
br = BasicNewsRecipe.get_browser()
|
br = BasicNewsRecipe.get_browser()
|
||||||
|
br.open('http://azstarnet.com/')
|
||||||
if self.username is not None and self.password is not None:
|
if self.username is not None and self.password is not None:
|
||||||
br.open('http://azstarnet.com/registration/retro.php')
|
data = urllib.urlencode({ 'm':'login'
|
||||||
br.select_form(nr=1)
|
,'u':self.username
|
||||||
br['email'] = self.username
|
,'p':self.password
|
||||||
br['pass' ] = self.password
|
,'z':'http://azstarnet.com/'
|
||||||
br.submit()
|
})
|
||||||
|
br.open('http://azstarnet.com/app/registration/proxy.php',data)
|
||||||
return br
|
return br
|
||||||
|
|
||||||
|
remove_tags = [dict(name=['object','link','iframe','base','img'])]
|
||||||
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 = [
|
feeds = [
|
||||||
(u'Tucson Region', u'http://rss.azstarnet.com/index.php?site=metro')
|
(u'Local News' , u'http://azstarnet.com/search/?f=rss&t=article&c=news/local&l=25&s=start_time&sd=desc')
|
||||||
,(u'Sports' , u'http://rss.azstarnet.com/index.php?site=sports')
|
,(u'National News' , u'http://azstarnet.com/search/?f=rss&t=article&c=news/national&l=25&s=start_time&sd=desc')
|
||||||
,(u'Business' , u'http://rss.azstarnet.com/index.php?site=biz-topheadlines')
|
,(u'World News' , u'http://azstarnet.com/search/?f=rss&t=article&c=news/world&l=25&s=start_time&sd=desc')
|
||||||
,(u'Nation-World' , u'http://rss.azstarnet.com/index.php?site=news')
|
,(u'Sports' , u'http://azstarnet.com/search/?f=rss&t=article&c=sports&l=25&s=start_time&sd=desc')
|
||||||
,(u'Opinion' , u'http://rss.azstarnet.com/index.php?site=opinion')
|
,(u'Opinion' , u'http://azstarnet.com/search/?f=rss&t=article&c=news/opinion&l=25&s=start_time&sd=desc')
|
||||||
,(u'Lifestyle' , u'http://rss.azstarnet.com/index.php?site=accent')
|
,(u'Movies' , u'http://azstarnet.com/search/?f=rss&t=article&c=entertainment/movies&l=25&s=start_time&sd=desc')
|
||||||
,(u'Food' , u'http://rss.azstarnet.com/index.php?site=food')
|
,(u'Food' , u'http://azstarnet.com/search/?f=rss&t=article&c=lifestyles/food-and-cooking&l=25&s=start_time&sd=desc')
|
||||||
]
|
]
|
||||||
|
|
||||||
def preprocess_html(self, soup):
|
def preprocess_html(self, soup):
|
||||||
@ -64,4 +60,6 @@ class Azstarnet(BasicNewsRecipe):
|
|||||||
del item['style']
|
del item['style']
|
||||||
return soup
|
return soup
|
||||||
|
|
||||||
|
def print_version(self, url):
|
||||||
|
return url + '?print=1'
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user