forked from stanfordjournalism/search-script-scrape
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path33.py
More file actions
14 lines (13 loc) · 628 Bytes
/
Copy path33.py
File metadata and controls
14 lines (13 loc) · 628 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# The number of FDA-approved, but now discontinued drug products that contain Fentanyl as an active ingredient
# landing page:
# http://www.accessdata.fda.gov/scripts/cder/ob/docs/tempai.cfm
# search page:
# http://www.accessdata.fda.gov/scripts/cder/ob/docs/queryai.cfm
import re
import requests
formurl = 'http://www.accessdata.fda.gov/scripts/cder/ob/docs/tempai.cfm'
post_params = {'Generic_Name': 'Fentanyl', 'table1': 'OB_Disc'}
resp = requests.post(formurl, data = post_params)
# Displaying records 1 to 29 of 29
m = re.search('(?<=Displaying records) *[\d,]+ *to *[\d,]+ *of *([\d,]+)', resp.text)
print(m.groups()[0])