Created
September 29, 2024 18:33
-
-
Save WittmannF/61bad7f191b6d77ea3f8d09d2896a5a7 to your computer and use it in GitHub Desktop.
Google Scholar Auto Save Script - Script designed to automate the process of saving articles from Google Scholar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Function to automate saving process with dynamic reading list selection | |
function saveArticles(readingListId) { | |
// Find all the "Save" buttons | |
const saveButtons = document.querySelectorAll('a.gs_or_sav'); | |
saveButtons.forEach((saveButton, index) => { | |
setTimeout(() => { | |
// Click the "Save" button | |
saveButton.click(); | |
// Wait for the dialog to appear | |
setTimeout(() => { | |
// Select the desired reading list checkbox based on the provided ID | |
const desiredCheckbox = document.querySelector(`a.gs_cb_gen[data-id="${readingListId}"]`); | |
if (desiredCheckbox) { | |
desiredCheckbox.click(); | |
} | |
// Click the "Done" button | |
const doneButton = document.querySelector('button#gs_lbd_apl'); | |
if (doneButton) { | |
doneButton.click(); | |
} | |
}, 1000); // Adjust delay time if needed | |
}, index * 2000); // Adjust delay between iterations if necessary | |
}); | |
} | |
// Call the function with the desired reading list ID | |
// Example: Call with "1024" for "ML Test" | |
saveArticles('1024'); |
How to Use
-
Open Google Scholar and search for articles.
-
Open Developer Tools in Chrome (
F12
orCtrl+Shift+I
). -
Paste the script from the
main.js
file into the console. -
Call the function
saveArticles('list-id')
wherelist-id
is the ID of the reading list you'd like to use.Example:
saveArticles('1024'); // This will save to the Second Reading list
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Google Scholar Auto Save Script
This project contains a JavaScript script designed to automate the process of saving articles from Google Scholar to specific reading lists. The script automatically clicks on the "Save" button for each article, selects a specified reading list, and confirms the save action by clicking the "Done" button.
How It Works
The script loops through all articles displayed on the page, clicks the "Save" button, selects the desired reading list, and then clicks "Done" to confirm. The reading list is selected dynamically based on the
data-id
of the list.Available Reading Lists and IDs
Here are the IDs of the available reading lists:
data-id="6"
data-id="1024"
data-id="1025"
data-id="1026"