Created
July 30, 2019 13:30
-
-
Save thuongnn/aa57c82ec5ba6b04d13cf6969ee3d713 to your computer and use it in GitHub Desktop.
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
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