30. inspirehep API#

import numpy as np
import os
import pandas as pd
import matplotlib.pyplot as plt
from urllib3.exceptions import ProtocolError
import pprint

I have two examples of search on inspirehep.

http://inspirehep.net/search?p=exactauthor%3A' + id + '&sf=earliestdate&of=recjson&ot=recid,creation_date,authors,abstract,primary_report_number,publication_info,title'
http://inspirehep.net/search?ln=en&as=1&m1=a&p1=neutrino&f1=title&op1=a&m2=a&p2=&f2=&op2=a&m3=a&p3=&f3=&action_search=Search&sf=&so=d&rm=&rg=25&sc=0&of=hb
api_base = 'http://inspirehep.net/search?p1=neutrino&f1=title&&so=d&rm=citation&sc=0&of=recjson'
rec_per_page = '&rg=250'
start_rec = '&jrec=1'
import requests
import json
rsp = requests.get(api_base+rec_per_page+start_rec)
rsp_json = rsp.json()
len(rsp_json)
250
rsp_json[0].keys()
dict_keys(['comment', 'reference', 'abstract', 'creation_date', 'primary_report_number', 'publication_info', 'corporate_name', 'subject', 'cataloguer_info', 'physical_description', 'number_of_citations', 'other_report_number', 'title', 'persistent_identifiers_keys', 'abbreviated_title', 'system_number', 'files', 'system_control_number', 'filenames', 'number_of_reviews', 'version_id', 'FIXME_OAI', 'authors', 'doi', 'number_of_authors', 'accelerator_experiment', 'number_of_comments', 'title_additional', 'url', 'recid', 'collection', 'thesaurus_terms', 'filetypes', 'prepublication'])
citations = [rec['number_of_citations'] for rec in rsp_json]
plt.semilogy(citations)
plt.show()
../../../_images/inspirehep-api_12_0.png
plt.hist(citations)
plt.show()
../../../_images/inspirehep-api_13_0.png