lmammino / tall

Promise-based, No-dependency URL unshortner (expander) module for Node.js
https://lmammino.github.io/tall/
MIT License
72 stars 7 forks source link

Tiktok links not resolving? #45

Closed txj-xyz closed 2 years ago

txj-xyz commented 2 years ago

Hey, just using this package to resolve TikTok links and it appears that tall is not working for those links

lmammino commented 2 years ago

I had a quick look at this and it does not seem like an issue with tall.

What's happening is that tiktok's servers seems to hang the connection if you are not providing a user-agent in the headers.

This seems to work:

const {tall} = require("tall")

tall('https://vm.tiktok.com/TTPdBsSRy1', {
  headers: {
    'User-Agent': 'curl/7.77.0'
  }
})
  .then(console.log)
  .catch(console.error)

output:

https://www.tiktok.com/@friendofabanana/video/7063452052835470639?_t=8PysqXgPRfS&_r=1

You can run this example on RunKit 🏃💻

Let me know if this solves the issue for you

txj-xyz commented 2 years ago

LGTM 👍🏽