mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Revert to using old nytimes profile, since the reader cant handle the LRF file created by the new profile
This commit is contained in:
parent
3c7f0c2ffa
commit
30182d8657
@ -173,11 +173,12 @@ class DefaultProfile(object):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, logger, verbose=False, username=None, password=None):
|
def __init__(self, logger, verbose=False, username=None, password=None, lrf=True):
|
||||||
self.logger = logger
|
self.logger = logger
|
||||||
self.username = username
|
self.username = username
|
||||||
self.password = password
|
self.password = password
|
||||||
self.verbose = verbose
|
self.verbose = verbose
|
||||||
|
self.lrf = lrf
|
||||||
self.temp_dir = tempfile.mkdtemp(prefix=__appname__+'_')
|
self.temp_dir = tempfile.mkdtemp(prefix=__appname__+'_')
|
||||||
self.browser = self.get_browser()
|
self.browser = self.get_browser()
|
||||||
try:
|
try:
|
||||||
|
@ -53,7 +53,24 @@ class NYTimes(DefaultProfile):
|
|||||||
br.submit()
|
br.submit()
|
||||||
return br
|
return br
|
||||||
|
|
||||||
|
def get_feeds(self):
|
||||||
|
src = self.browser.open('http://www.nytimes.com/services/xml/rss/index.html').read()
|
||||||
|
soup = BeautifulSoup(src[src.index('<html'):])
|
||||||
|
feeds = []
|
||||||
|
for link in soup.findAll('link', attrs={'type':'application/rss+xml'}):
|
||||||
|
if link['title'] not in ['NYTimes.com Homepage', 'Obituaries', 'Pogue\'s Posts',
|
||||||
|
'Dining & Wine', 'Home & Garden', 'Multimedia',
|
||||||
|
'Most E-mailed Articles',
|
||||||
|
'Automobiles', 'Fashion & Style', 'Television News',
|
||||||
|
'Education']:
|
||||||
|
feeds.append((link['title'], link['href'].replace('graphics8', 'www')))
|
||||||
|
|
||||||
|
return feeds
|
||||||
|
|
||||||
|
|
||||||
def parse_feeds(self):
|
def parse_feeds(self):
|
||||||
|
if self.lrf: # The new feed causes the SONY Reader to crash
|
||||||
|
return DefaultProfile.parse_feeds(self)
|
||||||
src = self.browser.open('http://www.nytimes.com/pages/todayspaper/index.html').read().decode('cp1252')
|
src = self.browser.open('http://www.nytimes.com/pages/todayspaper/index.html').read().decode('cp1252')
|
||||||
soup = BeautifulSoup(src)
|
soup = BeautifulSoup(src)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user