I am trying to search articles on PubMed. I was hoping to get the same articles when searching the website, test out the search terms and then use it via python code. I tried a few libraries but the results are different from the web.
from Bio import Entrez
from Bio import Medline
term = "Cyber Security"
Entrez.email = "[email protected]" # Replaced for obvious reasons
handle = Entrez.esearch(db="pubmed", term=term, retmax=5)
esearch_record = Entrez.read(handle)
handle.close()
print(f"Records found: {esearch_record['Count']}")
returns -
Records found: 15442
Another code that I tried -
from metapub import PubMedFetcher
fetch = PubMedFetcher()
keyword = "Cyber Security"
pmids = fetch.pmids_for_query(keyword, retmax=100000)
print(len(pmids))
Number of results -
15442
While when I search on website I receive 15,045 results. I am trying to find out what I am not doing correctly and why are the results different?
