Skip to content

Instantly share code, notes, and snippets.

@jcahill
Last active April 17, 2024 01:13
Show Gist options
  • Save jcahill/741000002a0c6b656a0641c96d751d35 to your computer and use it in GitHub Desktop.
Save jcahill/741000002a0c6b656a0641c96d751d35 to your computer and use it in GitHub Desktop.
Sci-Hub and Libgen bookmarklets

Sci-Hub and Libgen Bookmarklets

Usage

  1. Add a bookmark in your browser toolbar
  2. Name: something memorable
  3. URL: paste the code snippet
  4. On a paper's publisher page, or another page with the content's DOI, click on the bookmarklet.

If a DOI is found, your window will be sent to the corresponding sci-hub or libgen result page, respectively.
If no DOI is found, you won't go anywhere. An alert will tell you of the failure.

Bookmarklets

Sci-Hub

javascript:(function() { var body = document.documentElement.innerHTML; var re = /\b10\.[^\s\%"#\?,']+\/[^\s\%"#\?,']+/g; var matches = body.match(re); if (matches === null) { alert("DOI not found"); return undefined; } doi = matches[0]; window.location = "http://sci-hub.tw/" + doi; })();

Libgen Scimag (sci-hub mirrors)

javascript:(function() { var body = document.documentElement.innerHTML; var re = /\b10\.[^\s\%"#\?,']+\/[^\s\%"#\?,']+/g; var matches = body.match(re); if (matches === null) { alert("DOI not found"); return undefined; } doi = matches[0]; window.location = "http://libgen.io/scimag/index.php?s=" + doi; })();
@seongyher
Copy link

Looks great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment