Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translator for eLibrary.ru not working again #3284

Closed
sergbolshakov opened this issue Mar 25, 2024 · 2 comments
Closed

Translator for eLibrary.ru not working again #3284

sergbolshakov opened this issue Mar 25, 2024 · 2 comments
Assignees

Comments

@sergbolshakov
Copy link

In eLibrary.ru again seems to have changed something in the clutter of tables within tables, and the translator again does not work, does not save anything except the metadata that is written in <head>.
I don't know how to JavaScript, I just tried to change the code in some places so that the translator would at least save the authors and the name of the journal - it didn't work. I tried replacing the XPaths with the ones I was getting with the developer tools in the browser on the eLibrary article page.
My attempts to change the code of the current scrape function:

// XPath:
// /html/body/table/tbody/tr/td/table[1]/tbody/tr/td[2] - rightPart
// /html/body/table/tbody/tr/td/table[1]/tbody/tr/td[2]/table/tbody/tr[2]/td[1] - centralColumn
// /html/body/table/tbody/tr/td/table[1]/tbody/tr/td[2]/table/tbody/tr[2]/td[1]/div[2] - datablock
// /html/body/table/tbody/tr/td/table[1]/tbody/tr/td[2]/table/tbody/tr[2]/td[1]/div[2]/table[1]/tbody/tr/td[2] - authors
// /html/body/table/tbody/tr/td/table[1]/tbody/tr/td[2]/table/tbody/tr[2]/td[1]/div[2]/table[1]/tbody/tr/td[2]/div[1]/span/b/font - firstAuthor
// /html/body/table/tbody/tr/td/table[1]/tbody/tr/td[2]/table/tbody/tr[2]/td[1]/div[2]/table[1]/tbody/tr/td[2]/div[2]/span/b/font - secondAuthor

var rightPart = doc.getElementById("leftcol").nextSibling;
// var centralColumn = ZU.xpath(rightPart, './table/tbody/tr[2]/td[@align="left"]'); // original
var centralColumn = ZU.xpath(rightPart, './table/tbody/tr[2]/td[1]'); // my try
// var datablock = ZU.xpath(centralColumn, './div[1]'); // original
var datablock = ZU.xpath(centralColumn, './div[2]'); // my try

// var authors = ZU.xpath(datablock, './/table[1]//b'); // original
// var authors = ZU.xpath(datablock, './/table[1]/tbody/tr/td[2]/div/span/b/font'); // my try
var authors = ZU.xpath(datablock, './/table[1]//font'); // my 2nd try

and

// XPath:
// /html/body/table/tbody/tr/td/table[1]/tbody/tr/td[2] - rightPart
// /html/body/table/tbody/tr/td/table[1]/tbody/tr/td[2]/table/tbody/tr[2]/td[1] - centralColumn
// /html/body/table/tbody/tr/td/table[1]/tbody/tr/td[2]/table/tbody/tr[2]/td[1]/div[2] - datablock
// /html/body/table/tbody/tr/td/table[1]/tbody/tr/td[2]/table/tbody/tr[2]/td[1]/div[2]/table[3]/tbody/tr[2]/td[2] - journalBlock
// /html/body/table/tbody/tr/td/table[1]/tbody/tr/td[2]/table/tbody/tr[2]/td[1]/div[2]/table[3]/tbody/tr[2]/td[2]/a - publicationTitle

// var journalBlock = ZU.xpath(datablock, './table/tbody[tr[1]/td/font[contains(text(), "ЖУРНАЛ:")]]/tr[2]/td[2]'); // original
var journalBlock = ZU.xpath(datablock, './table[3]/tbody/tr[2]/td[2]'); // my try
// if (!item.publicationTitle) item.publicationTitle = ZU.xpathText(journalBlock, ".//a[1]"); // original
if (!item.publicationTitle) item.publicationTitle = ZU.xpathText(journalBlock, "./a"); // my try
item.publicationTitle = fixCasing(item.publicationTitle);

What am I doing wrong?
The horrible eLibrary remains one of the main and largest sources of literature, and saving records now has to be done manually, for volumes larger than a dozen it is extremely exhausting.
Maybe colleagues who were previously involved in improving this translator will respond and help?
@advoropaev, @zuphilip, @i3v?

@AbeJellinek AbeJellinek self-assigned this Mar 25, 2024
@advoropaev
Copy link
Contributor

advoropaev commented Mar 27, 2024

Hello, I did a quick fix, consider it, please, I have opened a pull request as well.

eLibrary.ru.js.zip

@sergbolshakov
Copy link
Author

@advoropaev, thank you very much, everything works as it should!
(Turns out I didn't have the Zotero connector updated.)

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

No branches or pull requests

3 participants