mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Update Bloomberg
This commit is contained in:
parent
5160369cb4
commit
01bb16a692
@ -34,12 +34,15 @@ class Bloomberg(BasicNewsRecipe):
|
|||||||
br.open(url)
|
br.open(url)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
url = e.hdrs.get('location')
|
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 = PersistentTemporaryFile('.html')
|
||||||
pt.write(html)
|
pt.write(html)
|
||||||
pt.close()
|
pt.close()
|
||||||
return pt.name
|
return pt.name
|
||||||
|
|
||||||
|
|
||||||
def get_browser(self):
|
def get_browser(self):
|
||||||
br = browser()
|
br = browser()
|
||||||
br.set_handle_redirect(False)
|
br.set_handle_redirect(False)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user