mirror of
https://github.com/hansputera/tiktok-dl.git
synced 2026-04-05 19:51:57 +02:00
chore(config): remove eslint prettier plugin
This commit is contained in:
@@ -4,8 +4,7 @@
|
||||
"node": true
|
||||
},
|
||||
"extends": [
|
||||
"google",
|
||||
"prettier"
|
||||
"google"
|
||||
],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
|
||||
@@ -53,8 +53,8 @@ export class SaveFromProvider extends BaseProvider {
|
||||
extract(html: string): ExtractedInfo {
|
||||
const deobfuscated = deObfuscateSaveFromScript(html);
|
||||
const json = JSON.parse(
|
||||
(deobfuscated.match(/\({(.*)}\)/) as string[])[0]
|
||||
.replace(/(\(|\))/g, '')
|
||||
(deobfuscated.match(/\({(.*)}\)/) as string[])[0]
|
||||
.replace(/(\(|\))/g, ''),
|
||||
);
|
||||
return {
|
||||
'error': undefined,
|
||||
@@ -64,14 +64,15 @@ export class SaveFromProvider extends BaseProvider {
|
||||
'videoId': json.id,
|
||||
'videoTitle': json.meta.title,
|
||||
'videoDuration': json.meta.duration,
|
||||
'urls': json.url.map((x: { type: string; subname: string; }, index: number) => ({
|
||||
'urls': json.url.map((x:
|
||||
{ type: string; subname: string; }, index: number) => ({
|
||||
'pos': index,
|
||||
'type': x.type,
|
||||
'resolution': x.subname,
|
||||
}))
|
||||
})),
|
||||
},
|
||||
'urls': json.url.map((x: { url: string; }) => x.url),
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ export class TikmateProvider extends BaseProvider {
|
||||
|
||||
/**
|
||||
* Extract information from raw html
|
||||
* @param {string} html - Raw HTML
|
||||
* @param {string} html - Raw HTML
|
||||
* @return {ExtractedInfo}
|
||||
*/
|
||||
@handleException
|
||||
|
||||
@@ -17,14 +17,15 @@ export const deObfuscate = (html: string): string => {
|
||||
'Cannot download the video!',
|
||||
);
|
||||
} else {
|
||||
const transformed = obfuscatedScripts[0].replace(/<(\/)?script( type=".+")?>/g, '').trim().replace('eval', '')
|
||||
.replace(/\(function \(h/gi, 'module.exports = (function (h');
|
||||
const transformed = obfuscatedScripts[0]
|
||||
.replace(/<(\/)?script( type=".+")?>/g, '').trim().replace('eval', '')
|
||||
.replace(/\(function \(h/gi, 'module.exports = (function (h');
|
||||
const deObfuscated = new NodeVM({
|
||||
'compiler': 'javascript',
|
||||
'console': 'inherit',
|
||||
'require': {
|
||||
'external': true,
|
||||
'root': './'
|
||||
'root': './',
|
||||
},
|
||||
}).run(transformed, 'deobfuscate.js');
|
||||
return deObfuscated;
|
||||
@@ -51,19 +52,20 @@ export const matchTikmateDownload = (raw: string): string[] => {
|
||||
export const deObfuscateSaveFromScript = (scriptContent: string): string => {
|
||||
const safeScript = 'let result;' +
|
||||
scriptContent.replace(/\/\*js\-response\*\//gi, '')
|
||||
.replace(/eval\(a\)/gi, 'return a')
|
||||
.replace(/\[\]\["filter"\]\["constructor"\]\(b\)\.call\(a\);/gi,`
|
||||
.replace(/eval\(a\)/gi, 'return a')
|
||||
.replace(/\[\]\["filter"\]\["constructor"\]\(b\)\.call\(a\);/gi, `
|
||||
if (b.includes('showResult')) {
|
||||
result = b;
|
||||
return;
|
||||
} else []['filter']['constructor'](b).call(a);`) + 'module.exports = result;';
|
||||
} else []['filter']['constructor'](b).call(a);`) +
|
||||
'module.exports = result;';
|
||||
const vm = new NodeVM({
|
||||
'compiler': 'javascript',
|
||||
'console': 'inherit',
|
||||
'require': {
|
||||
'external': true,
|
||||
'root': './',
|
||||
}
|
||||
},
|
||||
});
|
||||
const result = vm.run(safeScript, 'savefrom.js');
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user