Skip to content

Commit

Permalink
Update Bloomberg Business Week
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Oct 30, 2022
1 parent 73637ba commit 4c08d56
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions recipes/bloomberg-business-week.recipe
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Bloomberg(BasicNewsRecipe):
ignore_duplicate_articles = {'url'}
resolve_internal_links = True
masthead_url = 'https://assets.bwbx.io/s3/javelin/public/hub/images/BW-Logo-Black-cc9035fbb3.svg'
delay = 1.5
delay = 2
extra_css = '''
#auth {font-size:small; font-weight:bold;}
#time {font-size:small;}
Expand All @@ -23,6 +23,11 @@ class Bloomberg(BasicNewsRecipe):
.news-figure-credit {font-size:small; text-align:center; color:#202020;}
'''

remove_tags = [
dict(name='div', attrs={'id':['bb-that', 'bb-nav']}),
classes('twitter-logo bb-global-footer')
]

def get_browser(self):
br = browser()
br.set_handle_redirect(False)
Expand All @@ -47,7 +52,9 @@ class Bloomberg(BasicNewsRecipe):
articles = []
for art in div.findAll('article'):
a = art.find('a', **classes('story-list-story__info__headline-link'))
url = 'https://www.bloomberg.com' + a['href']
url = a['href']
if url.startswith('http') is False:
url = 'https://www.bloomberg.com' + a['href']
title = self.tag_to_string(a)
desc = ''
sum = art.find(**classes('story-list-story__info__summary'))
Expand All @@ -66,7 +73,8 @@ class Bloomberg(BasicNewsRecipe):
m = re.search('data-component-props="ArticleBody">', raw)
if not m:
m = re.search('data-component-props="FeatureBody">', raw)

if not m:
return raw
raw = raw[m.start():]
raw = raw.split('>', 1)[1]
data = json.JSONDecoder().raw_decode(raw)[0]
Expand Down

0 comments on commit 4c08d56

Please sign in to comment.