Skip to content

Instantly share code, notes, and snippets.

@Yousuf28
Last active July 17, 2019 17:25
Show Gist options
  • Save Yousuf28/8eea202bc4413d0da0e021b98f43ebee to your computer and use it in GitHub Desktop.
Save Yousuf28/8eea202bc4413d0da0e021b98f43ebee to your computer and use it in GitHub Desktop.
from requests import get
from bs4 import BeautifulSoup
# link
url = 'https://www.drugs.com/pharmaceutical-companies.html'
response = get(url)
soup = BeautifulSoup(response.text, 'html.parser')
links = []
for a in soup.find_all('a', href=True):
link = a['href']
links.append(link)
links = links[62:-26]
print(len(links))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment