我正在尝试从 Scopus api 抓取文章的数据。我有 api 密钥,可以从标准视图接收字段。
这是示例:
首先,初始化(api,搜索查询和标题)
import json
import requests
api_resource = "https://api.elsevier.com/content/search/scopus?"
search_param = 'query=title-abs-key(big data)' # for example
# headers
headers = dict()
headers['X-ELS-APIKey'] = api_key
headers['X-ELS-ResourceVersion'] = 'XOCS'
headers['Accept'] = 'application/json'
现在我可以接收文章 json(例如,第一页的第一篇文章):
# request with first searching page
page_request = requests.get(api_resource + search_param, headers=headers)
# response to json
page = json.loads(page_request.content.decode("utf-8"))
# List of articles from this page
articles_list = page['search-results']['entry']
article = articles_list[0]
我可以轻松地从标准视图中获取一些主要字段:
title = article['dc:title']
cit_count = article['citedby-count']
authors = article['dc:creator']
date = article['prism:coverDate']
但是,我需要这篇文章的关键字和引用。我通过对文章网址的附加请求解决了关键字问题:
article_url = article['prism:url']
# something like this:
# 'http://api.elsevier.com/content/abstract/scopus_id/84909993848'
使用字段 = authkeywords
article_request = requests.get(article_url + "?field=authkeywords", headers=headers)
article_keywords = json.loads(article_request.content.decode("utf-8"))
keywords = [keyword['$'] for keyword in article_keywords['abstracts-retrieval-response']['authkeywords']['author-keyword']]
此方法有效,但有时缺少关键字。此外,scopus api-key 有请求限制(每周 10000 个),这种方式不是最优的。
我可以让它更容易吗?
下一个关于引用的问题。为了查找文章的引用,我再次发送一个请求,使用 article['eid'] 字段:
citations_response = requests.get(api_resource + 'query=refeid(' + str(article['eid']) + ')', headers=headers)
citations_result = json.loads(citations_response.content.decode("utf-8"))
citations = citations_result['search-results']['entry'] # list of citations
那么,我可以在没有额外请求的情况下获得引用吗?