Skip to content

A Chrome extension to add Sci-HUB or Lib-Gen download icons to every DOI-link on the page, with various other small changes to make scientific paper downloading less annoying.

License

Notifications You must be signed in to change notification settings

liyuanhe211/LYH_DOI_Tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LYH DOI Tools

A Chrome extension to add Sci-HUB or Lib-Gen download icons to every DOI-link on the page, with various other small changes to make scientific paper downloading less annoying.

Installation

Either load this folder as an unpacked extension in Chrome Developer Mode, or install the version from Chrome store (with a few days of review lag): https://chrome.google.com/webstore/detail/LYH_DOI_Tools/khmjbohiflimlmijcimkbpmfglaijkic

Features

Detailed description

Adds download icons

It will add a green download button to every link or text object on the webpage (after it is loaded). The button will create a link to the corresponding page on sci-hub or lib-gen (set by the popup window). For example: on the ACS page:

On google search or blog posts:

Jump unnecessary clicks

It will also jump the unnecessary steps needed to download pdf on the Sci-Hub or Lib-Gen websites (saving a few clicks). Because of this, the corresponding pages will be hidden (switched to the previous tab), such that the only thing you need to do is wait 1~2 seconds, and a PDF download task will be opened (the tab-switching could be turned off in the popup window).

For this to work properly, you probably need to set the PDF download option of chrome (by opening chrome://settings/content/pdfDocuments) to "Download PDFs" instead of "Open PDFs in Chrome":

Similarly, it will jump a few other unnecessary steps on Wiley, x-mol.com, and Scifinder. (Hopefully) you won't notice what's missing.

Citation search and download

When you select a string containing text for one single reference (e.g. J. Am. Chem. Soc. 2013, 135(14), 5258), right-click, and select Open and Download Selected Citation, the corresponding page for the reference will be opened (powered by x-mol.com), with the file downloaded (powered by whichever site you selected). This function can also be called by selecting the text and press the shortcut Ctrl+Shift+S (Search). This makes it quite convenient for downloading many references with only ref info.

Adds a few buttons to apps.crossref.org/SimpleTextQuery for in-place cleanup

Reference list copied from PDFs are usually quite messy. A few buttons were added to apps.crossref.org/SimpleTextQuery for in-place clean-up. Combined with other functions of this extension, it could be used to download the full reference list of a paper.

image

The popup page and batch ref download

In the popup window, there are a few options:

  • Choose whether to use Sci-Hub or Lib-Gen. This will affect the download button (refresh needed).
  • Set the Sci-Hub or Lib-Gen address, in case the domain has changed. DOI in the address will be replaced with the actual DOI, and DOI_FILENAME will be replaced with a filename-friendly version of the DOI (but this may not work, depends on how the Lib-Gen itself works.
  • Open this page in Sci-Hub will open the current page in Sci-Hub. (This is independent of DOI. It just adds ".sci-hub.xx" to the end of the current domain name.)
  • The last section lists all the DOIs found on the current page for batch download.
  • You can select all the DOIs that you would like to open (note that mouse-drag over the checkboxes are supported).
  • Be gentle with this function. Download too many papers at once could get you into the banned IP list on the Sci-Hub or Lib-Gen website.
  • Click Open Article Pages will open the selected DOIs with dx.doi.org; Start PDF Downloads will initiate PDF downloads from Lib-Gen.

About Pirating Scientific Papers

Developing this tool doesn't mean I support the piracy of scientific papers, nor that I'm against paid publication services (although I definitely believe it's way too overpriced, and that the reviewing duties should be appreciated financially). I personally already have legal access to (nearly) all the papers I need without Sci-Hub or Lib-Gen. However, the experience of downloading a paper is unacceptably tedious, unstable, poor in UI design and it varies from site to site. This is especially true for someone who lives off-campus where I have to fiddle with the campus VPN. The purpose of writing this extension is to solely address the user experience problem. Instead of writing a script for every possible publisher (which frequently changes their site), I elect to use a unified approach (Sci-Hub and Lib-Gen). If one day, all publishers have a unified authentication process and have some kind of standard API for paper access, I'm happy to move away from pirate sites.

Changelog

0.9 -

0.8 - 20231009

0.7 - 20220307

  • Fix Lib-Gen using domains having more than 2 characters like libgen.rocks

0.6 - 20220208

  • Tidy up popup page.
  • Added feed back for the download button (hover and pressed).
  • Support drag-select in the batch download checkbox selection.
  • Fix 10.1055/s-1997-1294 adds ".pdf" at the end of the link, causing DOI capture to fail.
  • Removed unnecessary Sci-Hub and Lib-Gen jumps as the page-opening function has been migrated to background worker.
  • DOI match for http://xlink.rsc.org/?DOI=C6CC05568K --> 10.1039/C6CC05568K
  • Bigfix: Fixed bug where the text node replacement is performed multiple times. This caused by direct manipulation of innerHTML(), which should be avoided. It has been solved by using textNode.splitText()
  • Support Reaxys Full Text Autojump.
  • Bugfix: Fixed X-mol jump sometimes doesn't work.

0.5 - 20211023

  • Bugfix: Forgot to set the shortcut to Mac version, causing a failed installation on Mac. This is corrected.

0.4 - 20211020

  • Moved the download button of text contents to directly after the doi text (i.e. can be in the middle of a paragraph, instead of the end of the text object).
  • Migrated to Manifest V3.
  • Tidy up code.
  • Deal with situations where DOI is appended with URL markers, like 10.1021/acs.orglett.5b00297#title.
  • Bugfix: Removed duplicate DOIs. For example, if 10.1021/acs.orglett.5b00297 existed, remove 10.1021/acs.orglett.5b00297/suppl_file/ol5b00297_si_001.pdf or 10.1021/acs.orglett.5b00297#title like on this page.

0.3 - 20211015

  • Context menu (or Ctrl+Shift+S) to directly download PDF from citation info.
  • Bugfix: Corrected the bug caused by in-line parentheses and in-line dot, for example, in the text "(Angew. Chem. Int. Ed., DOI: 10.1002/anie.202010431).", the DOI used to be recognized as "10.1002/anie.202010431)." Now only 10.1002 (Wiley) or 10.1016 DOI is allowed to have parentheses (as they will have stupid DOIs like this), and the parentheses have to be paired. All non-ASCII characters are also not allowed.
  • Added the option to not "Auto hide Sci-Hub or Lib-Gen page".
  • Jump unnecessary waiting for redirection for x-mol.com.
  • The batch download buttons will be hidden if no DOI is found on the page.
  • Prevent page swapping in the first place by using the onClick function and the messaging system.
  • Recognize links on Nature pages.
  • Bugfix: Decode URI before recognization.
  • New required permission: contextMenu, storage.

0.2 - 20211014

  • If Lib-Gen returns "file not found in DB", a page from Sci-Hub with the same DOI will be opened.
  • The tab-switching will be inhibited if the current page is not Lib-Gen, Sci-Hub, or SciFinder "Other Sources" page.
  • Bugfix where the download button becomes very large in some pages caused by CSS override like this page.
  • Removed from todo list: Switch away from Lib-Gen or Sci-Hub after displaying the download message.
  • Removed from todo list: Refresh page after switching download option.

Todo

  • Some of the x-mol return pages doesn't directly give a DOI link, causing the automatic jump function could not be executed.
  • Changing the Lib-Gen page icon to reflect download status.
  • Solve the "Unchecked runtime.lastError: QUOTA_BYTES_PER_ITEM quota exceeded" problem, which seems to appear after multiple pages are loaded.
  • Query https://doi.crossref.org/simpleTextQuery for 10.1002/ange.19370502804 gives two duplicated download button.
  • ~~Integrate https://doi.crossref.org/simpleTextQuery, https://search.crossref.org/ or similar CrossRef API. ~~
  • Automatic update of usable Sci-Hub domains.
  • Scifinder-n support.
  • Download RIS or generate reference format files.
  • Move to jQuery.
  • Recognize potential ref info by a trial call to x-mol.com.
  • Add a manual input in the popup.html (probably by create a fake page?) to use the functions of this extention on texts copied from offline contents.
  • Potentially Move tabs permission to activeTabs permission.
  • Solve the problem where the drag-select will omit the first selection (probably by detecting the mouse down and mouse up event separately, and deal with whether they are on the same object.
  • Missing download icon on the doi text on this page
  • Experiment with load-later features, and add download button to scifinder page.

Known issues that will likely not to be addressed

  • Only one DOI is recognized in one bottom-level DOM object. This is both for convenience of programming and for stability. It's quite rare for one string to containing many DOIs without a link. For now, I do not plan to deal with it.
  • If in some case, there is a dot in the assigned DOI, it will be wrongly omiited. This is because it's quite rare for a doi to have a dot in it's end, but it's far more likely that someone writes and article, but puts an period after an doi.
  • By standard, Parenthesis (and other special characters) are allowed in a DOI number, but most publishers don't use it. To prevent DOI recognition been mixed with other text, which DOI is allowed to have parenthesis is dealt with in a white list manner. Now only 10.1002 (Wiley) and 10.1016 (Elsevier) are allowed to have it. So if other publishers also have parenthesis in their DOI, it will not be recognized correctly. If you found one, please submit an issue.

Explanation of required permissions:

  • "tabs" permission: The extension needs to know the content and URL of the tabs to find DOIs, and to modify the content of the webpage to add download icons according to the found DOIs.
  • "storage" permission: To store settings like preferred sci-hub domain and other options.
  • "contextMenus" permission: Add a contextMenu item to access x-mol.com search engine.
  • "scripting" permission: Used for the shortcut of calling x-mol.com search using Ctrl+Shift+S.
  • "alarms" permission: Some of the objects are created later after page load has already finished, e.g. the "Other sources" button on the Scifinder search reasult page. To address this, some function is run periodically to check if new objects are created. (If you know a batter way do deal with this, please share.)

About

A Chrome extension to add Sci-HUB or Lib-Gen download icons to every DOI-link on the page, with various other small changes to make scientific paper downloading less annoying.

Resources

License

Stars

Watchers

Forks

Packages

No packages published