Skip to content

Instantly share code, notes, and snippets.

@WittmannF
Created September 29, 2024 18:33
Show Gist options
  • Save WittmannF/61bad7f191b6d77ea3f8d09d2896a5a7 to your computer and use it in GitHub Desktop.
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
// 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');
@WittmannF
Copy link
Author

WittmannF commented Sep 29, 2024

How to Use

  1. Open Google Scholar and search for articles.

  2. Open Developer Tools in Chrome (F12 or Ctrl+Shift+I).

  3. Paste the script from the main.js file into the console.

  4. Call the function saveArticles('list-id') where list-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