0

我正在做一个项目,希望从 Google Scholar 中抓取数据。我想抓取标记在一个类别中的所有作者(例如Anaphylaxis)并将他们的引用次数、h-index 和 i-10 索引存储在 CSV 文件中。但是,鉴于 Google Scholar 没有 API,我不确定如何执行此操作。我知道我可以使用像美丽汤这样的刮刀,但不确定如何在不被阻塞的情况下刮取数据。

所以,我的问题是如何使用 bs4 将所有标记为 Anaphylaxis 的作者以及每个作者的引文、h-index 和 i-10 索引存储在 csv 文件中。

4

2 回答 2

0

要获取任何“类别”(标签:查询)或“名称”的所有配置文件,您可以使用 SerpApi 等第三方解决方案。这是一个免费试用的付费 API。

示例 python 代码(也可在其他库中获得):

from serpapi import GoogleSearch

params = {
  "api_key": "SECRET_API_KEY",
  "engine": "google_scholar_profiles",
  "q": "Coffee",
  "hl": "en",
  "mauthors": "label:anaphylaxis"
}

search = GoogleSearch(params)
results = search.get_dict()

示例 JSON 输出:

"profiles": [
  {
    "name": "Jerrold H Levy",
    "link": "https://scholar.google.com/citations?hl=en&user=qnH5V28AAAAJ",
    "serpapi_link": "https://serpapi.com/search.json?author_id=qnH5V28AAAAJ&engine=google_scholar_author&hl=en",
    "author_id": "qnH5V28AAAAJ",
    "affiliations": "Professor of Anesthesiology and Surgery (Cardiothoracic)",
    "email": "Verified email at duke.edu",
    "cited_by": 80353,
    "interests": [
      {
        "title": "bleeding",
        "serpapi_link": "https://serpapi.com/search.json?engine=google_scholar_profiles&hl=en&mauthors=label%3Ableeding",
        "link": "https://scholar.google.com/citations?hl=en&view_op=search_authors&mauthors=label:bleeding"
      },
      {
        "title": "anaphylaxis",
        "serpapi_link": "https://serpapi.com/search.json?engine=google_scholar_profiles&hl=en&mauthors=label%3Aanaphylaxis",
        "link": "https://scholar.google.com/citations?hl=en&view_op=search_authors&mauthors=label:anaphylaxis"
      },
      {
        "title": "anticoagulation",
        "serpapi_link": "https://serpapi.com/search.json?engine=google_scholar_profiles&hl=en&mauthors=label%3Aanticoagulation",
        "link": "https://scholar.google.com/citations?hl=en&view_op=search_authors&mauthors=label:anticoagulation"
      },
      {
        "title": "shock",
        "serpapi_link": "https://serpapi.com/search.json?engine=google_scholar_profiles&hl=en&mauthors=label%3Ashock",
        "link": "https://scholar.google.com/citations?hl=en&view_op=search_authors&mauthors=label:shock"
      }
    ],
    "thumbnail": "https://scholar.googleusercontent.com/citations?view_op=small_photo&user=qnH5V28AAAAJ&citpid=2"
  },
  ...
}

您可以查看文档以获取更多详细信息。

免责声明:我在 SerpApi 工作。

于 2021-05-07T12:50:15.073 回答
0

抓取工具所做的只是解析一些 HTML 页面。搜索后,作者位于 class = "gs_a" 的 div 中。如果您使用 Beautiful Soup 并查找此类,您将能够找到所有作者。您可以通过更新网址逐页浏览。

https://scholar.google.ca/scholar?start=20&q=polymer&hl=en&as_sdt=0,5https://scholar.google.ca/scholar?start=30&q=polymer&hl=en&as_sdt=0,5

IE。start=30 然后 40 等等。

然后,您可以根据 gs_a 类标签中的链接路径遍历作者姓名。

让我知道这是否有帮助!

-凯尔

于 2016-12-25T15:42:55.153 回答