Ateeb Shaikh
Ateeb Shaikh

Reputation: 1

How to get data in Webscraping Python

https://mor.nlm.nih.gov/RxNav/search?searchBy=NDC&searchTerm=51079045120

how to get RXCUI number from this website in python, I am unable to get

content = driver.page_source
soup = BeautifulSoup(content, 'html.parser')
cont = soup.findAll("div", {"id": "titleHolder"})
rx = cont.find("span", id = "rxcuiDecoration")
print(rx.text)

Upvotes: 0

Views: 49

Answers (1)

Hanna
Hanna

Reputation: 1146

The site renders using javascript you have to use the API

import requests 

r = requests.get('https://rxnav.nlm.nih.gov/REST/ndcstatus.json?caller=RxNav&ndc=51079045120')

print(r.json()['ndcStatus']['rxcui'])

Upvotes: 1

Related Questions