Skip to content

Instantly share code, notes, and snippets.

@nicholasglazer
Last active May 16, 2016 12:48
Show Gist options
  • Save nicholasglazer/18947f53064e71fc105f to your computer and use it in GitHub Desktop.
Save nicholasglazer/18947f53064e71fc105f to your computer and use it in GitHub Desktop.
x(url, {
poster: '.image img@src',
videoLink: x('#player@src', 'body script'),
})
(function (err, obj) {
if (err) {
console.log(err);
}
else {
var link = obj.videoLink;
var lit = /\bpl\b\:'([^']*)/i;
var scrappedUrl = link.match(lit)[1] || null;
var output = "";
http.get(scrappedUrl, function (res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
output += chunk;
});
res.on('end',function(){
fs.writeFile('../animeApp/app/data/results.json',output);
});
});
};
});
// .write('../animeApp/app/data/results.json');
this is how i solved the problem with RegExp, but how can i use the .write method instead of "fs"?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment