fixed onwire response for chrome
This commit is contained in:
parent
bf895d03c3
commit
4149a03354
27
bit.js
27
bit.js
@ -1,7 +1,7 @@
|
||||
var Tracker = require('bittorrent-tracker')
|
||||
var magnet = require('magnet-uri')
|
||||
|
||||
var magnetURI = "magnet:?xt=urn:btih:08122dc39c46fab0221aa24e93f2825e3f9efe61&dn=%5BAndreas_M._Antonopoulos%5D_Mastering_Bitcoin_Progr(b-ok.org).pdf&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com"
|
||||
var magnetURI = "magnet:?xt=urn:btih:4a7b842632ca42cdd3c8d54017a8da756839b84d&dn=D0112-Chacha.Choudhary.Sabu.Kaale.Tapu.Mein.pdf&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com"
|
||||
|
||||
var parsedTorrent = magnet(magnetURI)
|
||||
//console.log(parsedTorrent);
|
||||
@ -10,16 +10,39 @@ var parsedTorrent = magnet(magnetURI)
|
||||
var opts = {
|
||||
infoHash: parsedTorrent.infoHash,
|
||||
announce: parsedTorrent.announce,
|
||||
peerId: new Buffer('2d5757303030322d773974324137436b54727a30'), // hex string or Buffer
|
||||
peerId: new Buffer('2d5757303030322d76726379554a35752b7a6248'), // hex string or Buffer
|
||||
port: 6881 // torrent client port
|
||||
}
|
||||
|
||||
|
||||
var client = new Tracker(opts)
|
||||
|
||||
|
||||
|
||||
// start getting peers from the tracker
|
||||
client.start()
|
||||
|
||||
client.on('update', function (data) {
|
||||
console.log('got an announce response from tracker: ' + data.announce)
|
||||
console.log('number of seeders in the swarm: ' + data.complete)
|
||||
console.log('number of leechers in the swarm: ' + data.incomplete)
|
||||
})
|
||||
|
||||
|
||||
|
||||
setInterval(function() {
|
||||
console.log('Searching for peers...');
|
||||
client.once('peer', function (addr) {
|
||||
console.log(`******* Found a peer: ${addr} *******`) // 85.10.239.191:48623
|
||||
})
|
||||
}, 1500);
|
||||
|
||||
|
||||
client.scrape()
|
||||
|
||||
client.on('scrape', function (data) {
|
||||
console.log(data)
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
28
routes.js
28
routes.js
@ -260,6 +260,9 @@ router.get('/trackers-list', (req, res)=>{
|
||||
})
|
||||
|
||||
router.post('/trackers-list', (req, res)=>{
|
||||
|
||||
require('events').EventEmitter.defaultMaxListeners = 100;
|
||||
|
||||
let params = _.pick(req.body, ['job', 'mag_url', 'pid'])
|
||||
if (params.job!=="track list") {
|
||||
return;
|
||||
@ -279,14 +282,31 @@ router.post('/trackers-list', (req, res)=>{
|
||||
|
||||
var client = new Tracker(opts)
|
||||
|
||||
|
||||
// start getting peers from the tracker
|
||||
client.start()
|
||||
|
||||
client.on('update', function (data) {
|
||||
console.log('got an announce response from tracker: ' + data.announce)
|
||||
console.log('number of seeders in the swarm: ' + data.complete)
|
||||
console.log('number of leechers in the swarm: ' + data.incomplete)
|
||||
})
|
||||
|
||||
setInterval(function() {
|
||||
console.log('Searching for peers...');
|
||||
client.once('peer', function (addr) {
|
||||
console.log(`******* Found a peer: ${addr} *******`) // 85.10.239.191:48623
|
||||
})
|
||||
}, 60000);
|
||||
|
||||
client.scrape()
|
||||
|
||||
client.on('scrape', function (data) {
|
||||
console.log("1")
|
||||
res.write(JSON.stringify(data))
|
||||
res.write(JSON.stringify(data))
|
||||
setInterval(function() {
|
||||
res.end()
|
||||
}, 60000)
|
||||
})
|
||||
//res.end()
|
||||
|
||||
})
|
||||
|
||||
module.exports = router
|
||||
@ -11,6 +11,5 @@
|
||||
<p class="float-right"><a href="#">Back to top</a></p>
|
||||
<p>© <a href="https://ranchimall.net" target="_blank">Ranchi Mall</a> 2018-2019 Company, Inc. · <a href="https://ranchimall.net/privacypolicy.htm" target="_blank">Privacy</a> · <a href="#">Terms</a></p>
|
||||
</footer>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
var job = "track list";
|
||||
var pid = $("#pid").val();
|
||||
|
||||
$("#tl-res").text("Getting information from the server...it can takes few minutes.");
|
||||
$("#tl-res").text("Getting information from the server...it can take few minutes.");
|
||||
|
||||
$.ajax({
|
||||
url:'/trackers-list',
|
||||
@ -37,9 +37,9 @@
|
||||
error: function(e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
</script>
|
||||
</script>
|
||||
|
||||
<!-- Magnetic url: magnet:?xt=urn:btih:4a7b842632ca42cdd3c8d54017a8da756839b84d&dn=D0112-Chacha.Choudhary.Sabu.Kaale.Tapu.Mein.pdf&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com -->
|
||||
<!-- 2d5757303030322d76726379554a35752b7a6248 -->
|
||||
Loading…
Reference in New Issue
Block a user