zotero / translators

Zotero Translators
http://www.zotero.org/support/dev/translators
1.3k stars 763 forks source link

Incorrect PDFElement QuerySelector in ACM DL Translator #3348

Closed jesHrz closed 3 months ago

jesHrz commented 3 months ago

I am not an expert in developing a Zotero translator. When I encountered a failure to save a PDF from ACM DL, I found that the PDF element in the ACM DL had been changed.

Currently, the query selector is doc.querySelector('a[title=PDF]') (https://github.com/zotero/translators/blob/master/ACM%20Digital%20Library.js#L170), which will find an element with a "PDF" title, but the element is actually

<a href="https://dl.acm.org/doi/pdf/10.1145/3445814.3446745" title="View PDF" data-toggle="tooltip" aria-label="View PDF" class="btn btn--pdf red"><i aria-hidden="true" class="icon-pdf-file"></i><span>PDF</span></a>

where the title is "View PDF" instead of "PDF" so that the selector fails to locate the element and find the correct href.

I think the selector should be doc.querySelector('a[title="View PDF"]'), but I do not have an environment to test whether it is correct. Can anyone confirm this?

dstillman commented 3 months ago

Fixed, thanks!