亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

瀏覽器搜索與 Bio.entrez 搜索結果不同

瀏覽器搜索與 Bio.entrez 搜索結果不同

qq_花開花謝_0 2023-12-08 15:58:35
當我使用 Bio Entrez 進行搜索時,我得到了不同的結果。例如,當我使用查詢“covid sideeffect”在瀏覽器上搜索時,我得到 344 個結果,而當我使用 Bio Entrez 時,我只得到 92 個結果。這是我正在使用的代碼。from Bio import EntrezEntrez.email = "[email protected]"handle = Entrez.esearch(db="pubmed", retmax=40, term="covid side effect", idtype="acc")record = Entrez.read(handle)handle.close()print(record['Count'])我希望有人可以幫助我解決這個差異。
查看完整描述

1 回答

?
守著星空守著你

TA貢獻1799條經驗 獲得超8個贊

由于某種原因,無論是 R api 還是 Python API,每個人似乎都有相同的問題。我找到了一種解決方法來獲得相同的結果。它很慢,但它可以完成工作。如果你的結果小于 10k,你可以使用 Selenium 來獲取 pubmedid。否則,我們可以使用下面的代碼來抓取數據。我希望這對將來的人有幫助。


import requests

# # Custom Date Range

# req = requests.get("https://pubmed.ncbi.nlm.nih.gov/?term=covid&filter=dates.2009/01/01-2020/03/01&format=pmid&sort=pubdate&size=200&page={}".format(i))


# # Custom Year Range

# req = requests.get("https://pubmed.ncbi.nlm.nih.gov/?term=covid&filter=years.2010-2019&format=pmid&sort=pubdate&size=200&page={}".format(i))



# #Relative Date 

# req = requests.get("https://pubmed.ncbi.nlm.nih.gov/?term=covid&filter=datesearch.y_1&format=pmid&sort=pubdate&size=200&page={}".format(i))


# # filter language 

# # &filter=lang.english


# # filter human 

# #&filter=hum_ani.humans


# Systematic Review

#&filter=pubt.systematicreview


# Case Reports 

# &filter=pubt.casereports


# Age

# &filter=age.newborn


search = "covid lungs"

# search_list = "+".join(search.split(' '))


def id_retriever(search_string):

    string = "+".join(search_string.split(' '))

    result = []

    old_result = len(result)

    for page in range(1,10000000):

        req = requests.get("https://pubmed.ncbi.nlm.nih.gov/?term={string}&format=pmid&sort=pubdate&size=200&page={page}".format(page=page,string=string))


        for j in req.iter_lines():

            decoded = j.decode("utf-8").strip(" ")

            length = len(decoded)

            if "log_displayeduids" in decoded and length > 46:

                data = (str(j).split('"')[-2].split(","))

                result = result + data

                data = []

        new_result = len(result)

        if new_result != old_result:

            old_result = new_result

        else:

            break

    return result


ids=id_retriever(search)

len(ids)


查看完整回答
反對 回復 2023-12-08
  • 1 回答
  • 0 關注
  • 204 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號