mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge branch 'master' of https://github.com/unkn0w7n/calibre
This commit is contained in:
commit
3032655349
@ -205,6 +205,10 @@ class Economist(BasicNewsRecipe):
|
|||||||
def preprocess_raw_html(self, raw, url):
|
def preprocess_raw_html(self, raw, url):
|
||||||
# open('/t/raw.html', 'wb').write(raw.encode('utf-8'))
|
# open('/t/raw.html', 'wb').write(raw.encode('utf-8'))
|
||||||
root = parse(raw)
|
root = parse(raw)
|
||||||
|
if '/interactive/' in url:
|
||||||
|
return '<html><body><article><h1>' + root.xpath('//h1')[0].text + '</h1><em>' \
|
||||||
|
+ 'This article is supposed to be read in a browser' \
|
||||||
|
+ '</em></article></body></html>'
|
||||||
script = root.xpath('//script[@id="__NEXT_DATA__"]')
|
script = root.xpath('//script[@id="__NEXT_DATA__"]')
|
||||||
if script:
|
if script:
|
||||||
try:
|
try:
|
||||||
@ -293,9 +297,6 @@ class Economist(BasicNewsRecipe):
|
|||||||
sub = safe_dict(part, "subheadline") or ''
|
sub = safe_dict(part, "subheadline") or ''
|
||||||
if sub and section != sub:
|
if sub and section != sub:
|
||||||
desc = sub + ' :: ' + desc
|
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})
|
feeds_dict[section].append({"title": title, "url": url, "description": desc})
|
||||||
self.log(' ', title, url, '\n ', desc)
|
self.log(' ', title, url, '\n ', desc)
|
||||||
return [(section, articles) for section, articles in feeds_dict.items()]
|
return [(section, articles) for section, articles in feeds_dict.items()]
|
||||||
|
@ -205,6 +205,10 @@ class Economist(BasicNewsRecipe):
|
|||||||
def preprocess_raw_html(self, raw, url):
|
def preprocess_raw_html(self, raw, url):
|
||||||
# open('/t/raw.html', 'wb').write(raw.encode('utf-8'))
|
# open('/t/raw.html', 'wb').write(raw.encode('utf-8'))
|
||||||
root = parse(raw)
|
root = parse(raw)
|
||||||
|
if '/interactive/' in url:
|
||||||
|
return '<html><body><article><h1>' + root.xpath('//h1')[0].text + '</h1><em>' \
|
||||||
|
+ 'This article is supposed to be read in a browser' \
|
||||||
|
+ '</em></article></body></html>'
|
||||||
script = root.xpath('//script[@id="__NEXT_DATA__"]')
|
script = root.xpath('//script[@id="__NEXT_DATA__"]')
|
||||||
if script:
|
if script:
|
||||||
try:
|
try:
|
||||||
@ -293,9 +297,6 @@ class Economist(BasicNewsRecipe):
|
|||||||
sub = safe_dict(part, "subheadline") or ''
|
sub = safe_dict(part, "subheadline") or ''
|
||||||
if sub and section != sub:
|
if sub and section != sub:
|
||||||
desc = sub + ' :: ' + desc
|
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})
|
feeds_dict[section].append({"title": title, "url": url, "description": desc})
|
||||||
self.log(' ', title, url, '\n ', desc)
|
self.log(' ', title, url, '\n ', desc)
|
||||||
return [(section, articles) for section, articles in feeds_dict.items()]
|
return [(section, articles) for section, articles in feeds_dict.items()]
|
||||||
|
@ -201,6 +201,10 @@ class Economist(BasicNewsRecipe):
|
|||||||
def preprocess_raw_html(self, raw, url):
|
def preprocess_raw_html(self, raw, url):
|
||||||
# open('/t/raw.html', 'wb').write(raw.encode('utf-8'))
|
# open('/t/raw.html', 'wb').write(raw.encode('utf-8'))
|
||||||
root = parse(raw)
|
root = parse(raw)
|
||||||
|
if '/interactive/' in url:
|
||||||
|
return '<html><body><article><h1>' + root.xpath('//h1')[0].text + '</h1><em>' \
|
||||||
|
+ 'This article is supposed to be read in a browser' \
|
||||||
|
+ '</em></article></body></html>'
|
||||||
script = root.xpath('//script[@id="__NEXT_DATA__"]')
|
script = root.xpath('//script[@id="__NEXT_DATA__"]')
|
||||||
if script:
|
if script:
|
||||||
try:
|
try:
|
||||||
@ -281,9 +285,6 @@ class Economist(BasicNewsRecipe):
|
|||||||
sub = safe_dict(part, "subheadline") or ''
|
sub = safe_dict(part, "subheadline") or ''
|
||||||
if sub:
|
if sub:
|
||||||
desc = sub + ' :: ' + desc
|
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)
|
self.log('\t', title, '\n\t', desc, '\n\t\t', url)
|
||||||
articles.append({'title': title, 'description':desc, 'url': url})
|
articles.append({'title': title, 'description':desc, 'url': url})
|
||||||
if articles:
|
if articles:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user