Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Recipes

Notices

Reply
 
Thread Tools Search this Thread
Old 02-19-2018, 07:34 PM   #31
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 32,922
Karma: 10034422
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
@davidnye: The username and password were not used int he old recipe either. The NYT uses a captcha at login even with valid usernames and passwords.

@bobbysteel: Because I have no interest in implementing/maintaining it, and it creates extremely large downloads.
kovidgoyal is online now   Reply With Quote
Advert
Old 02-21-2018, 05:38 AM   #32
nelson1379
Enthusiast
nelson1379 began at the beginning.
 
Posts: 26
Karma: 32
Join Date: Jan 2012
Device: Kindle Paperwhite
I saw you caught the class "supported-by" that added some cruft to articles. Thanks! There's just one more class at the moment that I've found, "accessibility-ad-header visually-hidden", that also adds cruft to each article (typically the word "Advertisement" to each article, around the fifth paragraph). I used this line in my own recipe, which does the job:

Quote:
classes('accessibility-ad-header visually-hidden'),
A side question -- I'm still curious about replacing hyperlinks in the recipe with plain old text, a change which I gather is not desirable for the upstream recipe in Calibre. I've been trying to implement it in the version of the recipe that I run, and from what I've seen on this forum and in other recipes, this bit of code is instrumental in removing hyperlinks:

Quote:
def preprocess_html(self, soup):
for alink in soup.findAll('a'):
if alink.string is not None:
tstr = alink.string
alink.replaceWith(tstr)
return soup
I've tried it everywhere in the NYT recipe, but wherever I put it, it seems to have no effect. Can anyone tell me if there's something I'm missing -- is there a place I'm supposed to put it, or an extra bit of code that it hooks into, or something special about the structure of this recipe that requires something different? Thanks.
nelson1379 is offline   Reply With Quote
Old 02-21-2018, 06:31 AM   #33
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 32,922
Karma: 10034422
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You are probably indenting it incorrectly. The method needs to be indented at four spaces to be considered a part of the class. But probably easier to just add

remove_attributes = ['href']
kovidgoyal is online now   Reply With Quote
Old 02-22-2018, 05:48 AM   #34
nelson1379
Enthusiast
nelson1379 began at the beginning.
 
Posts: 26
Karma: 32
Join Date: Jan 2012
Device: Kindle Paperwhite
Thank you -- that's perfect.
nelson1379 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
New York Times Technology Beat is broken NSILMike Recipes 1 04-16-2017 12:55 AM
New York Times Book Review broken again. wingmongyee Recipes 9 03-24-2016 07:20 PM
New York Times Book Review broken wingmongyee Recipes 3 01-02-2016 12:32 AM
New York Times Recipe dieterpops Recipes 1 01-20-2013 12:26 PM
New York Times recipe broken? gianfri Calibre 1 03-20-2010 09:52 AM


All times are GMT -4. The time now is 03:24 AM.


MobileRead.com is a privately owned, operated and funded community.