mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
fix torrent file download
This commit is contained in:
@@ -113,12 +113,12 @@ async function filesFromTorrentFile(torrent) {
|
|||||||
return Promise.reject(new Error("no torrentLink"));
|
return Promise.reject(new Error("no torrentLink"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return axios.get(torrent.torrentLink, { timeout: 10000 })
|
return axios.get(torrent.torrentLink, { timeout: 10000, responseType: 'arraybuffer' })
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (!response.data || response.status !== 200) {
|
if (!response.data || response.status !== 200) {
|
||||||
throw new Error('torrent not found')
|
throw new Error('torrent not found')
|
||||||
}
|
}
|
||||||
return response.body
|
return response.data
|
||||||
})
|
})
|
||||||
.then((body) => parseTorrent(body))
|
.then((body) => parseTorrent(body))
|
||||||
.then((info) => info.files.map((file, fileId) => ({
|
.then((info) => info.files.map((file, fileId) => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user