keenwon / antcolony

Nodejs实现的一个磁力链接爬虫 https://findit.keenwon.com (原域名http://findit.so )

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

找到了torrent下载源

landolphin opened this issue · comments

commented

var fs = require('fs'),
path = require('path'),
download = require('./download');

// 保存文件
save = function (_infohash, data) {
var filePath = path.join( _infohash + '.torrent');
fs.writeFile(filePath, data,function (err) {
if (err) {
logger.error(err);
}
});

};

var url="http://itorrents.org/torrent/B415C913643E5FF49FE37D304BBB5E6E11AD5101.torrent";
_infohash='B415C913643E5FF49FE37D304BBB5E6E11AD5101';
download(url, function (err, data) {
//clearTimeout(timer);
if (err) {
// 下载失败,但是这里要响应为'成功',以进入下一个地址的下载
callback(null);
} else {
save(_infohash, data);
// callback('success');
}
});

保存torrent可以保存,而且torrent托管站的用浏览器下的torrent文件可以用迅雷解析,也能被程序解析到mongo里。但是用fs.writeFile保存后编码和原来的编码不一样 导致不能解析。大神怎么破?

这是你自己写的吧?你直接把你找到的地址,写到 src/male.js 就好了

commented

写是可以写进去 但是编码不对 无法解析