Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to download bibtex from Google Scholar using PHP

Hi, is there a way to download the BibTeX entry for something from Google Scholar using PHP without having to download the BibTeX manually one by one? For example, setting a search value like "research" and then downloading the related BibTeX from the links automatically through code.

Any help would be appreciated. I tried to get the HTML page, but as I try to get the page contents the "Import to BibTeX" link disappears on the retrieved page contents.

My code:

<?php
$url = 'http://scholar.google.com/scholar?q=honors+college&amp;hl=en&amp;btnG=Search&     amp;as_sdt=1%2C4&amp;as_sdtp=on';
$needle = 'Import into bibtex';
$contents = file_get_contents($url);
echo $contents;
if(strpos($contents, $needle)!== false) {
echo 'found';
} else {
echo 'not found';
}
?>
like image 778
jarus Avatar asked Nov 21 '11 20:11

jarus


People also ask

How do I save a Google Scholar RIS file?

(You will first need to activate this feature by going to Menu > Settings > Search results > Bibliography manager and selecting "show links to import citations to RefMan"). The reference will automatically download as a . ris file, which will be added to Zotero when you open it.


1 Answers

The short answer is No you cannot do this

Google does not provide API's for search / scholar and uses firm rate-limitation. The problem is that for each BibTex entry you need 2 additional requests (1 for the query, 1 for the 'import link' and a final one to get the actual BibTex entry content)

I wrote a script that scrapes google scholar results and finds the BibTex links and saves the results. However, due to the rate limit is not viable and will get blocked almost instantly.

Code can be viewed here: https://gist.github.com/Tessmore/11099509 and is free of use, but at your own risk.

like image 111
Tessmore Avatar answered Sep 20 '22 01:09

Tessmore