Spaces:
Runtime error
Runtime error
File size: 3,610 Bytes
a35d2ab 7e0bd83 fbe126d 7e0bd83 a35d2ab fbe126d a35d2ab fbe126d a35d2ab 7e0bd83 a35d2ab 7e0bd83 a35d2ab 7e0bd83 b90ec5a 7e0bd83 a35d2ab 7e0bd83 a35d2ab fbe126d b90ec5a fbe126d a35d2ab b925ba3 a35d2ab |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
const { addonBuilder, serveHTTP, publishToCentral } = require('stremio-addon-sdk')
const { firefox } = require('playwright');
const { movieMultiembed, movieMultiembedTimeout, serieMultiembed } = require('./embed');
const builder = new addonBuilder({
id: 'org.torflix',
version: '1.0.0',
name: 'Torflix Addon',
// Properties that determine when Stremio picks this addon
// this means your addon will be used for streams of the type movie
catalogs: [],
resources: ['stream'],
types: ['movie', 'series','tv'],
idPrefixes: ['tt']
})
// takes function(args)
builder.defineStreamHandler(async function (args) {
console.log(args);
if (args.type === 'movie'
// && args.id === 'tt1254207'
) {
const movieId = args.id;
var url = `https://torrentio.strem.fun/sort=seeders%7Clanguage=hindi/stream/movie/${movieId}.json`;
var streams = await fetch(url).then(res => res.json()).then(data => data.streams);
streams.forEach(stream => {
// name: 'Torflix\n1080p',
// title: 'Abigail.2024.1080p.DS4K.AMZN.WEBRip.DD .5.1.X265-Ralphy [ProtonMovies]\n' +
// '๐ค 6 ๐พ 3.13 GB โ๏ธ 1337x',
// fileIdx: 0,
// behaviorHints: {
// bingeGroup: 'torrentio|1080p|WEBRip|x265',
// filename: 'Abigail.2024.1080p.DS4K.AMZN.WEBRip.DD+.5.1.X265-Ralphy.mkv'
// },
// url: 'https://seedr.torrentdevbkn.workers.dev/directStream?infoHash=23a536e7b3dff5b57bd20bf70ec43f3ba063ffa1'
//drop infoHash from the stream object
stream.name = stream.name.replace('Torrentio', 'Torflix');
stream.url = `https://seedr.torrentdev.workers.dev/directStream?infoHash=${stream.infoHash}`;
delete stream.infoHash;
//allow only if size < 4 GB
var size = stream.title.match(/๐พ ([\d.]+) GB/);
if (size && parseFloat(size[1]) > 4) {
streams = streams.filter(s => s !== stream);
}
});
try{
var multiembedStreams = await movieMultiembedTimeout(movieId,55000);
streams.push({ url: multiembedStreams, name: 'Torflix\nMultiembed', title: 'Multiembed', behaviorHints: { bingeGroup: 'multiembed' } });
}catch(e){
console.error(e);
}
console.log(streams);
return Promise.resolve({ streams: streams });
//fetch the torrentio api
// serve one stream to big buck bunny
// const stream = { url: 'http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_30fps_normal.mp4' }
// return Promise.resolve({ streams: [stream] })
} else {
if(args.type === 'series'){
var l = serieMultiembed(args.id);
console.log(l);
var streams = [];
var multiembedStreams = await movieMultiembedTimeout(args.id,55000,l);
streams.push({ url: multiembedStreams, name: 'Torflix\nMultiembed', title: 'Multiembed', behaviorHints: { bingeGroup: 'multiembed' } });
console.log(streams);
}
// otherwise return no streams
return Promise.resolve({ streams: [] })
}
})
serveHTTP(builder.getInterface(), { port: process.env.PORT || 7860 })
//publishToCentral("https://your-domain/manifest.json") // <- invoke this if you want to publish your addon and it's accessible publically on "your-domain" |