Skip to content

Instantly share code, notes, and snippets.

@mesmerx
Created July 4, 2016 15:53
Show Gist options
  • Save mesmerx/fd9ccb6a9688bf2a929212ed03aaac40 to your computer and use it in GitHub Desktop.
Save mesmerx/fd9ccb6a9688bf2a929212ed03aaac40 to your computer and use it in GitHub Desktop.
tentativas de scrapper
var http = require('follow-redirects').http;
var body=""
link=""
function links(si) {
var request = http.get(si, function(response){
response.on('data', function (chunk) {
body += chunk;
});
response.on('end',function (){
link = body.split('<a class="dlink" href="//')[1].split('"')[0]
});
request.on("error", function(error){
console.error(error.message);
})
});
console.log(this.link)
return this.link
}
function busca(si) {
var request = http.get(si, function(response){
response.on('data', function (chunk) {
body += chunk;
});
response.on('end',function (){
nome = body.match(/span\s(?:class="mp3-title")>(.*)<\/span\>/g).toString().replace(/span class="mp3-title">/g,'').replace(/<\/span>/g,'').split(',')
tempo=body.match(/[0-9]{2}\:[0-9]{2}/g)
bitrate=body.match(/[0-9]{3} kbps/g)
endereco= body.match(/musica="(.*)" class="descarga_button"/g).toString().replace(/" class="descarga_button"/g,'').replace(/musica="/g,'').split(',')
console.log(nome[1]+tempo[1]+bitrate[1]+links('http://mimp3.me/'+endereco[1]))
});
request.on("error", function(error){
console.error(error.message);
})
});
}
busca('http://mimp3.me/?search_keyword=vcv')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment