Update specific_options

thepast.com recipes
This commit is contained in:
unkn0w7n 2024-07-21 17:39:24 +05:30
parent 788580fd9c
commit c3aa2b7119
6 changed files with 55 additions and 9 deletions

View File

@ -46,13 +46,21 @@ class ancientegypt(BasicNewsRecipe):
exp.name = 'p'
return soup
recipe_specific_options = {
'issue': {
'short': 'Enter the Issue Number you want to download ',
'long': 'For example, 136'
}
}
def parse_index(self):
soup = self.index_to_soup('https://the-past.com/category/magazines/ae/')
art = soup.find('article', attrs={'class':lambda x: x and 'tag-magazines' in x.split()})
url = art.h2.a['href']
# for past editions, add url
# url = ''
d = self.recipe_specific_options.get('issue')
if d and isinstance(d, str):
url = 'https://the-past.com/magazines/ae/ancient-egypt-magazine-' + d + '/'
issue = self.index_to_soup(url)
ti = issue.find('h1', attrs={'class':lambda x: x and 'post-title' in x.split()})

View File

@ -44,7 +44,7 @@ def get_contents(x):
class Bloomberg(BasicNewsRecipe):
title = 'Bloomberg Businessweek'
language = 'en'
language = 'en_US'
__author__ = 'unkn0wn'
no_stylesheets = True
remove_attributes = ['style', 'height', 'width']

View File

@ -19,6 +19,20 @@ class lexfridman(BasicNewsRecipe):
timefmt = ' [%b, %Y]'
cover_url = 'https://i.scdn.co/image/ab6765630000ba8a563ebb538d297875b10114b7'
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)
extra_css = '''
.ts-name { font-weight:bold; }
.ts-timestamp { font-size:small; }

View File

@ -45,13 +45,21 @@ class milthist(BasicNewsRecipe):
exp.name = 'p'
return soup
recipe_specific_options = {
'issue': {
'short': 'Enter the Issue Number you want to download ',
'long': 'For example, 136'
}
}
def parse_index(self):
soup = self.index_to_soup('https://the-past.com/category/magazines/mhm/')
art = soup.find('article', attrs={'class':lambda x: x and 'tag-magazines' in x.split()})
url = art.h2.a['href']
# for past editions, add url
# url = ''
d = self.recipe_specific_options.get('issue')
if d and isinstance(d, str):
url = 'https://the-past.com/magazines/military-history-matters-' + d + '/'
issue = self.index_to_soup(url)
ti = issue.find('h1', attrs={'class':lambda x: x and 'post-title' in x.split()})

View File

@ -45,13 +45,21 @@ class minerva(BasicNewsRecipe):
exp.name = 'p'
return soup
recipe_specific_options = {
'issue': {
'short': 'Enter the Issue Number you want to download ',
'long': 'For example, 136'
}
}
def parse_index(self):
soup = self.index_to_soup('https://the-past.com/category/magazines/minerva/')
art = soup.find('article', attrs={'class':lambda x: x and 'tag-magazines' in x.split()})
url = art.h2.a['href']
# for past editions, add url
# url = ''
d = self.recipe_specific_options.get('issue')
if d and isinstance(d, str):
url = 'https://the-past.com/magazines/minerva-magazine-' + d + '/'
issue = self.index_to_soup(url)
ti = issue.find('h1', attrs={'class':lambda x: x and 'post-title' in x.split()})

View File

@ -47,13 +47,21 @@ class worldarch(BasicNewsRecipe):
exp.name = 'p'
return soup
recipe_specific_options = {
'issue': {
'short': 'Enter the Issue Number you want to download ',
'long': 'For example, 136'
}
}
def parse_index(self):
soup = self.index_to_soup('https://the-past.com/category/magazines/cwa/')
art = soup.find('article', attrs={'class':lambda x: x and 'tag-magazines' in x.split()})
url = art.h2.a['href']
# for past editions, add url
# url = ''
d = self.recipe_specific_options.get('issue')
if d and isinstance(d, str):
url = 'https://the-past.com/magazines/current-world-archaeology-' + d + '/'
issue = self.index_to_soup(url)
ti = issue.find('h1', attrs={'class':lambda x: x and 'post-title' in x.split()})