clemente / Sci-Hub downloader

Its not working correctly after updating sci-hub URL
The way is extracting DOI is not woring properly either. Here is a simple fix:

function getDoiReference() {
// more 'universal' query, i flag makes it case insensitive
  const detectedDoiMeta = document.querySelector('meta[name="doi" i], meta[name="dc.identifier" i], meta[name="citation_doi" i]');
// some webpages store the doi as 'doi: 10....', this removes the 'doi: '
  detectedDoiMeta.content = detectedDoiMeta.content.match(/10[\S]*/gi)[0];
  if (detectedDoiMeta) return detectedDoiMeta.content;
  return null;
}

Hello ivofcups,

Thank you for your input. Can you link me some pages where the old getDoiReference does not work so that I can make some tests on my side?

Have a good day

Just googled some examples, perhaps some of them work, but it was not my case.

These ones needed the i flag for case insensitive match:

Extracting doi from Pubmed with "citation_doi" as "dc.identifier" was not found:

I belive Cell stores the content of "dc.identifier" with 'doi:*":

Would you be interested in making this a fully fledged firefox addon? Would love to recommend the extension to some peers, but they are not tech savy. I made a fork in git-hub of the project, because thought that was abandoned. Hope you wouldn't mind, just trying to learn some javascript. If you do, I would immediately take it down.

Cheers!

Thank you for the examples. In the links you listed, only the NEJM website is not detected on my end. The script works correctly on the other websites. Do you have any addon/script that can interfere with the script?

Anyway, I have updated the script to work on NEJM, thank you for the suggestion!

I don't have much time to create a Firefox addon but I can help you if you want to do it ;-) It is perfectly fine for me if you fork the project, this is how I learnt web development some time ago :-)