fix(bilibili): video reply (#17440)
* fix(bilibili): video reply * fix * update
This commit is contained in:
@@ -33,11 +33,13 @@ async function handler(ctx) {
|
||||
}
|
||||
|
||||
const link = `https://www.bilibili.com/video/${bvid || `av${aid}`}`;
|
||||
const cookie = await cache.getCookie();
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://api.bilibili.com/x/v2/reply?type=1&oid=${aid}&sort=0`,
|
||||
headers: {
|
||||
Referer: link,
|
||||
Cookie: cookie,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
+13
-1
@@ -1,6 +1,10 @@
|
||||
import { destr } from 'destr';
|
||||
import ofetch from '@/utils/ofetch';
|
||||
|
||||
function isObject(o) {
|
||||
return o !== null && typeof o === 'object' && Array.isArray(o) === false;
|
||||
}
|
||||
|
||||
const getFakeGot = (defaultOptions?: any) => {
|
||||
const fakeGot = (request, options?: any) => {
|
||||
if (!(typeof request === 'string' || request instanceof Request) && request.url) {
|
||||
@@ -35,7 +39,15 @@ const getFakeGot = (defaultOptions?: any) => {
|
||||
delete options.form;
|
||||
}
|
||||
if (options?.searchParams) {
|
||||
request += '?' + new URLSearchParams(options.searchParams).toString();
|
||||
request +=
|
||||
'?' +
|
||||
new URLSearchParams(
|
||||
isObject(options.searchParams)
|
||||
? Object.entries(options.searchParams)
|
||||
.filter(([, value]) => value !== undefined)
|
||||
.map(([key, value]) => [key, String(value)])
|
||||
: options.searchParams
|
||||
).toString();
|
||||
delete options.searchParams;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user