@definisi/vidsrc-scraper 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/scraper.js +4 -11
  2. package/package.json +1 -1
package/dist/scraper.js CHANGED
@@ -26,25 +26,18 @@ function buildEmbedUrl(tmdbId, type, season, episode) {
26
26
  }
27
27
  return `${base}/movie?tmdb=${tmdbId}&autoplay=1&ds_lang=en`;
28
28
  }
29
+ function isValidM3u8Url(url) {
30
+ return url.includes('.m3u8') && !url.includes('{v') && !url.includes('{s');
31
+ }
29
32
  async function setupResponseHandler(context, result) {
30
33
  context.on('response', async (response) => {
31
34
  const url = response.url();
32
- if (url.includes('.m3u8') && !result.hlsUrl) {
35
+ if (isValidM3u8Url(url) && !result.hlsUrl) {
33
36
  result.hlsUrl = url;
34
37
  }
35
38
  if (url.includes('.vtt') || url.includes('.srt')) {
36
39
  result.subtitles.push(url);
37
40
  }
38
- if (url.includes('/prorcp/')) {
39
- try {
40
- const body = await response.text();
41
- const m3u8Match = body.match(/https?:\/\/[^"'\s\\]+\.m3u8[^"'\s\\]*/);
42
- if (m3u8Match && !result.hlsUrl) {
43
- result.hlsUrl = m3u8Match[0].replace(/\\/g, '');
44
- }
45
- }
46
- catch { }
47
- }
48
41
  });
49
42
  }
50
43
  export async function scrapeVidsrc(tmdbId, type = 'movie', season = null, episode = null, options = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@definisi/vidsrc-scraper",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Extract HLS streaming URLs from VidSrc",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",