mirror of
https://github.com/Expand-sys/PharmaBot
synced 2026-03-22 12:27:08 +11:00
24 lines
490 B
JavaScript
24 lines
490 B
JavaScript
const https = require('https')
|
|
const got = require('got')
|
|
|
|
|
|
async function findDrug(drug){
|
|
let query = "proprietary_name:"+drug
|
|
let res
|
|
try{
|
|
res = await got("https://api.fda.gov/other/nsde.json?api_key=IbMkYkBOkuTRvQZDaXgfjxYP2wzDtySmg8477KvA&search="+query,{
|
|
dnsLookupIpVersion: 'ipv4'
|
|
});
|
|
res = res.body
|
|
res = JSON.parse(res)
|
|
} catch(err){
|
|
console.log(err)
|
|
res = 'Couldnt find the Medicine Specified'
|
|
}
|
|
return res
|
|
}
|
|
|
|
|
|
module.exports = {
|
|
findDrug
|
|
}
|