drawrowfly / tiktok-scraper

TikTok Scraper. Download video posts, collect user/trend/hashtag/music feed metadata, sign URL and etc.
4.44k stars 805 forks source link

getVideoMeta compatible with mobile links #727

Closed Muh9049 closed 2 years ago

Muh9049 commented 2 years ago

Is your feature request related to a problem? Please describe. The .getVideoMeta functions seems to only work with desktop tiktok links only but errors with mobile links. (vm.tiktok.com)

Describe the solution you'd like Would it be possible to make it support mobile links too? Or is there any function that can convert the mobile link to the desktop links?

Error it returns if you try putting in a mobile link:


          triggerUncaughtException(err, true /* fromPromise */);
          ^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not 
handled with .catch(). The promise rejected with the reason "Can't extract video metadata: [link here]".] {
  code: 'ERR_UNHANDLED_REJECTION'
}
dmastag commented 2 years ago

I think this is already addressed in https://github.com/drawrowfly/tiktok-scraper/issues/681

And @drawrowfly said he is preparing a fix

aliazhar-id commented 2 years ago

Is your feature request related to a problem? Please describe. The .getVideoMeta functions seems to only work with desktop tiktok links only but errors with mobile links. (vm.tiktok.com)

Describe the solution you'd like Would it be possible to make it support mobile links too? Or is there any function that can convert the mobile link to the desktop links?

Error it returns if you try putting in a mobile link:

          triggerUncaughtException(err, true /* fromPromise */);
          ^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not 
handled with .catch(). The promise rejected with the reason "Can't extract video metadata: [link here]".] {
  code: 'ERR_UNHANDLED_REJECTION'
}

I have the solution, vm.tiktok.com/ is a short link. therefore you can expand the link. and the link will generate www.tiktok.com/blabla. then you can use that as argument in .getVideoMeta().

sorry my english is bad hope you can understand it

Muh9049 commented 2 years ago

@aliazhar-id Can you give an example of an expanded link? The mobile vm.tiktok.com links don’t have a username and have a different video id than the desktop tiktok.com links so I’m not sure how that’ll exactly work.

aliazhar-id commented 2 years ago

@Muh9049 image

you can use one of these modules:

I have an example of its use in my repository https://github.com/aliazhar-id/SaveThis/blob/6387d7298f95f529baa9f34052d5d5d72601704f/src/events/download.js#L16

Muh9049 commented 2 years ago

@Muh9049 image

you can use one of these modules:

I have an example of its use in my repository https://github.com/aliazhar-id/SaveThis/blob/6387d7298f95f529baa9f34052d5d5d72601704f/src/events/download.js#L16

Thanks! I’ll try this out later.

aliazhar-id commented 2 years ago

No Problem 👍

Muh9049 commented 2 years ago

@aliazhar-id What are the ratelimits for those packages? My bot does get high traffic in terms of command usage so that’s my only concern if those packages/APIs enforce a strict ratelimit

aliazhar-id commented 2 years ago

@aliazhar-id What are the ratelimits for those packages? My bot does get high traffic in terms of command usage so that’s my only concern if those packages/APIs enforce a strict ratelimit

not mentioned by the owner API, but you can read the TOS https://unshorten.it/terms-of-service, if you are worried you can use the tall module. I've tried but failed, I don't know if you try.