Nov-29-2017, 12:28 AM
import bs4 as bs import urllib.request sauce = urllib.request.urlopen('https://globenewswire.com/Search/NewsSearch?lang=en&exchange=NYSE').read() soup = bs.BeautifulSoup(sauce,'lxml') list = [] for div in soup.find_all('div', class_='results-link', limit=10): initialglobenewsnyseurls = ('https://globenewswire.com' + div.h1.a['href']) list.append(initialglobenewsnyseurls) a, b, c, d, e, f, g, h, i, j = listso far this works. The only problem is I have the exchange set to NYSE, but when I enter the url as such, NYSE is removed from it, as the url is automatically redirected to:
https://globenewswire.com/NewsRoom
(if you copy and paste the original url into chrome(the one in the code), it will redirect you to the main newsroom, and remove any criteria you previously selected. How can I keep this from happening?