【问题标题】:Scraping Authors based on tags from Google Scholar根据 Google Scholar 的标签抓取作者
【发布时间】:2016-12-25 15:35:07
【问题描述】:

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

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

【问题讨论】:

  • 那么问题是什么?
  • @Peaceful 已更新澄清
  • 听起来很有趣!我没有答案,尤其是关于被阻止的问题。但是,也许您还没有看到pypi.python.org/pypi/scholarly/0.2.2?可以根据这些结果设计代码。
  • @BillBell 这个问题没有说清楚是关于被阻止还是关于提取特定的东西。此外,到目前为止,他还没有提到他们尝试过的任何事情。
  • @Peaceful:我的朋友,在某种程度上都是正确的,但我不介意,而且,既然你提到了这些因素,我就没有必要这样做了。 :) 实际上,如果仔细阅读,我认为可以收集问题的性质。如果你试图通过学者来获得“过敏反应”中所有人的一系列h-index值,你是不是很有可能会被阻止?

标签: python web-scraping bs4 google-scholar


【解决方案1】:

所有爬虫所做的只是解析一些 HTML 页面。搜索后,作者在 div 中,class= "gs_a" 如果您使用 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

即。 start=30 然后 40 等等。

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

如果这有帮助,请告诉我!

-凯尔

【讨论】:

  • 我感兴趣的是每个作者的总引用次数,而不是论文数
【解决方案2】:

要获取任何“类别”(标签:查询)或“名称”的所有配置文件,您可以使用 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"
  },
  ...
}

您可以查看documentation了解更多详情。

免责声明:我在 SerpApi 工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-01-02
    • 2012-07-11
    • 1970-01-01
    • 2021-07-12
    • 2017-05-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多