Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vikram-s-narayan/72cecbc3425b649ea2fae33c7b4fd930 to your computer and use it in GitHub Desktop.
Save vikram-s-narayan/72cecbc3425b649ea2fae33c7b4fd930 to your computer and use it in GitHub Desktop.
Version 1.00
import requests
from bs4 import BeautifulSoup
URL = 'http://drugrepurposingportal.com/repurposed-drug-database.php?query=hiv&letter=#'
page = requests.get(URL)
soup = BeautifulSoup(page.content, 'html.parser')
results = soup.find(class_='content')
#print(results.prettify())
drug_elems = results.find_all(class_='abt-para data')
for drug_elem in drug_elems:
drug_name = drug_elem.find('h2')
rows = drug_elem.find_all('tr')
original_indication = rows[0].find('td').find(class_='taby')
new_indication = rows[1].find('td').find(class_='taby')
print(original_indication.text.strip())
print('---')
print(new_indication.text.strip())
print('******')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment