GSch ACPYPE citations

node v14.19.3
version: 3.0.0
endpointsharetweet
// Google Scholar search for the number of citations of a specific article title q = "ACPYPE - Antechamber python parser interface"; // use double-quotes for specific title y = "2012"; // restrict you search to a year const axios = require("axios").default; const keys = ["api_key0", "api_key1", "api_key"]; function set_url(key) { return `https://serpapi.com/search.json?engine=google_scholar&q='${q}'&as_ylo=${y}&as_yhi=${y}&hl=en&api_key=${process.env[key]}`; } function get_data(key) { return axios.get(set_url(key), {}); } for (const [i, key] of keys.entries()) { try { const { data } = await get_data(key); if (data) { const tot = data.organic_results[0].inline_links.cited_by.total; const obj = { schemaVersion: 1, label: "citations", message: tot.toString(), color: "orange", cacheSeconds: 2592000, }; exports.endpoint = function (request, response) { response.end(JSON.stringify(obj)); }; break; } } catch (error) {} }
Loading…

no comments

    sign in to comment