Skip to content

找到了torrent下载源 #24

@landolphin

Description

@landolphin

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions