1

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']

ただし、この記事のキーワードと引用が必要です。記事のURLへの追加リクエストでキーワードの問題を解決しました:

article_url = article['prism:url']
# something like this:
# 'http://api.elsevier.com/content/abstract/scopus_id/84909993848'

field=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 にはリクエストの制限 (1 週間あたり 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

それで、追加の要求なしに引用を取得できますか?

4

1 に答える 1