Skip to content

Instantly share code, notes, and snippets.

@Patrick-web
Created January 25, 2021 15:23
Show Gist options
  • Save Patrick-web/16df216fc7e58a6b46c4c644dad37a28 to your computer and use it in GitHub Desktop.
Save Patrick-web/16df216fc7e58a6b46c4c644dad37a28 to your computer and use it in GitHub Desktop.
var https = require("follow-redirects").https;
var fs = require("fs");
var options = {
method: "GET",
hostname: "www.megalobiz.com",
path:
"/lrc/maker/download-music-lyrics-lrc-generated-files?qry=helplessly%20tatiana%20manaois",
maxRedirects: 20,
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
// console.log(body.toString());
const regex = /\[00:03.05].*\"\;/gm;
const str = ``;
let m;
while ((m = regex.exec(body)) !== null) {
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
const lyricStrings = m[0].replace(/\\n/gm,'__').split('__');
lyricStrings.forEach(string=>{
const strip = string.split(']');
const lyricStrip = {
timestamp: strip[0].replace('[',''),
text:strip[1].replace(/"/g,'')
}
console.log(lyricStrip);
})
}
});
res.on("error", function (error) {
console.error(error);
});
});
req.end();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment