mirror of
https://github.com/hansputera/tiktok-dl.git
synced 2026-04-05 19:51:57 +02:00
feat(packages.core): split music and video urls in ttDownloader
Signed-off-by: Hanif Dwy Putra S <hanifdwyputrasembiring@gmail.com>
This commit is contained in:
@@ -32,6 +32,7 @@ export class TikDownProvider extends BaseProvider {
|
||||
});
|
||||
|
||||
const body = response.body;
|
||||
console.log(body);
|
||||
if (/please double/gi.test(body))
|
||||
{
|
||||
return {
|
||||
|
||||
@@ -53,10 +53,15 @@ export class TTDownloader extends BaseProvider {
|
||||
extract(html: string): ExtractedInfo {
|
||||
const urls = matchLink(html);
|
||||
urls?.pop(); // remove 'https://snaptik.fans'
|
||||
|
||||
const musicUrl = urls?.find(u => /mp3/gi.test(u));
|
||||
return {
|
||||
video: {
|
||||
urls: (urls as string[]) ?? [],
|
||||
urls: urls?.filter(u => u !== musicUrl) ?? [],
|
||||
},
|
||||
music: musicUrl ? {
|
||||
url: musicUrl,
|
||||
} : undefined,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user