merasabkuch commited on
Commit
fbe126d
·
verified ·
1 Parent(s): 26b8420

Upload 2 files

Browse files
Files changed (2) hide show
  1. embed.js +14 -5
  2. index.js +14 -2
embed.js CHANGED
@@ -1,6 +1,11 @@
1
  const { firefox } = require('playwright'); // Ensure you have playwright installed
2
 
3
- async function movieMultiembed(imdbId) {
 
 
 
 
 
4
  const browser = await firefox.launch();
5
  const page = await browser.newPage();
6
 
@@ -20,7 +25,11 @@ async function movieMultiembed(imdbId) {
20
  );
21
 
22
  try {
23
- await page.goto(`https://multiembed.mov/?video_id=${imdbId}`);
 
 
 
 
24
  await page.waitForSelector('#play');
25
  await page.click('#play');
26
  } catch (error) {
@@ -35,10 +44,10 @@ function timeoutPromise(ms) {
35
  return new Promise((_, reject) => setTimeout(() => reject(new Error('Timeout')), ms));
36
  }
37
 
38
- async function movieMultiembedTimeout(movieId, timeout) {
39
  try {
40
  const result = await Promise.race([
41
- movieMultiembed(movieId),
42
  timeoutPromise(timeout)
43
  ]);
44
  return result;
@@ -48,4 +57,4 @@ async function movieMultiembedTimeout(movieId, timeout) {
48
  }
49
  }
50
 
51
- module.exports = { movieMultiembed,movieMultiembedTimeout };
 
1
  const { firefox } = require('playwright'); // Ensure you have playwright installed
2
 
3
+ function serieMultiembed(imdbId) {
4
+ imdbId= imdbId.split(':');
5
+ return `https://multiembed.mov/?video_id=${imdbId[0]}&season=${imdbId[1]}&episode=${imdbId[2]}`;
6
+ }
7
+
8
+ async function movieMultiembed(imdbId,link=null) {
9
  const browser = await firefox.launch();
10
  const page = await browser.newPage();
11
 
 
25
  );
26
 
27
  try {
28
+ if(link){
29
+ await page.goto(link);
30
+ }else{
31
+ await page.goto(`https://multiembed.mov/?video_id=${imdbId}`);
32
+ }
33
  await page.waitForSelector('#play');
34
  await page.click('#play');
35
  } catch (error) {
 
44
  return new Promise((_, reject) => setTimeout(() => reject(new Error('Timeout')), ms));
45
  }
46
 
47
+ async function movieMultiembedTimeout(movieId, timeout,link=null) {
48
  try {
49
  const result = await Promise.race([
50
+ movieMultiembed(movieId,link),
51
  timeoutPromise(timeout)
52
  ]);
53
  return result;
 
57
  }
58
  }
59
 
60
+ module.exports = { movieMultiembed,movieMultiembedTimeout,serieMultiembed};
index.js CHANGED
@@ -1,6 +1,6 @@
1
  const { addonBuilder, serveHTTP, publishToCentral } = require('stremio-addon-sdk')
2
  const { firefox } = require('playwright');
3
- const { movieMultiembed, movieMultiembedTimeout } = require('./embed');
4
 
5
 
6
 
@@ -14,12 +14,13 @@ const builder = new addonBuilder({
14
  // this means your addon will be used for streams of the type movie
15
  catalogs: [],
16
  resources: ['stream'],
17
- types: ['movie'],
18
  idPrefixes: ['tt']
19
  })
20
 
21
  // takes function(args)
22
  builder.defineStreamHandler(async function (args) {
 
23
  if (args.type === 'movie'
24
  // && args.id === 'tt1254207'
25
  ) {
@@ -71,6 +72,17 @@ builder.defineStreamHandler(async function (args) {
71
  // const stream = { url: 'http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_30fps_normal.mp4' }
72
  // return Promise.resolve({ streams: [stream] })
73
  } else {
 
 
 
 
 
 
 
 
 
 
 
74
  // otherwise return no streams
75
  return Promise.resolve({ streams: [] })
76
  }
 
1
  const { addonBuilder, serveHTTP, publishToCentral } = require('stremio-addon-sdk')
2
  const { firefox } = require('playwright');
3
+ const { movieMultiembed, movieMultiembedTimeout, serieMultiembed } = require('./embed');
4
 
5
 
6
 
 
14
  // this means your addon will be used for streams of the type movie
15
  catalogs: [],
16
  resources: ['stream'],
17
+ types: ['movie', 'series','tv'],
18
  idPrefixes: ['tt']
19
  })
20
 
21
  // takes function(args)
22
  builder.defineStreamHandler(async function (args) {
23
+ console.log(args);
24
  if (args.type === 'movie'
25
  // && args.id === 'tt1254207'
26
  ) {
 
72
  // const stream = { url: 'http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_30fps_normal.mp4' }
73
  // return Promise.resolve({ streams: [stream] })
74
  } else {
75
+ if(args.type === 'series'){
76
+ var l = serieMultiembed(args.id);
77
+ console.log(l);
78
+
79
+ var streams = [];
80
+
81
+ var multiembedStreams = await movieMultiembedTimeout(args.id,15000,l);
82
+ streams.push({ url: multiembedStreams, name: 'Torflix\nMultiembed', title: 'Multiembed', behaviorHints: { bingeGroup: 'multiembed' } });
83
+
84
+ console.log(streams);
85
+ }
86
  // otherwise return no streams
87
  return Promise.resolve({ streams: [] })
88
  }