| 1 |
from calibre.web.feeds.news import BasicNewsRecipe |
| 2 |
|
| 3 |
|
| 4 |
class TheConversation(BasicNewsRecipe): |
| 5 |
title = 'The Conversation' |
| 6 |
language = 'en' |
| 7 |
__author__ = 'Krittika Goyal' |
| 8 |
oldest_article = 4 # days |
| 9 |
max_articles_per_feed = 20 |
| 10 |
use_embedded_content = False |
| 11 |
|
| 12 |
no_stylesheets = True |
| 13 |
auto_cleanup = False |
| 14 |
|
| 15 |
keep_only_tags = [ |
| 16 |
# Hero image + figcaption + h1 title + publication date — nested |
| 17 |
# inside <figure class="magazine"> on theconversation.com. |
| 18 |
dict(name='figure', attrs={'class': 'magazine'}), |
| 19 |
# Byline: author name, institutional affiliation, photo. |
| 20 |
dict(name='section', attrs={'class': 'content-authors'}), |
| 21 |
# Article body. |
| 22 |
dict(attrs={'itemprop': 'articleBody'}), |
| 23 |
# Disclosure statement ("X does not work for, consult, ..." etc). |
| 24 |
dict(name='section', attrs={'class': 'content-disclosure-statement'}), |
| 25 |
] |
| 26 |
|
| 27 |
remove_tags = [ |
| 28 |
# Mobile-only collapsed byline summary that duplicates author info. |
| 29 |
dict(attrs={'class': 'content-authors-synopsis'}), |
| 30 |
dict(attrs={'class': 'content-authors-toggle'}), |
| 31 |
# JS-injected promo placeholders interspersed in the body. |
| 32 |
dict(attrs={'class': 'slot'}), |
| 33 |
dict(attrs={'class': 'inline-promos-skeleton'}), |
| 34 |
] |
| 35 |
|
| 36 |
feeds = [ |
| 37 |
('All Articles', 'https://theconversation.com/au/articles.atom'), |
| 38 |
('Arts + Culture', 'https://theconversation.com/au/arts/articles.atom'), |
| 39 |
('Business + Economy', 'https://theconversation.com/au/business/articles.atom'), |
| 40 |
('Cities', 'https://theconversation.com/au/cities/articles.atom'), |
| 41 |
('Education', 'https://theconversation.com/au/education/articles.atom'), |
| 42 |
('Enviroment + Energy', 'https://theconversation.com/au/environment/articles.atom'), |
| 43 |
('Health + Medicine', 'https://theconversation.com/au/health/articles.atom'), |
| 44 |
('Politics + Society', 'https://theconversation.com/au/politics/articles.atom'), |
| 45 |
('Science + Technology', 'https://theconversation.com/au/technology/articles.atom'), |
| 46 |
] |