![]() |
#1 |
Connoisseur
![]() Posts: 68
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. |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,185
Karma: 27110894
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.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Connoisseur
![]() Posts: 68
Karma: 10
Join Date: Oct 2012
Device: Kindle 3
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
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 |