Open Magazine by unkn0wn

This commit is contained in:
Kovid Goyal 2022-03-08 07:21:14 +05:30
parent 9a73323fa3
commit 7080d8914b
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -0,0 +1,48 @@
#!/usr/bin/env python
from calibre.web.feeds.news import BasicNewsRecipe, classes
class OpenMagazine(BasicNewsRecipe):
title = u'Open Magazine'
description = 'The weekly current affairs and features magazine.'
language = 'en_IN'
__author__ = 'unkn0wn'
oldest_article = 7 # days
max_articles_per_feed = 1
encoding = 'utf-8'
use_embedded_content = False
no_stylesheets = True
remove_attributes = ['style', 'height', 'width']
masthead_url = 'https://openthemagazine.com/wp-content/themes/open/images/logo.png'
ignore_duplicate_articles = {'url'}
extra_css = '[id^="caption-attachment"] {font-size: small;font-style: italic;}'
def get_cover_url(self):
soup = self.index_to_soup('https://openthemagazine.com/magazine/')
tag = soup.find(attrs={'class': 'mb-2 right-image'})
if tag:
self.cover_url = tag.find('img')['src']
return super().get_cover_url()
keep_only_tags = [
classes('post-data post-thumb post-meta post-excerp'),
]
remove_tags = [
classes('top-social menu-social post-author blurb-social button-links'),
]
remove_tags_after = [
classes('post-meta post-excerp'),
]
feeds = [
('Cover Story', 'https://openthemagazine.com/cover-story/feed/'),
('Columns', 'https://openthemagazine.com/columns/feed'),
('Essays', 'https://openthemagazine.com/essays/feed'),
('Features', 'https://openthemagazine.com/features/feed'),
('Books', 'https://openthemagazine.com/lounge/books/feed'),
('Art & Culture', 'https://openthemagazine.com/art-culture/feed'),
('Cinema', 'https://openthemagazine.com/cinema/feed'),
]