Skip to content

Instantly share code, notes, and snippets.

@flyingluscas
Created March 31, 2017 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save flyingluscas/bc6ccfdcdedf056675c4db7a76ff66cf to your computer and use it in GitHub Desktop.
Save flyingluscas/bc6ccfdcdedf056675c4db7a76ff66cf to your computer and use it in GitHub Desktop.
Crawler Animes
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