Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

找到了torrent下载源 #24

Open
landolphin opened this issue Apr 5, 2018 · 2 comments
Open

找到了torrent下载源 #24

landolphin opened this issue Apr 5, 2018 · 2 comments

Comments

@landolphin
Copy link

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保存后编码和原来的编码不一样 导致不能解析。大神怎么破?

@keenwon
Copy link
Owner

keenwon commented Apr 5, 2018

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

@landolphin
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants