Created
April 9, 2020 10:12
-
-
Save majindageta/5ebfc3409cff4732bc70b57143288643 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
import readline from 'readline' | |
import fs from 'fs' | |
fs.writeFileSync('./output.txt', '', {flag: 'w'}) | |
const readInterface = readline.createInterface( | |
fs.createReadStream('./folder/list.html'),process.stdout | |
); | |
readInterface.on('line', function(line) { | |
// console.log(line); | |
let str: string = line; | |
if (str.includes('gameListRowItemName ellipsis')) { | |
let index: number = str.indexOf('">'); | |
let endIndex: number = str.indexOf('</') | |
if (index > 0 && endIndex > 0) { | |
let pi = str.substring(index + 2, endIndex); | |
// console.log(pi); | |
fs.writeFileSync('./output.txt', pi + '\n', {flag: 'a'}) | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment