CCCPaste

Scrape Flash Card Data

const textarea = document.createElement("textarea");
textarea.rows = 50;
textarea.style.width = "100%";
 
//Put the Text Area at the top of the page
document.querySelector('body').prepend(textarea);
 
// Loop through Each Flash Card
let timer = setInterval(() => {
  let next = document.querySelector('[aria-label="arrow right"]');
 
  // If Next Button does not exist the clear timer and exit
  if (next === null) {
    clearInterval(timer);
    return;
  }
 
  // get flash card values and add them to the text area output
    //Replace New lines with 
tag let card = document.querySelectorAll('[data-testid="Card"]'); let question = card[0].children[0].children[2].innerText; question = question.replace(/(?:\r\n|\r|\n)/g, '
'); let answer = card[1].children[0].children[2].innerText; answer = answer.replace(/(?:\r\n|\r|\n)/g, '
'); textarea.value += `
${question}
${answer}
\n`; //Click The Next Button let button = next.parentElement; button.click(); }, 200);