|
|
#1 |
|
Unconscionable
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 89
Karma: 25000
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:
|
|
|
|
|
|
#2 |
|
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 645
Karma: 85520
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 01:37 AM. |
|
|
|
| Advert | |
|
|
|
|
#3 |
|
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 645
Karma: 85520
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
|
|
|
|
|
|
#4 |
|
Unconscionable
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 89
Karma: 25000
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 04:27 AM |
| [Recipe Request] Aeon magazine | duluoz | Recipes | 1 | 05-12-2020 10:57 AM |
| Aeon.co - Recipe download failed - CERTIFICATE_VERIFY_FAILED | emanu | Recipes | 13 | 07-16-2016 01:29 AM |
| Re-Write for Handelsblatt Recipe (German Business Newspaper) | hegi | Recipes | 1 | 02-14-2015 08:40 AM |
| HOW TO WRITE A RECIPE | hermanus | Recipes | 1 | 04-02-2013 01:10 PM |