PageSourceSearch

https://www.ottohub.cn/assets/videoDetailApi-GjJVd2Xr.js

js ottohub.cn collected 2026-10-06 13:14:40 UTC 5,408 bytes, 1 lines download raw bytes

1import{c as e,l as t,o as n,s as r}from"./apiResponse-C8fEm_-L.js";import{_ as i}from"./commentApi-CZfXaEOY.js";import{o as a}from"./blogMeta-BvgcPzkT.js";import{r as o}from"./videoMeta-BsFx8V72.js";import{i as s}from"./videoStaffApi-BM5KDgOf.js";function c(e){return e===!0||e===1||e===`1`||typeof e==`string`&&e.toLowerCase()===`true`}function l(e){return{vid:String(e.vid),uid:String(e.uid),title:String(e.title??``),time:String(e.time??``),likeCount:Number(e.like_count)||0,favoriteCount:Number(e.favorite_count)||0,viewCount:Number(e.view_count)||0,duration:Number(e.duration)||0,coverUrl:e.cover_url?String(e.cover_url):void 0,isGore:a(e.is_gore),username:e.username?String(e.username):void 0,avatarUrl:e.avatar_url?String(e.avatar_url):void 0}}function u(e){if(e.vid==null)return null;let t=e.channel_detail,n=null,r=t?.channel_id??e.channel_id;return r!=null&&String(r)!==``&&Number(r)!==0&&(n={channelId:String(r),channelName:String(t?.channel_name??``),channelTitle:String(t?.channel_title??``),channelDescription:t?.channel_description?String(t.channel_description):void 0,channelCoverUrl:t?.channel_cover_url||t?.cover_url}),{vid:String(e.vid),uid:String(e.uid),title:String(e.title??``),intro:String(e.intro??``),type:String(e.type??``),category:String(e.category??``),tags:o(e),time:String(e.time??``),likeCount:Number(e.like_count)||0,favoriteCount:Number(e.favorite_count)||0,viewCount:Number(e.view_count)||0,coverUrl:String(e.cover_url??``),videoUrl:String(e.video_url??``),videoM3u8Url:e.video_m3u8_url?String(e.video_m3u8_url):void 0,username:String(e.username??``),userIntro:e.userintro?String(e.userintro):void 0,avatarUrl:e.avatar_url?String(e.avatar_url):void 0,ifLike:c(e.if_like),ifFavorite:c(e.if_favorite),duration:Number(e.duration)||0,lastWatchSecond:e.last_watch_second==null?void 0:Number(e.last_watch_second),commentCount:Number(e.comment_count)||0,parentCommentCount:Number(e.parent_comment_count??e.comment_count)||0,auditStatus:e.audit_status==null?void 0:Number(e.audit_status),channelId:e.channel_id==null?void 0:String(e.channel_id),channelDetail:n,staff:s(e.staff)}}function d(e){if(!e||typeof e!=`object`)return null;let t=e;if(t.status===`error`)return null;let n=t.data;return n&&typeof n==`object`&&!Array.isArray(n)&&n.vid!=null?u(n):Array.isArray(t.video_list)&&t.video_list.length>0?u(t.video_list[0]):t.vid==null?null:u(t)}function f(e){if(!e||typeof e!=`object`)return[];let t=e;if(t.status===`error`)return[];let n=t.data;if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n.video_list;if(Array.isArray(e))return e.map(e=>l(e))}return Array.isArray(n)?n.map(e=>l(e)):Array.isArray(t.video_list)?t.video_list.map(e=>l(e)):[]}function p(e){if(!e||typeof e!=`object`)return null;let t=e;if(t.status===`error`)return null;let n=typeof t.collection==`string`?t.collection:``,r=Array.isArray(t.video_list)?t.video_list:[];return!n||r.length===0?null:{name:n,items:r.map(e=>l(e))}}async function m(e,n,r){let a=t(`/api/video/${encodeURIComponent(e)}`,{token:n||void 0,...r?.noHistory?{no_history:1}:{}}),o=await i(a,{cache:n?`no-store`:`default`});if(o&&typeof o==`object`&&o.status===`error`){let e=String(o.message||``);return o.error_vid||e.includes(`error_vid`)?{ok:!1,reason:`not_found`}:e.toLowerCase().includes(`too_many_request`)||e.toLowerCase().includes(`too many request`)?{ok:!1,reason:`too_many_request`,message:e||`访问频率过高`}:{ok:!1,reason:`error`,message:e||`获取视频详情失败`}}let s=d(o);return s?{ok:!0,detail:s}:{ok:!1,reason:`error`,message:`获取视频详情失败`}}async function h(e){try{let n=t(`/api/video/related/${encodeURIComponent(e)}`,{num:20,offset:0});return f(await(await fetch(n,{cache:`default`})).json())}catch{return[]}}async function g(e){try{let n=t(`/api/collection/videos/${encodeURIComponent(e)}/collection`);return p(await(await fetch(n,{cache:`default`})).json())}catch{return null}}async function _(t,i){let a=await fetch(`${e}/api/video/like/${encodeURIComponent(t)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:i}),cache:`no-store`}),o=await n(a);if(r(a,o))return null;let s=o,l=s.data,u=l&&typeof l==`object`?l:s;return{ifLike:c(u.if_like),likeCount:Number(u.like_count)||0}}async function v(t,i){let a=await fetch(`${e}/api/video/favorite/${encodeURIComponent(t)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:i}),cache:`no-store`}),o=await n(a);if(r(a,o))return null;let s=o,l=s.data,u=l&&typeof l==`object`?l:s;return{ifFavorite:c(u.if_favorite),favoriteCount:Number(u.favorite_count)||0}}async function y(t,i,a){let o=await fetch(`${e}/api/moderation/videos/${encodeURIComponent(t)}/report`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:i,reason:a}),cache:`no-store`}),s=await n(o);return!r(o,s)}async function b(t,i,a){let o=await fetch(`${e}/api/moderation/video-comments/${encodeURIComponent(t)}/report`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:i,reason:a}),cache:`no-store`}),s=await n(o);return!r(o,s)}async function x(t,n,r,i){let a=Math.floor(r),o=i>0&&a>=i-1?-1:a;try{await fetch(`${e}/api/video/watch-history`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:n,vid:t,last_watch_second:o}),cache:`no-store`})}catch{}}export{b as a,_ as c,y as i,g as n,x as o,m as r,v as s,h as t};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.