-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathGoogleScholarCite.js
41 lines (33 loc) · 954 Bytes
/
GoogleScholarCite.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const cheerio = require("cheerio");
const unirest = require("unirest");
const getScholarCiteData = async () => {
try {
const url =
"https://scholar.google.com/scholar?q=info:TPhPjzP8H_MJ:scholar.google.com&output=cite";
return unirest
.get(url)
.headers({})
.then((response) => {
let $ = cheerio.load(response.body);
let cite_results = [];
$("#gs_citt tr").each((i, el) => {
cite_results.push({
title: $(el).find(".gs_cith").text(),
snippet: $(el).find(".gs_citr").text(),
});
});
let links = [];
$("#gs_citi .gs_citi").each((i, el) => {
links.push({
name: $(el).text(),
link: $(el).attr("href"),
});
});
console.log(cite_results);
console.log(links);
});
} catch (e) {
console.log(e);
}
};
getScholarCiteData();