mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-06-17 20:28:37 +00:00
fix: Improve drive search handling and bump manifest
This commit is contained in:
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__name=(target,value)=>__defProp(target,"name",{value:value,configurable:!0}),__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&"object"==typeof from||"function"==typeof from)for(let key of __getOwnPropNames(from))__hasOwnProp.call(to,key)||key===except||__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),__async=(__this,__arguments,generator)=>new Promise((resolve,reject)=>{var fulfilled=value=>{try{step(generator.next(value))}catch(e){reject(e)}},rejected=value=>{try{step(generator.throw(value))}catch(e){reject(e)}},step=x=>x.done?resolve(x.value):Promise.resolve(x.value).then(fulfilled,rejected);step((generator=generator.apply(__this,__arguments)).next())}),posts_exports={};__export(posts_exports,{getPosts:()=>getPosts,getSearchPosts:()=>getSearchPosts});var getPosts=__name(function(_0){return __async(this,arguments,function*({filter:filter,page:page,signal:signal,providerContext:providerContext}){const{getBaseUrl:getBaseUrl}=providerContext;return posts({url:`${(yield getBaseUrl("drive"))+filter}page/${page}/`,signal:signal,providerContext:providerContext})})},"getPosts"),getSearchPosts=__name(function(_0){return __async(this,arguments,function*({searchQuery:searchQuery,page:page,signal:signal,providerContext:providerContext}){const{getBaseUrl:getBaseUrl}=providerContext;return posts({url:`${yield getBaseUrl("drive")}page/${page}/?s=${searchQuery}`,signal:signal,providerContext:providerContext})})},"getSearchPosts");function posts(_0){return __async(this,arguments,function*({url:url,signal:signal,providerContext:providerContext}){try{console.log("Fetching URL:",url);const{cheerio:cheerio}=providerContext,res=yield fetch(url,{signal:signal}),data=yield res.text(),$=cheerio.load(data),catalog=[];return $(".poster-card").map((i,element)=>{const title=$(element).find(".poster-title").text(),link=$(element).parent().attr("href"),image=$(element).find(".poster-image img").attr("src");title&&link&&image&&catalog.push({title:title.replace("Download","").trim(),link:link,image:image})}),catalog}catch(err){return console.error("drive error ",err),[]}})}__name(posts,"posts"),exports.getPosts=getPosts,exports.getSearchPosts=getSearchPosts;
|
"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__name=(target,value)=>__defProp(target,"name",{value:value,configurable:!0}),__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&"object"==typeof from||"function"==typeof from)for(let key of __getOwnPropNames(from))__hasOwnProp.call(to,key)||key===except||__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),__async=(__this,__arguments,generator)=>new Promise((resolve,reject)=>{var fulfilled=value=>{try{step(generator.next(value))}catch(e){reject(e)}},rejected=value=>{try{step(generator.throw(value))}catch(e){reject(e)}},step=x=>x.done?resolve(x.value):Promise.resolve(x.value).then(fulfilled,rejected);step((generator=generator.apply(__this,__arguments)).next())}),posts_exports={};__export(posts_exports,{getPosts:()=>getPosts,getSearchPosts:()=>getSearchPosts});var getPosts=__name(function(_0){return __async(this,arguments,function*({filter:filter,page:page,signal:signal,providerContext:providerContext}){const{getBaseUrl:getBaseUrl}=providerContext;return posts({url:`${(yield getBaseUrl("drive"))+filter}page/${page}/`,signal:signal,providerContext:providerContext})})},"getPosts"),getSearchPosts=__name(function(_0){return __async(this,arguments,function*({searchQuery:searchQuery,page:page,signal:signal,providerContext:providerContext}){const{getBaseUrl:getBaseUrl}=providerContext,baseUrl=yield getBaseUrl("drive");return searchPosts({url:buildSearchUrl(baseUrl,searchQuery,page),baseUrl:baseUrl,signal:signal})})},"getSearchPosts");function posts(_0){return __async(this,arguments,function*({url:url,signal:signal,providerContext:providerContext}){try{console.log("Fetching URL:",url);const{cheerio:cheerio}=providerContext,res=yield fetch(url,{signal:signal}),data=yield res.text(),$=cheerio.load(data),catalog=[];return $(".poster-card").map((i,element)=>{const title=$(element).find(".poster-title").text(),link=$(element).parent().attr("href"),image=$(element).find(".poster-image img").attr("src");title&&link&&image&&catalog.push({title:title.replace("Download","").trim(),link:link,image:image})}),catalog}catch(err){return console.error("drive error ",err),[]}})}function searchPosts(_0){return __async(this,arguments,function*({url:url,baseUrl:baseUrl,signal:signal}){var _a,_b;try{console.log("Fetching drive search URL:",url);const res=yield fetch(url,{signal:signal});if(!res.ok)throw new Error(`drive search failed with status ${res.status}`);return null!=(_b=null==(_a=(yield res.json()).hits)?void 0:_a.map(hit=>{var _a2;const document=hit.document,title=null==(_a2=null==document?void 0:document.post_title)?void 0:_a2.trim(),link=(null==document?void 0:document.permalink)?normalizeUrl(baseUrl,document.permalink):"",image=(null==document?void 0:document.post_thumbnail)?normalizeUrl(baseUrl,document.post_thumbnail):"";return title&&link&&image?{title:title,link:link,image:image}:null}).filter(post=>null!==post))?_b:[]}catch(err){return console.error("drive search error ",err),[]}})}function buildSearchUrl(baseUrl,searchQuery,page){const separator=baseUrl.includes("?")?"&":"?";return`${trimTrailingSlash(baseUrl)}/search.php${separator}q=${encodeURIComponent(searchQuery)}&page=${page}`}function normalizeUrl(baseUrl,value){return value?/^https?:\/\//i.test(value)?value:value.startsWith("//")?`https:${value}`:value.startsWith("/")?`${trimTrailingSlash(baseUrl)}${value}`:`${trimTrailingSlash(baseUrl)}/${trimLeadingSlash(value)}`:""}function trimTrailingSlash(value){return value.replace(/\/+$/,"")}function trimLeadingSlash(value){return value.replace(/^\/+/,"")}__name(posts,"posts"),__name(searchPosts,"searchPosts"),__name(buildSearchUrl,"buildSearchUrl"),__name(normalizeUrl,"normalizeUrl"),__name(trimTrailingSlash,"trimTrailingSlash"),__name(trimLeadingSlash,"trimLeadingSlash"),exports.getPosts=getPosts,exports.getSearchPosts=getSearchPosts;
|
||||||
+330
-330
@@ -1,330 +1,330 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"display_name": "VegaMovies",
|
"display_name": "VegaMovies",
|
||||||
"value": "vega",
|
"value": "vega",
|
||||||
"version": "2.8",
|
"version": "2.8",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "global",
|
"type": "global",
|
||||||
"disabled": false
|
"disabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "MultiStream",
|
"display_name": "MultiStream",
|
||||||
"value": "autoEmbed",
|
"value": "autoEmbed",
|
||||||
"version": "1.6",
|
"version": "1.6",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "global",
|
"type": "global",
|
||||||
"disabled": false
|
"disabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "MoviesDrive",
|
"display_name": "MoviesDrive",
|
||||||
"value": "drive",
|
"value": "drive",
|
||||||
"version": "2.0",
|
"version": "2.1",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "global",
|
"type": "global",
|
||||||
"disabled": false
|
"disabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "MultiMovies",
|
"display_name": "MultiMovies",
|
||||||
"value": "multi",
|
"value": "multi",
|
||||||
"version": "1.3",
|
"version": "1.3",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "global",
|
"type": "global",
|
||||||
"disabled": false
|
"disabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "4khdHub",
|
"display_name": "4khdHub",
|
||||||
"value": "4khdhub",
|
"value": "4khdhub",
|
||||||
"version": "2.2",
|
"version": "2.2",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "global",
|
"type": "global",
|
||||||
"disabled": false
|
"disabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "Cinewood",
|
"display_name": "Cinewood",
|
||||||
"value": "1cinevood",
|
"value": "1cinevood",
|
||||||
"version": "1.4",
|
"version": "1.4",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "global",
|
"type": "global",
|
||||||
"disabled": false
|
"disabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "World4uFree",
|
"display_name": "World4uFree",
|
||||||
"value": "world4u",
|
"value": "world4u",
|
||||||
"version": "1.4",
|
"version": "1.4",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "global",
|
"type": "global",
|
||||||
"disabled": false
|
"disabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "KatMoviesHd",
|
"display_name": "KatMoviesHd",
|
||||||
"value": "katmovies",
|
"value": "katmovies",
|
||||||
"version": "1.6",
|
"version": "1.6",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "global",
|
"type": "global",
|
||||||
"disabled": false
|
"disabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "MoviesMod",
|
"display_name": "MoviesMod",
|
||||||
"value": "mod",
|
"value": "mod",
|
||||||
"version": "1.3",
|
"version": "1.3",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "global",
|
"type": "global",
|
||||||
"disabled": false
|
"disabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "UHDMovies",
|
"display_name": "UHDMovies",
|
||||||
"value": "uhd",
|
"value": "uhd",
|
||||||
"version": "1.2",
|
"version": "1.2",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "global",
|
"type": "global",
|
||||||
"disabled": false
|
"disabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "ProtonMovies",
|
"display_name": "ProtonMovies",
|
||||||
"value": "protonMovies",
|
"value": "protonMovies",
|
||||||
"version": "1.4",
|
"version": "1.4",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "global",
|
"type": "global",
|
||||||
"disabled": false
|
"disabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "CinemaLuxe",
|
"display_name": "CinemaLuxe",
|
||||||
"value": "cinemaLuxe",
|
"value": "cinemaLuxe",
|
||||||
"version": "1.7",
|
"version": "1.7",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "global",
|
"type": "global",
|
||||||
"disabled": true
|
"disabled": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "FilmyFly",
|
"display_name": "FilmyFly",
|
||||||
"value": "filmyfly",
|
"value": "filmyfly",
|
||||||
"version": "1.4",
|
"version": "1.4",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "global",
|
"type": "global",
|
||||||
"disabled": false
|
"disabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "MovieBox",
|
"display_name": "MovieBox",
|
||||||
"value": "movieBox",
|
"value": "movieBox",
|
||||||
"version": "1.2",
|
"version": "1.2",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "global",
|
"type": "global",
|
||||||
"disabled": true
|
"disabled": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "Movies4U",
|
"display_name": "Movies4U",
|
||||||
"value": "movies4u",
|
"value": "movies4u",
|
||||||
"version": "1.5",
|
"version": "1.5",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "global",
|
"type": "global",
|
||||||
"disabled": false
|
"disabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "KmMovies",
|
"display_name": "KmMovies",
|
||||||
"value": "kmMovies",
|
"value": "kmMovies",
|
||||||
"version": "1.3",
|
"version": "1.3",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "global",
|
"type": "global",
|
||||||
"disabled": false
|
"disabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "Zeefliz",
|
"display_name": "Zeefliz",
|
||||||
"value": "zeefliz",
|
"value": "zeefliz",
|
||||||
"version": "1.5",
|
"version": "1.5",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "global",
|
"type": "global",
|
||||||
"disabled": false
|
"disabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "KatMovieFix",
|
"display_name": "KatMovieFix",
|
||||||
"value": "katMovieFix",
|
"value": "katMovieFix",
|
||||||
"version": "1.6",
|
"version": "1.6",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "global",
|
"type": "global",
|
||||||
"disabled": true
|
"disabled": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "Ringz",
|
"display_name": "Ringz",
|
||||||
"value": "ringz",
|
"value": "ringz",
|
||||||
"version": "1.0",
|
"version": "1.0",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "global",
|
"type": "global",
|
||||||
"disabled": false
|
"disabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "NetflixMirror",
|
"display_name": "NetflixMirror",
|
||||||
"value": "netflixMirror",
|
"value": "netflixMirror",
|
||||||
"version": "1.7",
|
"version": "1.7",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "global",
|
"type": "global",
|
||||||
"disabled": true
|
"disabled": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "PrimeMirror",
|
"display_name": "PrimeMirror",
|
||||||
"value": "primeMirror",
|
"value": "primeMirror",
|
||||||
"version": "1.6",
|
"version": "1.6",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "global",
|
"type": "global",
|
||||||
"disabled": true
|
"disabled": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "HdHub4u",
|
"display_name": "HdHub4u",
|
||||||
"value": "hdhub4u",
|
"value": "hdhub4u",
|
||||||
"version": "1.9",
|
"version": "1.9",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "global",
|
"type": "global",
|
||||||
"disabled": false
|
"disabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "Ogomovies",
|
"display_name": "Ogomovies",
|
||||||
"value": "ogomovies",
|
"value": "ogomovies",
|
||||||
"version": "1.0",
|
"version": "1.0",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "india",
|
"type": "india",
|
||||||
"disabled": true
|
"disabled": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "A.111477",
|
"display_name": "A.111477",
|
||||||
"value": "a111477",
|
"value": "a111477",
|
||||||
"version": "1.2",
|
"version": "1.2",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "english",
|
"type": "english",
|
||||||
"disabled": true
|
"disabled": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "VadaPav",
|
"display_name": "VadaPav",
|
||||||
"value": "vadapav",
|
"value": "vadapav",
|
||||||
"version": "1.0",
|
"version": "1.0",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "global",
|
"type": "global",
|
||||||
"disabled": true
|
"disabled": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "MoviesApi",
|
"display_name": "MoviesApi",
|
||||||
"value": "moviesApi",
|
"value": "moviesApi",
|
||||||
"version": "1.0",
|
"version": "1.0",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "english",
|
"type": "english",
|
||||||
"disabled": true
|
"disabled": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "MoviezWap",
|
"display_name": "MoviezWap",
|
||||||
"value": "moviezwap",
|
"value": "moviezwap",
|
||||||
"version": "1.0",
|
"version": "1.0",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "india",
|
"type": "india",
|
||||||
"disabled": false
|
"disabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "ShowBox",
|
"display_name": "ShowBox",
|
||||||
"value": "showbox",
|
"value": "showbox",
|
||||||
"version": "1.2",
|
"version": "1.2",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "english",
|
"type": "english",
|
||||||
"disabled": false
|
"disabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "RidoMovies",
|
"display_name": "RidoMovies",
|
||||||
"value": "ridoMovies",
|
"value": "ridoMovies",
|
||||||
"version": "1.0",
|
"version": "1.0",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "english",
|
"type": "english",
|
||||||
"disabled": false
|
"disabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "FlixHQ",
|
"display_name": "FlixHQ",
|
||||||
"value": "flixhq",
|
"value": "flixhq",
|
||||||
"version": "1.0",
|
"version": "1.0",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "english",
|
"type": "english",
|
||||||
"disabled": false
|
"disabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "Primewire",
|
"display_name": "Primewire",
|
||||||
"value": "primewire",
|
"value": "primewire",
|
||||||
"version": "1.0",
|
"version": "1.0",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "english",
|
"type": "english",
|
||||||
"disabled": false
|
"disabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "HiAnime",
|
"display_name": "HiAnime",
|
||||||
"value": "hiAnime",
|
"value": "hiAnime",
|
||||||
"version": "1.1",
|
"version": "1.1",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "english",
|
"type": "english",
|
||||||
"disabled": true
|
"disabled": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "Animetsu",
|
"display_name": "Animetsu",
|
||||||
"value": "animetsu",
|
"value": "animetsu",
|
||||||
"version": "1.1",
|
"version": "1.1",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "english",
|
"type": "english",
|
||||||
"disabled": true
|
"disabled": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "TokyoInsider",
|
"display_name": "TokyoInsider",
|
||||||
"value": "tokyoInsider",
|
"value": "tokyoInsider",
|
||||||
"version": "1.0",
|
"version": "1.0",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "english",
|
"type": "english",
|
||||||
"disabled": false
|
"disabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "KissKh",
|
"display_name": "KissKh",
|
||||||
"value": "kissKh",
|
"value": "kissKh",
|
||||||
"version": "1.2",
|
"version": "1.2",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "english",
|
"type": "english",
|
||||||
"disabled": false
|
"disabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "Dooflix",
|
"display_name": "Dooflix",
|
||||||
"value": "dooflix",
|
"value": "dooflix",
|
||||||
"version": "1.4",
|
"version": "1.4",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "india",
|
"type": "india",
|
||||||
"disabled": true
|
"disabled": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "RogMovies",
|
"display_name": "RogMovies",
|
||||||
"value": "luxMovies",
|
"value": "luxMovies",
|
||||||
"version": "2.3",
|
"version": "2.3",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "india",
|
"type": "india",
|
||||||
"disabled": false
|
"disabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "TopMovies",
|
"display_name": "TopMovies",
|
||||||
"value": "topmovies",
|
"value": "topmovies",
|
||||||
"version": "1.2",
|
"version": "1.2",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "india",
|
"type": "india",
|
||||||
"disabled": false
|
"disabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "GuardaHD",
|
"display_name": "GuardaHD",
|
||||||
"value": "guardahd",
|
"value": "guardahd",
|
||||||
"version": "1.6",
|
"version": "1.6",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "italy",
|
"type": "italy",
|
||||||
"disabled": false
|
"disabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "SkyMovieHD",
|
"display_name": "SkyMovieHD",
|
||||||
"value": "skyMovieHD",
|
"value": "skyMovieHD",
|
||||||
"version": "1.6",
|
"version": "1.6",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "global",
|
"type": "global",
|
||||||
"disabled": true
|
"disabled": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"display_name": "Joya9tv",
|
"display_name": "Joya9tv",
|
||||||
"value": "Joya9tv",
|
"value": "Joya9tv",
|
||||||
"version": "1.5",
|
"version": "1.5",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"type": "india",
|
"type": "india",
|
||||||
"disabled": false
|
"disabled": false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
+172
-72
@@ -1,72 +1,172 @@
|
|||||||
import { Post, ProviderContext } from "../types";
|
import { Post, ProviderContext } from "../types";
|
||||||
|
|
||||||
export const getPosts = async function ({
|
export const getPosts = async function ({
|
||||||
filter,
|
filter,
|
||||||
page,
|
page,
|
||||||
signal,
|
signal,
|
||||||
providerContext,
|
providerContext,
|
||||||
}: {
|
}: {
|
||||||
filter: string;
|
filter: string;
|
||||||
page: number;
|
page: number;
|
||||||
providerValue: string;
|
providerValue: string;
|
||||||
signal: AbortSignal;
|
signal: AbortSignal;
|
||||||
providerContext: ProviderContext;
|
providerContext: ProviderContext;
|
||||||
}): Promise<Post[]> {
|
}): Promise<Post[]> {
|
||||||
const { getBaseUrl } = providerContext;
|
const { getBaseUrl } = providerContext;
|
||||||
const baseUrl = await getBaseUrl("drive");
|
const baseUrl = await getBaseUrl("drive");
|
||||||
const url = `${baseUrl + filter}page/${page}/`;
|
const url = `${baseUrl + filter}page/${page}/`;
|
||||||
return posts({ url, signal, providerContext });
|
return posts({ url, signal, providerContext });
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getSearchPosts = async function ({
|
export const getSearchPosts = async function ({
|
||||||
searchQuery,
|
searchQuery,
|
||||||
page,
|
page,
|
||||||
signal,
|
signal,
|
||||||
providerContext,
|
providerContext,
|
||||||
}: {
|
}: {
|
||||||
searchQuery: string;
|
searchQuery: string;
|
||||||
page: number;
|
page: number;
|
||||||
providerValue: string;
|
providerValue: string;
|
||||||
providerContext: ProviderContext;
|
providerContext: ProviderContext;
|
||||||
signal: AbortSignal;
|
signal: AbortSignal;
|
||||||
}): Promise<Post[]> {
|
}): Promise<Post[]> {
|
||||||
const { getBaseUrl } = providerContext;
|
const { getBaseUrl } = providerContext;
|
||||||
const baseUrl = await getBaseUrl("drive");
|
const baseUrl = await getBaseUrl("drive");
|
||||||
const url = `${baseUrl}page/${page}/?s=${searchQuery}`;
|
const url = buildSearchUrl(baseUrl, searchQuery, page);
|
||||||
return posts({ url, signal, providerContext });
|
return searchPosts({
|
||||||
};
|
url,
|
||||||
|
baseUrl,
|
||||||
async function posts({
|
signal,
|
||||||
url,
|
});
|
||||||
signal,
|
};
|
||||||
providerContext,
|
|
||||||
}: {
|
async function posts({
|
||||||
url: string;
|
url,
|
||||||
signal: AbortSignal;
|
signal,
|
||||||
providerContext: ProviderContext;
|
providerContext,
|
||||||
}): Promise<Post[]> {
|
}: {
|
||||||
try {
|
url: string;
|
||||||
console.log("Fetching URL:", url);
|
signal: AbortSignal;
|
||||||
const { cheerio } = providerContext;
|
providerContext: ProviderContext;
|
||||||
const res = await fetch(url, { signal });
|
}): Promise<Post[]> {
|
||||||
const data = await res.text();
|
try {
|
||||||
const $ = cheerio.load(data);
|
console.log("Fetching URL:", url);
|
||||||
const catalog: Post[] = [];
|
const { cheerio } = providerContext;
|
||||||
$(".poster-card").map((i, element) => {
|
const res = await fetch(url, { signal });
|
||||||
const title = $(element).find(".poster-title").text();
|
const data = await res.text();
|
||||||
const link = $(element).parent().attr("href");
|
const $ = cheerio.load(data);
|
||||||
const image = $(element).find(".poster-image img").attr("src");
|
const catalog: Post[] = [];
|
||||||
if (title && link && image) {
|
$(".poster-card").map((i, element) => {
|
||||||
catalog.push({
|
const title = $(element).find(".poster-title").text();
|
||||||
title: title.replace("Download", "").trim(),
|
const link = $(element).parent().attr("href");
|
||||||
link: link,
|
const image = $(element).find(".poster-image img").attr("src");
|
||||||
image: image,
|
if (title && link && image) {
|
||||||
});
|
catalog.push({
|
||||||
}
|
title: title.replace("Download", "").trim(),
|
||||||
});
|
link: link,
|
||||||
return catalog;
|
image: image,
|
||||||
} catch (err) {
|
});
|
||||||
console.error("drive error ", err);
|
}
|
||||||
return [];
|
});
|
||||||
}
|
return catalog;
|
||||||
}
|
} catch (err) {
|
||||||
|
console.error("drive error ", err);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function searchPosts({
|
||||||
|
url,
|
||||||
|
baseUrl,
|
||||||
|
signal,
|
||||||
|
}: {
|
||||||
|
url: string;
|
||||||
|
baseUrl: string;
|
||||||
|
signal: AbortSignal;
|
||||||
|
}): Promise<Post[]> {
|
||||||
|
try {
|
||||||
|
console.log("Fetching drive search URL:", url);
|
||||||
|
const res = await fetch(url, { signal });
|
||||||
|
|
||||||
|
if (!res.ok) {
|
||||||
|
throw new Error(`drive search failed with status ${res.status}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = (await res.json()) as {
|
||||||
|
hits?: Array<{
|
||||||
|
document?: {
|
||||||
|
permalink?: string;
|
||||||
|
post_thumbnail?: string;
|
||||||
|
post_title?: string;
|
||||||
|
};
|
||||||
|
}>;
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
data.hits
|
||||||
|
?.map((hit) => {
|
||||||
|
const document = hit.document;
|
||||||
|
const title = document?.post_title?.trim();
|
||||||
|
const link = document?.permalink
|
||||||
|
? normalizeUrl(baseUrl, document.permalink)
|
||||||
|
: "";
|
||||||
|
const image = document?.post_thumbnail
|
||||||
|
? normalizeUrl(baseUrl, document.post_thumbnail)
|
||||||
|
: "";
|
||||||
|
|
||||||
|
if (!title || !link || !image) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
title,
|
||||||
|
link,
|
||||||
|
image,
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.filter((post): post is Post => post !== null) ?? []
|
||||||
|
);
|
||||||
|
} catch (err) {
|
||||||
|
console.error("drive search error ", err);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildSearchUrl(
|
||||||
|
baseUrl: string,
|
||||||
|
searchQuery: string,
|
||||||
|
page: number,
|
||||||
|
): string {
|
||||||
|
const separator = baseUrl.includes("?") ? "&" : "?";
|
||||||
|
return `${trimTrailingSlash(baseUrl)}/search.php${separator}q=${encodeURIComponent(
|
||||||
|
searchQuery,
|
||||||
|
)}&page=${page}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeUrl(baseUrl: string, value: string): string {
|
||||||
|
if (!value) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (/^https?:\/\//i.test(value)) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value.startsWith("//")) {
|
||||||
|
return `https:${value}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value.startsWith("/")) {
|
||||||
|
return `${trimTrailingSlash(baseUrl)}${value}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return `${trimTrailingSlash(baseUrl)}/${trimLeadingSlash(value)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function trimTrailingSlash(value: string): string {
|
||||||
|
return value.replace(/\/+$/, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
function trimLeadingSlash(value: string): string {
|
||||||
|
return value.replace(/^\/+/, "");
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user