我試圖使用Scopus API檢索由scopus分配給作者的唯一作者標識號。在某些情況下,名稱會產生多個作者ID。我的問題是在閱讀JSON格式,這樣我可以解析出「DC:標識符」將字典解析爲許多值並在python中創建表格
這裏是我的代碼:
import requests
import json
url = "http://api.elsevier.com/content/search/author"
querystring = {"apiKey":"xxxxxxxxxxxxx","query":["AUTHLASTNAME(Volaire)","AUTHFIRST(F)"]}
headers = {
'cache-control': "no-cache",
'postman-token': "5c0df5ad-2645-8e88-0f8a-10795757b4ec"
}
response = requests.request("GET", url, headers=headers, params=querystring)
results = response.json()
然後我得到以下輸出:
{
"search-results": {
"opensearch:totalResults": "3",
"opensearch:startIndex": "0",
"opensearch:itemsPerPage": "3",
"opensearch:Query": {
"@role": "request",
"@searchTerms": "AUTHLASTNAME(Volaire)",
"@startPage": "0"
},
"link": [
{
"@_fa": "true",
"@href": "http://api.elsevier.com/content/search/author?start=0&count=25&query=AUTHLASTNAME%28Volaire%29&apiKey=4275854a6db51fb373ef69fb1337ccf9",
"@ref": "self",
"@type": "application/json"
},
{
"@_fa": "true",
"@href": "http://api.elsevier.com/content/search/author?start=0&count=25&query=AUTHLASTNAME%28Volaire%29&apiKey=4275854a6db51fb373ef69fb1337ccf9",
"@ref": "first",
"@type": "application/json"
}
],
"entry": [
{
"@_fa": "true",
"link": [
{
"@_fa": "true",
"@href": "http://api.elsevier.com/content/author/author_id/55910750900",
"@ref": "self"
},
{
"@_fa": "true",
"@href": "http://api.elsevier.com/content/search/author?query=au-id%2855910750900%29",
"@ref": "search"
},
{
"@_fa": "true",
"@href": "https://www.scopus.com/author/citedby.uri?partnerID=HzOxMe3b&citedAuthorId=55910750900&origin=inward",
"@ref": "scopus-citedby"
},
{
"@_fa": "true",
"@href": "https://www.scopus.com/authid/detail.uri?partnerID=HzOxMe3b&authorId=55910750900&origin=inward",
"@ref": "scopus-author"
}
],
"prism:url": "http://api.elsevier.com/content/author/author_id/55910750900",
"dc:identifier": "AUTHOR_ID:55910750900",
"eid": "9-s2.0-55910750900",
"preferred-name": {
"surname": "Volaire",
"given-name": "Florence A.",
"initials": "F.A."
},
"name-variant": [
{
"@_fa": "true",
"surname": "Volaire",
"given-name": "F.",
"initials": "F."
},
{
"@_fa": "true",
"surname": "Volaire",
"given-name": "Florence",
"initials": "F."
}
],
"document-count": "41",
"subject-area": [
{
"@abbrev": "ENVI",
"@frequency": "7",
"$": "Environmental Science (all)"
},
{
"@abbrev": "AGRI",
"@frequency": "50",
"$": "Agricultural and Biological Sciences (all)"
},
{
"@abbrev": "ENGI",
"@frequency": "4",
"$": "Engineering (all)"
}
],
"affiliation-current": {
"affiliation-url": "http://api.elsevier.com/content/affiliation/affiliation_id/60020315",
"affiliation-id": "60020315",
"affiliation-name": "INRA Institut National de La Recherche Agronomique",
"affiliation-city": "Paris",
"affiliation-country": "France"
}
},
{
"@_fa": "true",
"link": [
{
"@_fa": "true",
"@href": "http://api.elsevier.com/content/author/author_id/6603570012",
"@ref": "self"
},
{
"@_fa": "true",
"@href": "http://api.elsevier.com/content/search/author?query=au-id%286603570012%29",
"@ref": "search"
},
{
"@_fa": "true",
"@href": "https://www.scopus.com/author/citedby.uri?partnerID=HzOxMe3b&citedAuthorId=6603570012&origin=inward",
"@ref": "scopus-citedby"
},
{
"@_fa": "true",
"@href": "https://www.scopus.com/authid/detail.uri?partnerID=HzOxMe3b&authorId=6603570012&origin=inward",
"@ref": "scopus-author"
}
],
"prism:url": "http://api.elsevier.com/content/author/author_id/6603570012",
"dc:identifier": "AUTHOR_ID:6603570012",
"eid": "9-s2.0-6603570012",
"preferred-name": {
"surname": "Volaire",
"given-name": "Florence",
"initials": "F."
},
"name-variant": [
{
"@_fa": "true",
"surname": "Volaire",
"given-name": "F.",
"initials": "F."
}
],
"document-count": "8",
"subject-area": [
{
"@abbrev": "AGRI",
"@frequency": "13",
"$": "Agricultural and Biological Sciences (all)"
},
{
"@abbrev": "BIOC",
"@frequency": "1",
"$": "Biochemistry, Genetics and Molecular Biology (all)"
}
],
"affiliation-current": {
"affiliation-url": "http://api.elsevier.com/content/affiliation/affiliation_id/60020315",
"affiliation-id": "60020315",
"affiliation-name": "INRA Institut National de La Recherche Agronomique",
"affiliation-city": "Paris",
"affiliation-country": "France"
}
},
{
"@_fa": "true",
"link": [
{
"@_fa": "true",
"@href": "http://api.elsevier.com/content/author/author_id/24571987100",
"@ref": "self"
},
{
"@_fa": "true",
"@href": "http://api.elsevier.com/content/search/author?query=au-id%2824571987100%29",
"@ref": "search"
},
{
"@_fa": "true",
"@href": "https://www.scopus.com/author/citedby.uri?partnerID=HzOxMe3b&citedAuthorId=24571987100&origin=inward",
"@ref": "scopus-citedby"
},
{
"@_fa": "true",
"@href": "https://www.scopus.com/authid/detail.uri?partnerID=HzOxMe3b&authorId=24571987100&origin=inward",
"@ref": "scopus-author"
}
],
"prism:url": "http://api.elsevier.com/content/author/author_id/24571987100",
"dc:identifier": "AUTHOR_ID:24571987100",
"eid": "9-s2.0-24571987100",
"preferred-name": {
"surname": "Volaire",
"given-name": "M.",
"initials": "M."
},
"name-variant": [
{
"@_fa": "true",
"surname": "Volaire",
"given-name": null,
"initials": "M."
}
],
"document-count": "1",
"subject-area": [
{
"@abbrev": "CHEM",
"@frequency": "2",
"$": "Chemistry (all)"
},
{
"@abbrev": "BIOC",
"@frequency": "1",
"$": "Biochemistry, Genetics and Molecular Biology (all)"
},
{
"@abbrev": "ENVI",
"@frequency": "1",
"$": "Environmental Science (all)"
}
我需要做的是解析這個,以便得到'dc:標識符'被拉起。在這種情況下有3
我非常希望把這個變成一個表,其中我有 AUTHLASTNAME/AUTHFIRST/DCIDENTIFER(列)
讚賞任何意見。
發佈的代碼與問題無關(關於處理它生成的數據);它是否正確? –
@ScottHunter:這是正確的,只是它告訴你我是如何到達json輸出的。 –
你如何得到這些數據是不相關的;並且您發佈的輸出不完整。 –