01-08-2023, 04:10 PM | #1 |
Unconscionable
Posts: 76
Karma: 20000
Join Date: Sep 2022
Location: Helsinki
Device: Kindle
|
Trying to write a recipe for Aeon.com
My coding skills are rather deplorable.
I might have re-written this code 50 times but it never works. The recipe should be quite simple. These are the premises. 1. RSS FEED source: https://aeon.co/feed.rss 2. Exclude "videos". 3. Output EPUB PHP Code:
|
01-09-2023, 12:27 AM | #2 |
Evangelist
Posts: 442
Karma: 82686
Join Date: May 2021
Device: kindle
|
just use 'create basic news recipe' and add feed.. it does everything for you. Why parse?
add this if you want to remove video articles.. do you specifically want to remove articles with 'videos' in title only? Code:
def print_version(self, url): if '/videos/' in url: return '' else: return url Last edited by unkn0wn; 01-09-2023 at 12:37 AM. |
01-09-2023, 12:43 AM | #3 |
Evangelist
Posts: 442
Karma: 82686
Join Date: May 2021
Device: kindle
|
this works. removing video articles is unnecessary, you could just skip over to next article.
Code:
#!/usr/bin/env python # vim:fileencoding=utf-8 from calibre.web.feeds.news import BasicNewsRecipe class AdvancedUserRecipe673238347(BasicNewsRecipe): title = 'Aeon' oldest_article = 30 max_articles_per_feed = 100 auto_cleanup = True feeds = [ ('aeon', 'https://aeon.co/feed.rss'), ] def print_version(self, url): if '/videos/' in url: return '' else: return url |
01-09-2023, 04:36 PM | #4 |
Unconscionable
Posts: 76
Karma: 20000
Join Date: Sep 2022
Location: Helsinki
Device: Kindle
|
Wow this works perfect, thank you a lot!
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Would someone be able to write up a custom recipe | TheBanana | Recipes | 0 | 09-21-2022 03:27 AM |
[Recipe Request] Aeon magazine | duluoz | Recipes | 1 | 05-12-2020 09:57 AM |
Aeon.co - Recipe download failed - CERTIFICATE_VERIFY_FAILED | emanu | Recipes | 13 | 07-16-2016 12:29 AM |
Re-Write for Handelsblatt Recipe (German Business Newspaper) | hegi | Recipes | 1 | 02-14-2015 07:40 AM |
HOW TO WRITE A RECIPE | hermanus | Recipes | 1 | 04-02-2013 12:10 PM |