From fd5341919f25400a7c32f0b28b5eab68e691c63e Mon Sep 17 00:00:00 2001
From: unkn0w7n <51942695+unkn0w7n@users.noreply.github.com>
Date: Mon, 1 Jan 2024 14:11:28 +0530
Subject: [PATCH 1/2] economist
---
recipes/economist.recipe | 4 ++++
recipes/economist_free.recipe | 4 ++++
recipes/economist_world_ahead.recipe | 4 ++++
3 files changed, 12 insertions(+)
diff --git a/recipes/economist.recipe b/recipes/economist.recipe
index 8cae56d15c..4d27887e8b 100644
--- a/recipes/economist.recipe
+++ b/recipes/economist.recipe
@@ -205,6 +205,10 @@ class Economist(BasicNewsRecipe):
def preprocess_raw_html(self, raw, url):
# open('/t/raw.html', 'wb').write(raw.encode('utf-8'))
root = parse(raw)
+ if '/interactive/' in url:
+ return '
' + root.xpath('//h1')[0].text + '
' \
+ + 'This article is supposed to be read in a browser' \
+ + ''
script = root.xpath('//script[@id="__NEXT_DATA__"]')
if script:
try:
diff --git a/recipes/economist_free.recipe b/recipes/economist_free.recipe
index 8cae56d15c..4d27887e8b 100644
--- a/recipes/economist_free.recipe
+++ b/recipes/economist_free.recipe
@@ -205,6 +205,10 @@ class Economist(BasicNewsRecipe):
def preprocess_raw_html(self, raw, url):
# open('/t/raw.html', 'wb').write(raw.encode('utf-8'))
root = parse(raw)
+ if '/interactive/' in url:
+ return '' + root.xpath('//h1')[0].text + '
' \
+ + 'This article is supposed to be read in a browser' \
+ + ''
script = root.xpath('//script[@id="__NEXT_DATA__"]')
if script:
try:
diff --git a/recipes/economist_world_ahead.recipe b/recipes/economist_world_ahead.recipe
index f145240996..f3c11972d4 100644
--- a/recipes/economist_world_ahead.recipe
+++ b/recipes/economist_world_ahead.recipe
@@ -201,6 +201,10 @@ class Economist(BasicNewsRecipe):
def preprocess_raw_html(self, raw, url):
# open('/t/raw.html', 'wb').write(raw.encode('utf-8'))
root = parse(raw)
+ if '/interactive/' in url:
+ return '' + root.xpath('//h1')[0].text + '
' \
+ + 'This article is supposed to be read in a browser' \
+ + ''
script = root.xpath('//script[@id="__NEXT_DATA__"]')
if script:
try:
From a170eafd20c8b4d933e0b5de4153b80ae42bb715 Mon Sep 17 00:00:00 2001
From: unkn0w7n <51942695+unkn0w7n@users.noreply.github.com>
Date: Mon, 1 Jan 2024 14:19:20 +0530
Subject: [PATCH 2/2] ...
---
recipes/economist.recipe | 3 ---
recipes/economist_free.recipe | 3 ---
recipes/economist_world_ahead.recipe | 3 ---
3 files changed, 9 deletions(-)
diff --git a/recipes/economist.recipe b/recipes/economist.recipe
index 4d27887e8b..e33389a17a 100644
--- a/recipes/economist.recipe
+++ b/recipes/economist.recipe
@@ -297,9 +297,6 @@ class Economist(BasicNewsRecipe):
sub = safe_dict(part, "subheadline") or ''
if sub and section != sub:
desc = sub + ' :: ' + desc
- if '/interactive/' in url:
- self.log('Skipping interactive article:', title, url)
- continue
feeds_dict[section].append({"title": title, "url": url, "description": desc})
self.log(' ', title, url, '\n ', desc)
return [(section, articles) for section, articles in feeds_dict.items()]
diff --git a/recipes/economist_free.recipe b/recipes/economist_free.recipe
index 4d27887e8b..e33389a17a 100644
--- a/recipes/economist_free.recipe
+++ b/recipes/economist_free.recipe
@@ -297,9 +297,6 @@ class Economist(BasicNewsRecipe):
sub = safe_dict(part, "subheadline") or ''
if sub and section != sub:
desc = sub + ' :: ' + desc
- if '/interactive/' in url:
- self.log('Skipping interactive article:', title, url)
- continue
feeds_dict[section].append({"title": title, "url": url, "description": desc})
self.log(' ', title, url, '\n ', desc)
return [(section, articles) for section, articles in feeds_dict.items()]
diff --git a/recipes/economist_world_ahead.recipe b/recipes/economist_world_ahead.recipe
index f3c11972d4..b2d2e5ae97 100644
--- a/recipes/economist_world_ahead.recipe
+++ b/recipes/economist_world_ahead.recipe
@@ -285,9 +285,6 @@ class Economist(BasicNewsRecipe):
sub = safe_dict(part, "subheadline") or ''
if sub:
desc = sub + ' :: ' + desc
- if '/interactive/' in url:
- self.log('\tSkipping interactive article:', title, url)
- continue
self.log('\t', title, '\n\t', desc, '\n\t\t', url)
articles.append({'title': title, 'description':desc, 'url': url})
if articles: