aggregate google scholar email alerts by paper
Simplifies scientific paper discovery by aggregating all unread emails under a Gmail label from the Google Scholar alerts, grouping papers by title and producing a report (Markdown/HTML/JSON).
To use this tool for generating a report on new papers from Google Scholar, do the following:
- Search on Google Scholar for a paper of an author
- Create an Alert (for citations, new or similar publications)
- Create a Gmail filter, moving all those emails under a dedicated Label
- Run this tool to get an aggregated report (in Markdown or HTML) of all the papers from the unread emails
For more details, please refer to the documentation.
Make sure you have a recent version of go. Then clone this repository:
git clone github.com/bzz/scholar-alert-digestAlternatively, you can try to build a scholar-alert-digest binary and put it under $GOPATH/bin with:
cd "$(mktemp -d)" && go mod init scholar-alert-digest && go get github.com/bzz/scholar-alert-digestHowever this approach is known to yield errors and is not recommended.
Enable "Gmail API" Google Cloud Platform (GCP) project & download credentials.json following these steps.
That will guide you through creation of a new GCP project, enabling the Gmail API and geting "OAuth client ID" - authorization credentials for a desktop application that are needed in order to get access to your email messages at Gmail
After placing credentials.json in the project directory, you need to authenticate the application. You can do this by running
go run main.goAn accounts.google.com link will be printed (and possibly opened in your browser). Follow the login instructions, selecting the google account you used for the previous step if you have multiple. You will get a warning that google has not verified the app; click Continue, and then Continue again.
Oh no! This site can't be reached! You'll get a "refused to connect" message. That is fine! Just go to the url bar and look for a section like this:
&code=4/0AWtgzh78xyaMnEMdDBL5P-tX66J3Fsb_93XvRCJzmLXDplnByMZmaXZcFjde3hJIt3D1pA
Copy the part following the = sign (importantly not including the trailing &scope) and paste it into the terminal. Now the app is authenticated. In the future you won't need to repeat this step
The CLI tool is used to generate one-time Markdown/HTML reports.
To find your specific label name:
go run main.go -labelsTo generate the report, either pass the label name though CLI:
go run main.go -l '<your-label-name>'Or export it as an env var:
export SAD_LABEL='<your-label-name>'
go run main.goTo output rendered HTML or JSON instead of the default Markdown, use
go run main.go -html
go run main.go -jsonTo mark all emails that were aggregated in the current report as read, use
go run main.go -markTo include read emails in the separate section of the report, do
go run main.go -readTo only aggregate the email subjects do
go run main.go -subj | uniq -c | sort -dr
There is an optional more compact report template that may be useful for a large number of papers:
go run main.go -compactTo include authors in the paper details snippet, use
go run main.go -authorsTo include references to original email into the report, do:
go run main.go -refsThe Web UI exposes HTML report generation to multiple concurrent users.
It is possible to test it locally, without Gmail app configuration from below, by using emails from ./fixtures by running:
go run ./cmd/server -test
It does not support the same OAuth client credentials as CLI from credentials.json.
It requires:
- To create a new credentials in your API project
https://console.developers.google.com/apis/credentials?project=quickstart-<NNN> - "Credentials" -> "Create credentials" -> "Web application" type
- Add http://localhost/login/authorized value to
Authorized redirect URIsfield - Copy the
Client IDandClient secret
Pass in the ID and the secret as env vars e.g by
export SAD_GOOGLE_ID='<client id>'
export SAD_GOOGLE_SECRET='<client secret>'You do not need to pass the label name on the startup as it can be chosen at runtime at /labels.
The report generation is exposed through a web server that can be started with
go run ./cmd/server [-compact]
to spin up a server at http://localhost:8080
Start by visiting http://localhost:8080/login to get the user OAuth access token. Visit http://localhost:8080/labels to chose your label name.
Apache License, Version 2.0. See LICENSE