mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update wsj.recipe
This commit is contained in:
parent
484e70ab96
commit
6fe43235a6
@ -13,7 +13,7 @@ past_edition = None
|
|||||||
|
|
||||||
def media_bucket(x):
|
def media_bucket(x):
|
||||||
if x.get('type', '') == 'image':
|
if x.get('type', '') == 'image':
|
||||||
if x.get('subtype', '') == 'graphic':
|
if x.get('subtype', '') == 'graphic' or 'images.wsj.net' not in x['manifest-url']:
|
||||||
return '<br><img src="{}"><div class="figc">{}</div>\n'.format(
|
return '<br><img src="{}"><div class="figc">{}</div>\n'.format(
|
||||||
x['manifest-url'], x['caption'] + '<i> ' + x['credit'] + '</i>'
|
x['manifest-url'], x['caption'] + '<i> ' + x['credit'] + '</i>'
|
||||||
)
|
)
|
||||||
@ -82,6 +82,7 @@ class WSJ(BasicNewsRecipe):
|
|||||||
byl.insert(0, read)
|
byl.insert(0, read)
|
||||||
url = soup.find('p', attrs={'id':'share-link'})
|
url = soup.find('p', attrs={'id':'share-link'})
|
||||||
if url:
|
if url:
|
||||||
|
url.name = 'div'
|
||||||
url['title'] = self.tag_to_string(url).strip()
|
url['title'] = self.tag_to_string(url).strip()
|
||||||
url.string = ''
|
url.string = ''
|
||||||
panel = soup.find('panel', attrs={'id':'metadata'})
|
panel = soup.find('panel', attrs={'id':'metadata'})
|
||||||
@ -97,6 +98,11 @@ class WSJ(BasicNewsRecipe):
|
|||||||
x.insert_after(BeautifulSoup(y, 'html.parser'))
|
x.insert_after(BeautifulSoup(y, 'html.parser'))
|
||||||
return soup
|
return soup
|
||||||
|
|
||||||
|
def postprocess_html(self, soup, first_fetch):
|
||||||
|
for pan in soup.findAll('panel'):
|
||||||
|
pan.name = 'div'
|
||||||
|
return soup
|
||||||
|
|
||||||
if not past_edition:
|
if not past_edition:
|
||||||
def _download_cover(self):
|
def _download_cover(self):
|
||||||
import os
|
import os
|
||||||
@ -178,6 +184,6 @@ class WSJ(BasicNewsRecipe):
|
|||||||
return BeautifulSoup(raw).prettify()
|
return BeautifulSoup(raw).prettify()
|
||||||
|
|
||||||
def populate_article_metadata(self, article, soup, first):
|
def populate_article_metadata(self, article, soup, first):
|
||||||
lnk = soup.find('p', attrs={'id':'share-link'})
|
lnk = soup.find('div', attrs={'id':'share-link'})
|
||||||
if lnk:
|
if lnk:
|
||||||
article.url = lnk['title']
|
article.url = lnk['title']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user