![]() |
#1 |
Junior Member
![]() Posts: 7
Karma: 10
Join Date: May 2011
Device: kindle, SONY T1
|
update for JBPress and NBOnline recipes.
Hi,
these two patches are for Japanese online news sites which is already in Calibre. JBPress: removed bread-crumb from data. Code:
--- jbpress.recipe.was 2011-07-19 15:47:34.041987888 +0900 +++ jbpress.recipe 2011-07-17 11:32:29.569978720 +0900 @@ -1,4 +1,4 @@ -import urllib2 +import urllib2, re from calibre.web.feeds.news import BasicNewsRecipe class JBPress(BasicNewsRecipe): @@ -41,3 +41,10 @@ url = urllib2.urlopen(url).geturl() # resolve redirect. return url.replace('/-/', '/print/') + def preprocess_html(self, soup): + # remove breadcrumb + h3s = soup.findAll('h3') + for h3 in h3s: + if re.compile('^JBpress>').match(h3.string): + h3.extract() + return soup Code:
--- nbonline.recipe.was 2011-06-07 12:51:48.828815380 +0900 +++ nbonline.recipe 2011-07-19 15:59:04.197985474 +0900 @@ -1,11 +1,9 @@ -EMAILADDRESS = 'ado@sig.or.jp' from calibre.web.feeds.news import BasicNewsRecipe - class NBOnline(BasicNewsRecipe): title = u'Nikkei Business Online' language = 'ja' - description = u'Nikkei Business Online New articles. PLEASE NOTE: You need to edit EMAILADDRESS line of this "nbonline.recipe" file to set your e-mail address which is needed when login. (file is in "Calibre2/resources/recipes" directory.)' + description = u'Nikkei Business Online.\u6CE8\uFF1A\u30E6\u30FC\u30B6\u30FC\u540D\u306Bemail\u30A2\u30C9\u30EC\u30B9\u3068\u30E6\u30FC\u30B6\u30FC\u540D\u3092\u30BB\u30DF\u30B3\u30ED\u30F3\u3067\u533A\u5207\u3063\u3066\u5165\u308C\u3066\u304F\u3060\u3055\u3044\u3002\u4F8B\uFF1Aemail@address.jp;username . PLEASE NOTE: You need to put your email address and username into username filed separeted by ; (semi-colon).' __author__ = 'Ado Nishimura' needs_subscription = True oldest_article = 7 @@ -24,8 +22,8 @@ if self.username is not None and self.password is not None: br.open('https://signon.nikkeibp.co.jp/front/login/?ct=p&ts=nbo') br.select_form(name='loginActionForm') - br['email'] = EMAILADDRESS - br['userId'] = self.username + br['email'] = self.username.split(';')[0] + br['userId'] = self.username.split(';')[1] br['password'] = self.password br.submit() return br thank you. Ado Nishimura |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
won't update...after completing the update cycle edge returns to the first screen | WeAreBorrg | enTourage Archive | 2 | 03-18-2011 06:39 PM |
How can I update creation time for a title when I update the book info or convert it | setherd | Calibre | 3 | 10-30-2010 01:51 PM |
Firmware Update Can I reinstall the official amazon update after the update file from this site ? | yuenslhk | Amazon Kindle | 2 | 06-20-2010 11:24 AM |
Update on Google eBook Sales Plan Update | poohbear_nc | News | 6 | 05-05-2010 09:00 AM |
PRS-500 What file to change to re-update reader with latest update? | pitolee | Sony Reader Dev Corner | 2 | 05-24-2007 11:56 PM |