mirror of
https://github.com/imputnet/cobalt.git
synced 2025-06-28 09:28:29 +00:00
统计下载视频的成功率
This commit is contained in:
parent
2b856cf256
commit
996a7426f6
@ -245,13 +245,21 @@ export const runAPI = async (express, app, __dirname, isPrimary = true) => {
|
||||
return fail(res, "error.api.invalid_body");
|
||||
}
|
||||
|
||||
// Log the requested video URL for tracking user download attempts
|
||||
console.log(`[DOWNLOAD REQUEST] User attempting to download: ${normalizedRequest.url}`);
|
||||
console.log(`[DOWNLOAD REQUEST] Client IP: ${getIP(req)}`);
|
||||
console.log(`[DOWNLOAD REQUEST] Timestamp: ${new Date().toISOString()}`);
|
||||
console.log(`[DOWNLOAD REQUEST] User Agent: ${req.get('User-Agent') || 'Unknown'}`);
|
||||
|
||||
const parsed = extract(normalizedRequest.url);
|
||||
|
||||
if (!parsed) {
|
||||
console.log(`[DOWNLOAD REQUEST] Failed - Invalid URL: ${normalizedRequest.url}`);
|
||||
return fail(res, "error.api.link.invalid");
|
||||
}
|
||||
|
||||
if ("error" in parsed) {
|
||||
console.log(`[DOWNLOAD REQUEST] Failed - Parse error for URL: ${normalizedRequest.url}, Error: ${parsed.error}`);
|
||||
let context;
|
||||
if (parsed?.context) {
|
||||
context = parsed.context;
|
||||
@ -259,6 +267,8 @@ export const runAPI = async (express, app, __dirname, isPrimary = true) => {
|
||||
return fail(res, `error.api.${parsed.error}`, context);
|
||||
}
|
||||
|
||||
console.log(`[DOWNLOAD REQUEST] Successfully parsed URL: ${normalizedRequest.url}, Service: ${parsed.host}`);
|
||||
|
||||
try {
|
||||
const result = await match({
|
||||
host: parsed.host,
|
||||
@ -267,8 +277,10 @@ export const runAPI = async (express, app, __dirname, isPrimary = true) => {
|
||||
isSession: req.isSession ?? false,
|
||||
});
|
||||
|
||||
console.log(`[DOWNLOAD REQUEST] Processing completed for URL: ${normalizedRequest.url}, Status: ${result.status}`);
|
||||
res.status(result.status).json(result.body);
|
||||
} catch {
|
||||
} catch (error) {
|
||||
console.log(`[DOWNLOAD REQUEST] Processing failed for URL: ${normalizedRequest.url}, Error: ${error.message}`);
|
||||
fail(res, "error.api.generic");
|
||||
}
|
||||
});
|
||||
@ -373,7 +385,10 @@ export const runAPI = async (express, app, __dirname, isPrimary = true) => {
|
||||
"~~~~~~\n" +
|
||||
|
||||
Bright("url: ") + Bright(Cyan(env.apiURL)) + "\n" +
|
||||
Bright("port: ") + env.apiPort + "\n"
|
||||
Bright("port: ") + env.apiPort + "\n" +
|
||||
|
||||
"~~~~~~\n" +
|
||||
Bright("📊 Logging enabled: ") + "Video download requests will be tracked\n"
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@
|
||||
<div class="notification" role="alert">
|
||||
<div class="notification-content">
|
||||
<span class="notification-icon">🎉</span>
|
||||
<span class="notification-text">最新功能=>"传输": 你可以方便的在你的设备之间传输文件和文本,端到端加密,保护隐私性!</span> <button
|
||||
<span class="notification-text">最新功能=>【传输】: 你可以方便的在你的设备之间传输文件和文本。采用端到端加密技术,保护隐私性!</span> <button
|
||||
class="notification-close"
|
||||
aria-label="关闭通知"
|
||||
on:click={closeNotification}
|
||||
|
Loading…
Reference in New Issue
Block a user