This commit is contained in:
手瓜一十雪 2024-05-04 22:26:36 +08:00
parent c724236930
commit a56b7ff636
2 changed files with 1 additions and 53 deletions

@ -1 +1 @@
Subproject commit db7b494755d82213da7884451d5c26922debe3bd
Subproject commit 16ab139ae667c573c44f7889aefc22fb0c7c4d14

View File

@ -1,52 +0,0 @@
import http from 'http';
const privateRkey = '';
function logDebug(...args) {
console.log(...args);
}
const checkUrl = new Promise((resolve, reject) => {
const uri = new URL('https://gchat.qpic.cn/download?appid=1407&fileid=CgkzNzk0NTAzMjYSFECDMhodswV7nH5Npuf2O8dstvL1GNaGEiD_CijQycnZsuaFA1CAvaMB&spec=0&rkey=CAESKE4_cASDm1t1mbnPfSzEvPzS-iYGLyXhjXjTRIhOHeSVDKkPp6Luaao');
const options = {
method: 'GET',
host: uri.host,
path: uri.pathname + uri.search,
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36',
'Accept': '*/*',
'Range': 'bytes=0-0'
}
};
const req = http.request(options, (res) => {
logDebug(`Check rkey status: ${res.statusCode}`);
logDebug(`Check rkey headers: ${JSON.stringify(res.headers)}`);
if (res.statusCode == 200 || res.statusCode === 206) {
// console.log('The image URL is accessible.');
resolve('ok');
} else {
reject('The image URL is not accessible.');
}
});
req.setTimeout(3000, () => {
req.destroy();
reject('Check rkey request timed out');
});
req.on('error', (e) => {
console.error(`Problem with rkey request: ${e.message}`);
// reject(e.message);
});
req.end();
});
const startTime = Date.now();
checkUrl.then((result) => {
const endTime = Date.now();
console.log(result);
console.log(`Time elapsed: ${endTime - startTime}ms`);
}).catch((error) => {
const endTime = Date.now();
console.error(error);
console.log(`Time elapsed: ${endTime - startTime}ms`);
});