Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoffreyChen777 committed Aug 20, 2022
1 parent 83a2bd2 commit f17a065
Showing 1 changed file with 21 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,27 @@ export class GoogleScholarWebImporter extends WebImporter {
if (dataid) {
const citeUrl = `https://scholar.google.com/scholar?q=info:${dataid}:scholar.google.com/&output=cite&scirp=1&hl=en`;
const citeResponse = await safeGot(citeUrl, headers, agent);
const citeRoot = parse(citeResponse?.body);
const citeBibtexNode = citeRoot.lastChild
.childNodes[0] as any as HTMLElement;
if (citeBibtexNode) {
// @ts-ignore
const citeBibtexUrl = citeBibtexNode.attributes["href"];
if (citeBibtexUrl) {
const citeBibtexResponse = await safeGot(
citeBibtexUrl,
headers,
agent
);
const bibtexStr = citeBibtexResponse?.body;
if (bibtexStr) {
const bibtexs = bibtex2json(bibtexStr);
if (bibtexs.length > 0) {
const bibtex = bibtexs[0];
if (bibtex) {
entityDraft = bibtex2entityDraft(bibtex, entityDraft);
if (citeResponse?.body) {
const citeRoot = parse(citeResponse?.body);
const citeBibtexNode = citeRoot.lastChild
.childNodes[0] as any as HTMLElement;
if (citeBibtexNode) {
// @ts-ignore
const citeBibtexUrl = citeBibtexNode.attributes["href"];
if (citeBibtexUrl) {
const citeBibtexResponse = await safeGot(
citeBibtexUrl,
headers,
agent
);
const bibtexStr = citeBibtexResponse?.body;
if (bibtexStr) {
const bibtexs = bibtex2json(bibtexStr);
if (bibtexs.length > 0) {
const bibtex = bibtexs[0];
if (bibtex) {
entityDraft = bibtex2entityDraft(bibtex, entityDraft);
}
}
}
}
Expand Down

0 comments on commit f17a065

Please sign in to comment.