![]() |
#1 |
Junior Member
![]() Posts: 7
Karma: 10
Join Date: May 2011
Device: kindle, SONY T1
|
Update for Nikkei Paper
nikkei_news.recipe is no longer working. here is a patch for it.
please include this into calibre. thank you. ( I also attached whole recipe ) --- calibre/recipes/nikkei_news.recipe 2011-08-28 01:05:34.184509000 +0900 +++ nikkei_news.recipe 2011-08-29 18:25:30.284952392 +0900 @@ -37,24 +37,24 @@ #br.set_debug_responses(True) if self.username is not None and self.password is not None: - print "----------------------------open top page----------------------------------------" + print "-------------------------open top page-------------------------------------" br.open('http://www.nikkei.com/') - print "----------------------------open first login form--------------------------------" + print "-------------------------open first login form-----------------------------" link = br.links(url_regex="www.nikkei.com/etc/accounts/login").next() br.follow_link(link) #response = br.response() #print response.get_data() - print "----------------------------JS redirect(send autoPostForm)-----------------------" + print "-------------------------JS redirect(send autoPostForm)--------------------" br.select_form(name='autoPostForm') br.submit() #response = br.response() - print "----------------------------got login form---------------------------------------" + print "-------------------------got login form------------------------------------" br.select_form(name='LA0210Form01') br['LA0210Form01:LA0210Email'] = self.username br['LA0210Form01:LA0210Password'] = self.password br.submit() #response = br.response() - print "----------------------------JS redirect------------------------------------------" + print "-------------------------JS redirect---------------------------------------" br.select_form(nr=0) br.submit() @@ -64,18 +64,23 @@ return br def cleanup(self): - print "----------------------------logout-----------------------------------------------" + print "-------------------------logout--------------------------------------------" self.browser.open('https://regist.nikkei.com/ds/etc/accounts/logout') def parse_index(self): - print "----------------------------get index of paper-----------------------------------" + print "-------------------------get index of paper--------------------------------" result = [] soup = self.index_to_soup('http://www.nikkei.com/paper/') #soup = self.index_to_soup(self.test_data()) - for sect in soup.findAll('div', 'cmn-section kn-special JSID_baseSection'): + sections = soup.findAll('div', 'cmn-section kn-special JSID_baseSection') + if len(sections) == 0: + sections = soup.findAll('div', 'cmn-section kn-special') + for sect in sections: sect_title = sect.find('h3', 'cmnc-title').string sect_result = [] for elem in sect.findAll(attrs={'class':['cmn-article_title']}): + if elem.span.a == None or elem.span.a['href'].startswith('javascript') : + continue url = 'http://www.nikkei.com' + elem.span.a['href'] url = re.sub("/article/", "/print-article/", url) # print version. span = elem.span.a.span @@ -84,6 +89,5 @@ sect_result.append(dict(title=title, url=url, date='', description='', content='')) result.append([sect_title, sect_result]) - #pp.pprint(result) return result |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Nikkei News (paper section) | adonishi | Recipes | 2 | 12-22-2014 08:31 AM |
Nikkei/Problematic site that need form-post before processing | miurahr | Recipes | 6 | 11-21-2010 01:27 PM |
Quantum Paper claims to revolutionize electronic display/paper industry | Alexander Turcic | News | 12 | 04-09-2008 11:20 PM |
Paper Four: Digital paper that talks to you | Alexander Turcic | News | 10 | 06-09-2007 10:28 AM |
PVI delays flexible e-paper to end-2007 / color e-paper in 2009 | Alexander Turcic | News | 1 | 06-08-2007 03:52 AM |