Created
March 31, 2017 17:48
-
-
Save flyingluscas/bc6ccfdcdedf056675c4db7a76ff66cf to your computer and use it in GitHub Desktop.
Crawler Animes
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
const Crawler = require('crawler') | |
const baseUrl = 'https://animes.zlx.com.br' | |
const startUrl = baseUrl+'/exibir/67/6561/shingeki-no-kyojin-01' | |
const crawler = new Crawler({ | |
maxConnections: 10, | |
skipDuplicates: true, | |
callback: (error, response, done) => { | |
const $ = response.$ | |
const title = $('title').text() | |
const hd = response.body.match(/http(s)?\:\/\/.*\/HD\/episodios\/[0-9\.]+.mp4/gm) | |
const mq = response.body.match(/http(s)?\:\/\/.*\/MQ\/episodios\/[0-9\.]+.mp4/gm) | |
console.log(title) | |
if (hd) { | |
console.log('HD : '+hd[0]) | |
} | |
console.log('MQ : '+mq[0]+"\n") | |
done() | |
} | |
}) | |
crawler.queue({ | |
uri: startUrl, | |
callback: (error, response, done) => { | |
const $ = response.$ | |
$('#this-serie-tv > a').each(function () { | |
crawler.queue({ | |
uri: baseUrl + $(this).attr('href'), | |
callback: function (error, response, done) { | |
const $ = response.$ | |
crawler.queue(baseUrl + $('.video-placeholder iframe').attr('src')) | |
done() | |
} | |
}) | |
}); | |
done() | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment