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
a766370f4e
@ -102,31 +102,27 @@ class Bloomberg(BasicNewsRecipe):
|
|||||||
self.log('Downloading ', edition)
|
self.log('Downloading ', edition)
|
||||||
self.cover_url = bw.find('img')['src'].replace('25x19', '600x800')
|
self.cover_url = bw.find('img')['src'].replace('25x19', '600x800')
|
||||||
soup = self.index_to_soup(edition)
|
soup = self.index_to_soup(edition)
|
||||||
timefmt = soup.find(**classes('section-front-header-module__title'))
|
if timefmt := soup.find(attrs={'class':lambda x: x and x.startswith('styles_MagazineTitle__')}):
|
||||||
if timefmt:
|
self.timefmt = ' [' + (self.tag_to_string(timefmt).replace(' Issue', '')).strip() + ']'
|
||||||
self.timefmt = ' [' + (self.tag_to_string(timefmt).replace('Issue', '')).strip() + ']'
|
|
||||||
|
|
||||||
feeds = []
|
feeds = []
|
||||||
for div in soup.findAll('div', attrs={'class':'story-list-module__info'}):
|
for div in soup.findAll(attrs={'class':lambda x: x and x.startswith(
|
||||||
h3 = div.find('h3', attrs={'class':'story-list-module__title'})
|
('styles_MagazineFeatures__', 'styles_MagazineStoryList__')
|
||||||
|
)}):
|
||||||
|
h3 = div.find(attrs={'class':lambda x: x and x.startswith(
|
||||||
|
('styles_featuresTitle__', 'styles_magazineSectionTitle__')
|
||||||
|
)})
|
||||||
sec = self.tag_to_string(h3)
|
sec = self.tag_to_string(h3)
|
||||||
self.log(sec)
|
self.log(sec)
|
||||||
articles = []
|
articles = []
|
||||||
for art in div.findAll('article'):
|
for art in div.findAll(attrs={'data-component':'headline'}):
|
||||||
a = art.find('a', **classes('story-list-story__info__headline-link'))
|
a = art.find('a', href=True)
|
||||||
url = a['href']
|
url = a['href']
|
||||||
if url.startswith('http') is False:
|
if url.startswith('http') is False:
|
||||||
url = 'https://www.bloomberg.com' + a['href']
|
url = 'https://www.bloomberg.com' + a['href']
|
||||||
title = self.tag_to_string(a)
|
title = self.tag_to_string(a)
|
||||||
desc = ''
|
articles.append({'title': title, 'url': url})
|
||||||
sum = art.find(**classes('story-list-story__info__summary'))
|
self.log('\t', title, '\n\t\t', url)
|
||||||
if sum:
|
|
||||||
desc = self.tag_to_string(sum).strip()
|
|
||||||
by = art.find(**classes('story-list-story__info__byline'))
|
|
||||||
if by:
|
|
||||||
desc = self.tag_to_string(by).strip() + ' | ' + desc
|
|
||||||
articles.append({'title': title, 'url': url, 'description': desc})
|
|
||||||
self.log('\t', title, '\n\t', desc, '\n\t\t', url)
|
|
||||||
if articles:
|
if articles:
|
||||||
feeds.append((sec, articles))
|
feeds.append((sec, articles))
|
||||||
return feeds
|
return feeds
|
||||||
|
Loading…
x
Reference in New Issue
Block a user