Created
April 2, 2020 07:46
-
-
Save vikram-s-narayan/72cecbc3425b649ea2fae33c7b4fd930 to your computer and use it in GitHub Desktop.
Version 1.00
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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