Query Google Scholar using Python.
- Python
- pdftotext (command line tool)
Gscholar is Python2 and Python3 compatible. No changes should be required to run on either Python version.
$ pip install gscholar
##Using gscholar as a command line tool
gscholar provides a command line tool, to use it, just call gscholar
like:
$ gscholar "albert einstein"
or
$ python3 -m gscholar "albert einstein"
$ gscholar "some author or title"
will return the first result from Google Scholar matching this query.
$ gscholar --all "some author or title"
Same as above but returns up to 10 bibtex items. (Use with caution Google will assume you're a bot an ban you're IP temporarily)
$ gscholar /path/to/pdf
Will read the pdf to generate a Google Scholar query. It uses this query to show the first bibtex result as above.
$ gscholar --rename /path/to/pdf
Will do the same as above but asks you if it should rename the file according to the bibtex result. You have to answer with "y", default answer is no.
$ gscholar --help
Install the gscholar package with pip install
as described above or copy the
package somewhere Python can find it.
import gscholar
gscholar.query("some author or title")
will return a list of bibtex items.