Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 04-28-2019, 12:44 PM   #1
paddyrm
Connoisseur
paddyrm began at the beginning.
 
Posts: 67
Karma: 10
Join Date: Oct 2012
Device: Kindle 3
Guardian UK recipe adapted but does not fetch wanted article

I like to read two features by John Crace, who regularly writes for the Guardian, 1. "The Politics Sketch" and 2. "Digested Week". My recipe fetches the first whenever it appears (2 or 3 times a week), but never the second. Any ideas? Is there a code I could use to download anything in the issue by John Crace for instance?

Here are the URLs:
1.
http://www.theguardian.com/politics/...cabinet-leaker
2.
https://www.theguardian.com/uk-news/...red-an-upgrade

(and by the way https://www.theguardian.com/uk-news/2019/apr/26/all displays the requisite "Digested Week" along with other articles which DO download but are usually deleted as duplicates from eg Headlines)

I've adapted the tail end of the standard recipe like this (the dates are taken from the system on the day of download):
Code:
def parse_index(self):
        feeds = self.parse_section(self.base_url)
        feeds += self.parse_section(
            'https://www.theguardian.com/politics/series/the-politics-sketch/'+str(now.strftime("%Y/%b/%d/all")), 'Politics - ')
        feeds += self.parse_section(
            'https://www.theguardian.com/uk-news/'+str(now.strftime("%Y/%b/%d/all")), 'UK News - ')
        if date.today().weekday() in (5, 6):
            feeds += self.parse_section('https://www.theguardian.com/theguardian/weekend', 'Weekend - ')
        return feeds

Last edited by PeterT; 04-28-2019 at 05:52 PM.
paddyrm is offline   Reply With Quote
Old 04-29-2019, 12:13 AM   #2
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: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You will likely need to adjust the parse_section() function to deal with different markup on those pages, or maybe even write a new dedicated function for it.
kovidgoyal is offline   Reply With Quote
Old 04-29-2019, 03:51 AM   #3
paddyrm
Connoisseur
paddyrm began at the beginning.
 
Posts: 67
Karma: 10
Join Date: Oct 2012
Device: Kindle 3
Quote:
Originally Posted by kovidgoyal View Post
You will likely need to adjust the parse_section() function to deal with different markup on those pages, or maybe even write a new dedicated function for it.
Thanks Kovid: thinking hat on then! --Paddy
paddyrm is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Another Guardian article AlexBell News 3 07-26-2014 09:19 AM
Failed: Fetch News from The Guardian... CaliWenger Recipes 2 01-20-2014 06:30 PM
Literary treats for 2009 (Guardian article) Seabound News 1 01-05-2009 10:52 AM
And yet another UK Paper article: The Guardian LazyScot News 8 09-05-2008 09:31 AM
Guardian article about e-book readers grimo1re News 11 07-30-2008 12:07 AM


All times are GMT -4. The time now is 05:13 PM.


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