koishi-plugin-video-parser-all 0.7.0 → 0.7.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.
- package/lib/index.js +10 -5
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -285,8 +285,10 @@ function cleanUrl(url) {
|
|
|
285
285
|
url = url.replace(/&/g, '&');
|
|
286
286
|
const urlObj = new URL(url);
|
|
287
287
|
if (urlObj.hostname.includes('xiaohongshu.com')) {
|
|
288
|
+
const pathname = urlObj.pathname;
|
|
288
289
|
urlObj.searchParams.forEach((_, key) => urlObj.searchParams.delete(key));
|
|
289
|
-
|
|
290
|
+
urlObj.pathname = pathname;
|
|
291
|
+
return urlObj.href;
|
|
290
292
|
}
|
|
291
293
|
if (urlObj.hostname.includes('douyin.com') || urlObj.hostname.includes('v.douyin.com')) {
|
|
292
294
|
urlObj.searchParams.delete('source');
|
|
@@ -302,12 +304,13 @@ function cleanUrl(url) {
|
|
|
302
304
|
async function resolveShortUrl(url) {
|
|
303
305
|
try {
|
|
304
306
|
const res = await axios_1.default.head(url, {
|
|
305
|
-
timeout:
|
|
306
|
-
maxRedirects:
|
|
307
|
+
timeout: 15000,
|
|
308
|
+
maxRedirects: 15,
|
|
307
309
|
headers: {
|
|
308
310
|
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
|
|
309
311
|
'Referer': 'https://www.baidu.com/',
|
|
310
|
-
}
|
|
312
|
+
},
|
|
313
|
+
validateStatus: (status) => status >= 200 && status < 400
|
|
311
314
|
});
|
|
312
315
|
return cleanUrl(res.request.res?.responseUrl || url);
|
|
313
316
|
}
|
|
@@ -642,7 +645,9 @@ function apply(ctx, config) {
|
|
|
642
645
|
headers: {
|
|
643
646
|
'X-Requested-With': 'XMLHttpRequest',
|
|
644
647
|
'Origin': 'https://api.bugpk.com',
|
|
645
|
-
'Content-Type': 'application/x-www-form-urlencoded'
|
|
648
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
649
|
+
'Cache-Control': 'no-cache',
|
|
650
|
+
'Pragma': 'no-cache'
|
|
646
651
|
}
|
|
647
652
|
});
|
|
648
653
|
}
|
package/package.json
CHANGED