![]() |
#1 |
Enthusiast
![]() Posts: 25
Karma: 10
Join Date: Jan 2024
Device: Kobo
|
Update Newspaper Front Cover
Hi, created a simple recipe that would include the newspaper front page each day. However that newspaper front cover is no longer updated daily on the current site. So I found a new site to pull the newspaper cover which is updated daily- but the recipe is not working. Not sure what I'm doing wrong (?)
Previous recipe (worked well): def get_cover_url(self): soup = self.index_to_soup('https://www.frontpages.com/star-tribune/') return 'https://www.frontpages.com' + soup.find('img', attrs={'id':'giornale-img'})['src'] New recipe (not working): def get_cover_url(self): soup = self.index_to_soup('https://frontpages.freedomforum.org/newspapers/mn_st-Star_Tribune') return 'https://frontpages.freedomforum.org' + soup.find('img', attrs={'id':'giornale-img'})['src'] Please let me know how to fix. The new recipe only pulls a generic cover. Thanks. |
![]() |
![]() |
![]() |
#2 |
Enthusiast
![]() Posts: 25
Karma: 10
Join Date: Jan 2024
Device: Kobo
|
Re: Update Newspaper Front Cover
Haven't seen any responses, thinking (hoping) this is a simple fix I can make within the recipe. Any thoughts on this? Please let me know, thanks.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Member
![]() Posts: 13
Karma: 10
Join Date: May 2025
Device: sony PRS T3
|
Try this:
def get_cover_url(self): from calibre import strftime
cover = 'https://d2dr22b2lm4tvw.cloudfront.net/mn_st/' + strftime("%Y-%m-%d") + '/front-page-large.jpg' return cover |
![]() |
![]() |
![]() |
#4 |
Enthusiast
![]() Posts: 25
Karma: 10
Join Date: Jan 2024
Device: Kobo
|
Thanks I couldn't get the cover to display from your updated code. Appreciate the effort.
Understanding I can swap out the cover myself in properties post-download, still looking for an automated script that will pull the cover as part of the recipe. Glad to review anyone else's attempts at this - thanks all. |
![]() |
![]() |
![]() |
#5 |
Junior Member
![]() Posts: 4
Karma: 10
Join Date: Jan 2025
Device: Kindle Paperwhite Gen 11
|
Why is this not working for you? I just tested it on a random existing recipe and it works fine.
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Enthusiast
![]() Posts: 25
Karma: 10
Join Date: Jan 2024
Device: Kobo
|
This is the full recipe, which continues to pull a generic Calibre cover. Anything I can update to make it work? I'm using the tab key to indent so maybe that's it. Otherwise just pasting in the 'get cover' code as provided. New at building recipes, so likely I'm missing something obvious:
Code:
from calibre.web.feeds.news import BasicNewsRecipe class AdvancedUserRecipe1706194709(BasicNewsRecipe): title = 'Star Tribune Test' oldest_article = 7 max_articles_per_feed = 100 auto_cleanup = True feeds = [ ('Local', 'https://www.startribune.com/local/index.rss2'), ('Sports', 'https://www.startribune.com/sports/index.rss2'), ('Business', 'https://www.startribune.com/business/index.rss2'), ('Politics', 'https://www.startribune.com/politics/index.rss2'), ('Opinion', 'https://www.startribune.com/opinion/index.rss2'), ('Variety', 'https://www.startribune.com/variety/index.rss2'), ('Photography', 'https://www.startribune.com/galleries/index.rss2'), ] def get_cover_url(self): from calibre import strftime cover = 'https://d2dr22b2lm4tvw.cloudfront.net/mn_st/' + strftime("%Y-%m-%d") + '/front-page-large.jpg' return cover Last edited by PeterT; Today at 09:31 AM. |
![]() |
![]() |
![]() |
#7 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 602
Karma: 85520
Join Date: May 2021
Device: kindle
|
use fetch cover code from zaobao recipe which used frontpages.freedomforum.org
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Calibre Recipe: Newspaper Front Page | Glenn680 | Recipes | 3 | 03-05-2024 11:34 AM |
PRS-650 using the touchscreen without the front cover. | temuchin | Sony Reader | 4 | 12-05-2013 11:24 PM |
PDF files get the front cover twice | bferrin | 1 | 04-20-2012 03:59 AM | |
Touch Front cover only? | rcrh | Barnes & Noble NOOK | 5 | 07-23-2011 02:19 AM |
Newspaper Update Time? | pengrus | Amazon Kindle | 4 | 02-27-2009 07:06 AM |