From 01bb16a692ce8b1064382682fc9ddb393ee394f3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 4 Feb 2023 13:01:55 +0530 Subject: [PATCH] Update Bloomberg --- recipes/bloomberg.recipe | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/recipes/bloomberg.recipe b/recipes/bloomberg.recipe index 75f0812f09..ac57b37a74 100644 --- a/recipes/bloomberg.recipe +++ b/recipes/bloomberg.recipe @@ -34,12 +34,15 @@ class Bloomberg(BasicNewsRecipe): br.open(url) except Exception as e: url = e.hdrs.get('location') - html = br.open(url).read() + soup = self.index_to_soup(url) + link = soup.find('a', attrs={'href':lambda x: x and x.startswith('https://www.bloomberg.com')}) + html = br.open(link['href']).read() pt = PersistentTemporaryFile('.html') pt.write(html) pt.close() return pt.name + def get_browser(self): br = browser() br.set_handle_redirect(False)