Update DW group of recipes

add recipe_specific_options
This commit is contained in:
unkn0w7n 2024-07-22 12:16:47 +05:30
parent 4c7255854d
commit a1a97acb07
8 changed files with 127 additions and 16 deletions

View File

@ -24,6 +24,20 @@ class DeutscheWelle_bs(BasicNewsRecipe):
dict(name='article') dict(name='article')
] ]
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)
remove_tags = [ remove_tags = [
dict(name=['footer', 'source']), dict(name=['footer', 'source']),
dict(attrs={'data-tracking-name':'sharing-icons-inline'}), dict(attrs={'data-tracking-name':'sharing-icons-inline'}),

View File

@ -21,6 +21,20 @@ class DeutscheWelle(BasicNewsRecipe):
dict(name='article') dict(name='article')
] ]
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)
remove_tags = [ remove_tags = [
dict(name=['footer', 'source']), dict(name=['footer', 'source']),
dict(attrs={'data-tracking-name':'sharing-icons-inline'}), dict(attrs={'data-tracking-name':'sharing-icons-inline'}),

View File

@ -16,6 +16,20 @@ class DeutscheWelle_en(BasicNewsRecipe):
ignore_duplicate_articles = {'title', 'url'} ignore_duplicate_articles = {'title', 'url'}
remove_attributes = ['height', 'width', 'style'] remove_attributes = ['height', 'width', 'style']
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 = [
dict(name='article') dict(name='article')
] ]

View File

@ -17,6 +17,20 @@ class DeutscheWelle_es(BasicNewsRecipe):
remove_attributes = ['height', 'width', 'style'] remove_attributes = ['height', 'width', 'style']
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 = [
dict(name='article') dict(name='article')
] ]

View File

@ -20,6 +20,20 @@ class DeutscheWelle_hr(BasicNewsRecipe):
ignore_duplicate_articles = {'title', 'url'} ignore_duplicate_articles = {'title', 'url'}
remove_attributes = ['height', 'width', 'style'] remove_attributes = ['height', 'width', 'style']
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 = [
dict(name='article') dict(name='article')
] ]

View File

@ -16,11 +16,24 @@ class DeutscheWelle_pt(BasicNewsRecipe):
remove_empty_feeds = True remove_empty_feeds = True
masthead_url = 'http://www.dw-world.de/skins/std/channel1/pics/dw_logo1024.gif' masthead_url = 'http://www.dw-world.de/skins/std/channel1/pics/dw_logo1024.gif'
remove_javascript = True remove_javascript = True
ignore_duplicate_articles = {'title', 'url'} ignore_duplicate_articles = {'title', 'url'}
remove_attributes = ['height', 'width', 'style'] remove_attributes = ['height', 'width', 'style']
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)
def preprocess_html(self, soup): def preprocess_html(self, soup):
for img in soup.findAll('img', srcset=True): for img in soup.findAll('img', srcset=True):
img['src'] = img['srcset'].split()[6] img['src'] = img['srcset'].split()[6]

View File

@ -17,6 +17,20 @@ class DeutscheWelle(BasicNewsRecipe):
ignore_duplicate_articles = {'title', 'url'} ignore_duplicate_articles = {'title', 'url'}
remove_attributes = ['height', 'width', 'style'] remove_attributes = ['height', 'width', 'style']
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)
def preprocess_html(self, soup): def preprocess_html(self, soup):
for img in soup.findAll('img', srcset=True): for img in soup.findAll('img', srcset=True):
img['src'] = img['srcset'].split()[6] img['src'] = img['srcset'].split()[6]

View File

@ -19,6 +19,20 @@ class DeutscheWelle_sr(BasicNewsRecipe):
ignore_duplicate_articles = {'title', 'url'} ignore_duplicate_articles = {'title', 'url'}
remove_attributes = ['height', 'width', 'style'] remove_attributes = ['height', 'width', 'style']
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)
def preprocess_html(self, soup): def preprocess_html(self, soup):
for img in soup.findAll('img', srcset=True): for img in soup.findAll('img', srcset=True):
img['src'] = img['srcset'].split()[6] img['src'] = img['srcset'].split()[6]