Skip to content

Instantly share code, notes, and snippets.

@thuongnn
Created July 30, 2019 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thuongnn/aa57c82ec5ba6b04d13cf6969ee3d713 to your computer and use it in GitHub Desktop.
Save thuongnn/aa57c82ec5ba6b04d13cf6969ee3d713 to your computer and use it in GitHub Desktop.
let questions = document.getElementsByClassName("SetPageTerm-side SetPageTerm-smallSide");
let answers = document.getElementsByClassName("SetPageTerm-side SetPageTerm-largeSide");
let dataCrawl = localStorage.getItem("dataCrawl") || "";
for (let i = 0; i < questions.length; i++) {
let question = questions.item(i).firstChild.firstChild.firstChild.childNodes[0].nodeValue;
let answer = answers.item(i).firstChild.firstChild.firstChild.childNodes[0].nodeValue;
dataCrawl += `${question} | ${answer}\n`;
}
localStorage.setItem("dataCrawl", dataCrawl);
console.log(`Crawl done ${questions.length} records ! Please run [localStorage.getItem("dataCrawl")] to get results.`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment