This commit is contained in:
Kovid Goyal 2024-07-26 10:51:35 +05:30
commit d5c2fa29ec
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
9 changed files with 53 additions and 9 deletions

View File

@ -1,3 +1,5 @@
#!/usr/bin/env python
# vim:fileencoding=utf-8
__license__ = 'GPL v3' __license__ = 'GPL v3'
__author__ = 'Luis Hernandez' __author__ = 'Luis Hernandez'
__copyright__ = 'Luis Hernandez<tolyluis@gmail.com>' __copyright__ = 'Luis Hernandez<tolyluis@gmail.com>'

View File

@ -1,3 +1,5 @@
#!/usr/bin/env python
# vim:fileencoding=utf-8
__license__ = 'GPL v3' __license__ = 'GPL v3'
__author__ = 'Ricardo Jurado' __author__ = 'Ricardo Jurado'
__copyright__ = 'Ricardo Jurado' __copyright__ = 'Ricardo Jurado'

View File

@ -53,11 +53,8 @@ class horizons(BasicNewsRecipe):
url = 'https://www.cirsd.org' + url url = 'https://www.cirsd.org' + url
self.cover_url = a.find('img')['src'] self.cover_url = a.find('img')['src']
self.log(self.cover_url) self.log(self.cover_url)
issue = a.find('div', attrs={'class':'horizon-gallery-title'}) self.title = url.split('/')[-1].replace('-', ' ').title()
if issue: self.log('Downloading Issue: ', self.title)
self.title = self.tag_to_string(issue).strip()
self.timefmt = ' [' + self.tag_to_string(issue).strip().replace('Horizons ', '') + ']'
self.log('Downloading Issue: ', self.timefmt, self.title)
soup = self.index_to_soup(url) soup = self.index_to_soup(url)
feeds = [] feeds = []

View File

@ -1,3 +1,5 @@
#!/usr/bin/env python
# vim:fileencoding=utf-8
from __future__ import print_function from __future__ import print_function
from calibre.web.feeds.news import BasicNewsRecipe from calibre.web.feeds.news import BasicNewsRecipe
@ -28,6 +30,20 @@ class HuffingtonPostRecipe(BasicNewsRecipe):
no_stylesheets = True no_stylesheets = True
remove_javascript = True remove_javascript = True
recipe_specific_options = {
'days': {
'short': 'Oldest article to download from this news source. In days ',
'long': 'For example, 0.5, gives you articles from the past 12 hours',
'default': str(oldest_article)
}
}
def __init__(self, *args, **kwargs):
BasicNewsRecipe.__init__(self, *args, **kwargs)
d = self.recipe_specific_options.get('days')
if d and isinstance(d, str):
self.oldest_article = float(d)
keep_only_tags = [ keep_only_tags = [
classes('entry__header entry__body') classes('entry__header entry__body')
] ]

View File

@ -1,3 +1,5 @@
#!/usr/bin/env python
# vim:fileencoding=utf-8
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2010-2012, Darko Miletic <darko.miletic at gmail.com>, Rogelio Domínguez <rogelio.dominguez@gmail.com>' __copyright__ = '2010-2012, Darko Miletic <darko.miletic at gmail.com>, Rogelio Domínguez <rogelio.dominguez@gmail.com>'
''' '''

View File

@ -79,9 +79,19 @@ class NewYorker(BasicNewsRecipe):
# img.save(buf, format='JPEG') # img.save(buf, format='JPEG')
# return buf.getvalue() # return buf.getvalue()
recipe_specific_options = {
'date': {
'short': 'The date of the edition to download (YYYY/MM/DD format)',
'long': 'For example, 2024/07/08'
}
}
def parse_index(self): def parse_index(self):
soup = self.index_to_soup( issue_url = 'https://www.newyorker.com/magazine?intcid=magazine'
'https://www.newyorker.com/magazine?intcid=magazine') d = self.recipe_specific_options.get('date')
if d and isinstance(d, str):
issue_url = 'https://www.newyorker.com/magazine/' + d
soup = self.index_to_soup(issue_url)
cover_img = soup.find('picture', cover_img = soup.find('picture',
attrs={'class': lambda x: x and 'asset-embed__responsive-asset' in x}) attrs={'class': lambda x: x and 'asset-embed__responsive-asset' in x})
if cover_img is not None: if cover_img is not None:

View File

@ -1,3 +1,5 @@
#!/usr/bin/env python
# vim:fileencoding=utf-8
from calibre.web.feeds.news import BasicNewsRecipe from calibre.web.feeds.news import BasicNewsRecipe
# feed source: https://www.nhk.or.jp/toppage/rss/index.html # feed source: https://www.nhk.or.jp/toppage/rss/index.html

View File

@ -19,7 +19,7 @@ class NewYorkMagazine(BasicNewsRecipe):
title = 'New York Magazine' title = 'New York Magazine'
__author__ = 'Kovid Goyal' __author__ = 'Kovid Goyal'
description = 'Food, culture, arts and entertainment in New York' description = 'Food, culture, arts and entertainment in New York'
language = 'en' language = 'en_US'
no_stylesheets = True no_stylesheets = True
remove_javascript = True remove_javascript = True
encoding = 'utf-8' encoding = 'utf-8'
@ -32,8 +32,19 @@ class NewYorkMagazine(BasicNewsRecipe):
] ]
remove_attributes = ['srcset'] remove_attributes = ['srcset']
recipe_specific_options = {
'date': {
'short': 'The date of the edition to download (YYYY-MM-DD format)',
'long': 'For example, 2024-07-01'
}
}
def nymag_get_index(self): def nymag_get_index(self):
return self.index_to_soup('https://nymag.com/maglinks/nym-home-05') issue_url = 'https://nymag.com/maglinks/nym-home-05'
d = self.recipe_specific_options.get('date')
if d and isinstance(d, str):
issue_url = 'https://nymag.com/magazine/toc/' + d + '.html'
return self.index_to_soup(issue_url)
def parse_index(self): def parse_index(self):
soup = self.nymag_get_index() soup = self.nymag_get_index()

View File

@ -1,3 +1,5 @@
#!/usr/bin/env python
# vim:fileencoding=utf-8
""" """
scmp.com scmp.com
""" """