mirror of
https://github.com/YuzuZensai/play-dl-test.git
synced 2026-01-31 14:58:05 +00:00
search validation added
This commit is contained in:
@@ -10,22 +10,22 @@ interface youtubeDataOptions {
|
||||
}
|
||||
|
||||
export function getCookies(): undefined | string {
|
||||
let result = ''
|
||||
if(!youtubeData?.cookie) return undefined
|
||||
for (const [ key, value ] of Object.entries(youtubeData.cookie)){
|
||||
result+= `${key}=${value};`
|
||||
let result = '';
|
||||
if (!youtubeData?.cookie) return undefined;
|
||||
for (const [key, value] of Object.entries(youtubeData.cookie)) {
|
||||
result += `${key}=${value};`;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
export function setCookie(key: string, value: string): boolean {
|
||||
if (!youtubeData?.cookie) return false;
|
||||
key = key.trim()
|
||||
value = value.trim()
|
||||
Object.assign(youtubeData.cookie, { [key] : value })
|
||||
return true
|
||||
key = key.trim();
|
||||
value = value.trim();
|
||||
Object.assign(youtubeData.cookie, { [key]: value });
|
||||
return true;
|
||||
}
|
||||
|
||||
export function uploadCookie() {
|
||||
if(youtubeData) fs.writeFileSync('.data/youtube.data', JSON.stringify(youtubeData, undefined, 4));
|
||||
if (youtubeData) fs.writeFileSync('.data/youtube.data', JSON.stringify(youtubeData, undefined, 4));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user