feat(core): added form payload request

Signed-off-by: hansputera <hanifdwyputrasembiring@gmail.com>
This commit is contained in:
hansputera
2022-03-11 16:51:11 +07:00
parent f898e6543a
commit 55971d17d0
2 changed files with 10 additions and 4 deletions

View File

@@ -14,7 +14,9 @@ export const rotateProvider = async (
url: string,
skipOnError: boolean = true,
): Promise<ExtractedInfo & {provider: string}> => {
// await redisClient.del(url);
if (process.env.NODE_ENV === 'development') {
await redisClient.del(url);
}
// console.log(provider.resourceName());
if (provider.maintenance) {
return await rotateProvider(getRandomProvider(), url, skipOnError);

View File

@@ -48,11 +48,15 @@ export class GetVidTikProvider extends BaseProvider {
Referer: response.url,
},
followRedirect: false,
});
form: {
url,
token: matchs[1],
}
});
if (downloadResponse.statusCode === 302) {
return {
error: 'The video is private or removed.',
error: 'The video is private or removed. Please try again!',
};
} else {
return this.extract(downloadResponse.body);
@@ -67,7 +71,7 @@ export class GetVidTikProvider extends BaseProvider {
*/
extract(html: string): ExtractedInfo {
const matchs = matchLink(html);
if (matchs) {
if (matchs) {
const tiktokMatchs = matchs.filter((url) =>
/http(s)?:\/\/(.*)\.tiktok(cdn)?\.com/gi.test(url),
);