Last active
May 16, 2016 12:48
-
-
Save nicholasglazer/18947f53064e71fc105f 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
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