mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-18 08:01:43 +00:00
1 line
1.5 KiB
JavaScript
1 line
1.5 KiB
JavaScript
"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){var value;result.done?resolve(result.value):(value=result.value,value instanceof P?value:new P(function(resolve){resolve(value)})).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getEpisodes=void 0;const getEpisodes=function(_a){return __awaiter(this,arguments,void 0,function*({url:id,providerContext:providerContext}){const{axios:axios}=providerContext;try{const[fileId,febboxId]=id.split("&"),febLink=febboxId?`https://www.febbox.com/file/file_share_list?share_key=${fileId}&pwd=&parent_id=${febboxId}&is_html=0`:`https://www.febbox.com/file/file_share_list?share_key=${fileId}&pwd=&is_html=0`,res=yield axios.get(febLink),fileList=res.data.data.file_list,episodeLinks=[];return null==fileList||fileList.map(file=>{const fileName=formatEpisodeName(file.file_name),epId=null==file?void 0:file.fid;!file.is_dir&&fileName&&epId&&episodeLinks.push({title:fileName,link:`${fileId}&${epId}`})}),episodeLinks}catch(err){return[]}})};function formatEpisodeName(title){const match=title.match(/[sS](\d+)\s*[eE](\d+)/);if(match){return`Season${match[1].padStart(2,"0")} Episode${match[2].padStart(2,"0")}`}return title}exports.getEpisodes=getEpisodes; |