Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TikTok.com - New URL #23264

Open
adrgru opened this issue Nov 29, 2019 · 39 comments
Open

TikTok.com - New URL #23264

adrgru opened this issue Nov 29, 2019 · 39 comments

Comments

@adrgru
Copy link

@adrgru adrgru commented Nov 29, 2019

Checklist

  • I'm reporting a broken site support
  • I've verified that I'm running youtube-dl version 2019.11.28
  • I've checked that all provided URLs are alive and playable in a browser
  • I've checked that all URLs and arguments with special characters are properly quoted or escaped
  • I've searched the bugtracker for similar issues including closed ones

Verbose log

for profiles, playlists and songs:

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['https://www.tiktok.com/@dannero', '-v']
[debug] Encodings: locale cp1252, fs mbcs, out cp850, pref cp1252
[debug] youtube-dl version 2019.11.28
[debug] Python version 3.4.4 (CPython) - Windows-10-10.0.18362
[debug] exe versions: ffmpeg git-2019-11-09-bb190de, ffprobe git-2019-11-09-bb190de
[debug] Proxy map: {}
[generic] @dannero: Requesting header
WARNING: Falling back on generic information extractor.
[generic] @dannero: Downloading webpage
[generic] @dannero: Extracting information
ERROR: Unsupported URL: https://www.tiktok.com/@dannero
Traceback (most recent call last):
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpwy0zjfmc\build\youtube_dl\YoutubeDL.py", line 796, in extract_info
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpwy0zjfmc\build\youtube_dl\extractor\common.py", line 530, in extract
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpwy0zjfmc\build\youtube_dl\extractor\generic.py", line 3347, in _real_extract
youtube_dl.utils.UnsupportedError: Unsupported URL: https://www.tiktok.com/@dannero

for videos:

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['https://www.tiktok.com/@markoterzo/video/6762207861918420230', '-v']
[debug] Encodings: locale cp1252, fs mbcs, out cp850, pref cp1252
[debug] youtube-dl version 2019.11.28
[debug] Python version 3.4.4 (CPython) - Windows-10-10.0.18362
[debug] exe versions: ffmpeg git-2019-11-09-bb190de, ffprobe git-2019-11-09-bb190de
[debug] Proxy map: {}
[generic] 6762207861918420230: Requesting header
WARNING: Falling back on generic information extractor.
[generic] 6762207861918420230: Downloading webpage
[generic] 6762207861918420230: Extracting information
[download] Downloading playlist: M A R K O  on TikTok
[generic] playlist M A R K O  on TikTok: Collected 1 video ids (downloading 1 of them)
[download] Downloading video 1 of 1
[debug] Default format spec: bestvideo+bestaudio/best
[debug] Invoking downloader on 'https://v19.muscdn.com/99bdb82ff18a6720f09602b8de495194/5de1edf9/video/tos/maliva/tos-maliva-v-0068/af15acd0acb44d8bbf38744b1857631d/?a=1233&br=1547&cr=0&cs=0&dr=0&ds=3&er=&l=2019112922200201011511513317E33486&lr=tiktok_m&qs=0&rc=ank1NDVyPGY2cTMzZDczM0ApNmlkO2hoOTtnNzg4ZTU6aWdoaWwzZG0tLWBfLS1eMTZzczYwLzMvNGNhLV4tMTFfMWE6Yw=='
[download] Destination: M A R K O  on TikTok-6762207861918420230.unknown_video
[download] 100% of 1.36MiB in 00:02
[download] Finished downloading playlist: M A R K O  on TikTok

Description

There is a new format of TikTok URLs that was recently introduced. None of them work in youtube-dl.

The "Discover" page on TikTok.com (https://www.tiktok.com/discover) features the following - and none of them work:

@skyme5
Copy link

@skyme5 skyme5 commented Nov 30, 2019

There is already a PR #22838 that fixes this issue.

PR working status for youtube-dl

TikTok Extractor Python 2 TikTok Extractor Python 3

@skyme5 skyme5 mentioned this issue Nov 30, 2019
6 of 9 tasks complete
@bpenven
Copy link

@bpenven bpenven commented Jul 27, 2020

There is already a PR #22838 that fixes this issue.

No it does not.

@bpenven
Copy link

@bpenven bpenven commented Jul 29, 2020

@yan12125 this one is closed...

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jul 29, 2020

this one is closed...

Hmm not sure what you mean

image

@bpenven
Copy link

@bpenven bpenven commented Jul 29, 2020

@yan12125 I meant this one: #26094 sorry for the misunderstanding.

@notpushkin
Copy link

@notpushkin notpushkin commented Jul 29, 2020

For anybody wondering: pipx install https://github.com/runraid/youtube-dl/archive/tiktokwatermarkless.zip --force to install a version by @runraid (#25895) which can get download tiktoks without a watermark!

(Inspect changes here. If you don't use pipx yet, give it a try! Plain pip should work fine too.)

@notpushkin notpushkin mentioned this issue Jul 29, 2020
5 of 5 tasks complete
@dtaust
Copy link

@dtaust dtaust commented Jul 31, 2020

@bpenven #22838 actually does fix this, I've built 2020.07.28 with the changes to extractors.py and tiktok.py patched in.

@skyme5 I'm not sure if it's just my setup but in TikTokBaseIE/tiktok.py this doesn't work, the url variable ends up empty:

   formats = []
    formats.append({
        'url': try_get(video_info, lambda x: x['video']['urls'][0], str),
        'ext': 'mp4',
        'height': height,
        'width': width
    })

I've solved that by doing this:

    formats = []
    video_urls = try_get(video_info, lambda x: x['video']['urls'], list)
    video_url = video_urls[0]
    formats.append({
        'url': video_url,
        'ext': 'mp4',
        'height': height,
        'width': width
    })

I don't really code in python so I'm not really sure why your code wouldn't work to begin with, it seems perfectly valid to me.

If referencing the 0th element of a list like that doesn't work you've done the same thing here as well:

'thumbnail': try_get(video_info, lambda x: x['covers'][0], str),

but you probably just end up with no thumbnail whereas url being empty causes the below:

WARNING: "url" field is missing or empty - skipping format, there is an error in extractor
Traceback (most recent call last):
File "/usr/lib64/python2.7/runpy.py", line 174, in _run_module_as_main
"main", fname, loader, pkg_name)
File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/local/bin/youtube-dl/main.py", line 19, in
File "/usr/local/bin/youtube-dl/youtube_dl/init.py", line 474, in main

File "/usr/local/bin/youtube-dl/youtube_dl/init.py", line 464, in _real_main

File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 2019, in download
File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 808, in extract_info
File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 863, in process_ie_result
File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1589, in process_video_result

@skyme5
Copy link

@skyme5 skyme5 commented Jul 31, 2020

@dtaust, Extractor in #22838 doesn't work on Python 2 (because of lambda expressions). Try Python 3.

@dtaust
Copy link

@dtaust dtaust commented Jul 31, 2020

Doesn't that mean that pull won't be merged because the youtube-dl project supports python 2.6/2.7?

From the project page:

It requires the Python interpreter (2.6, 2.7, or 3.2+), and it is not platform specific.

[debug] Python version 2.7.16 (CPython)
This is the versioning on my test machine and with the small changes I made the lambda expressions work fine on 2.7.

@skyme5
Copy link

@skyme5 skyme5 commented Aug 1, 2020

I think this is due to comparison of expected_type in try_get being different for Python 2 and 3, in Python 2 it has the type unicode while Python 3 has str.

Removing the expected_type comparison resolves the problem.

formats.append({
    'url': try_get(video_info, lambda x: x['video']['urls'][0]),
...

Fixed in #22838

@Nolaan
Copy link

@Nolaan Nolaan commented Aug 3, 2020

Looks like Tiktok updated their strategies again.
By inspecting the requests, we can see that a sort of verification/captcha is going on.
Screenshot_20200803_120731

@llacb47
Copy link

@llacb47 llacb47 commented Aug 4, 2020

Looks like Tiktok updated their strategies again.

That has nothing to do with downloading the video.

@lihuelworks
Copy link

@lihuelworks lihuelworks commented Aug 11, 2020

Still have issues with this (using ver 2020.07.28). Any other info I can add to help?

youtube-dl 'https://www.tiktok.com/@rogeliobucktronar/video/6820475866087197958'
[generic] 6820475866087197958: Requesting header
WARNING: Falling back on generic information extractor.
[generic] 6820475866087197958: Downloading webpage
[generic] 6820475866087197958: Extracting information
ERROR: Unsupported URL: https://www.tiktok.com/@rogeliobucktronar/video/6820475866087197958
@skyme5
Copy link

@skyme5 skyme5 commented Aug 11, 2020

@lihuelworks, PR #22838, fixes this issue which is still not merged yet, you can install this PR described here or you can replace the youtube_dl/extractor/tiktok.py in installation folder with this.

@Nolaan
Copy link

@Nolaan Nolaan commented Aug 11, 2020

Looks like Tiktok updated their strategies again.

That has nothing to do with downloading the video.

I 'm not sure I'm getting you @llacb47 . The download fails because of the captcha but that has nothing to do with downloading the video?
What am I getting wrong?

@Nolaan
Copy link

@Nolaan Nolaan commented Aug 11, 2020

@skyme5 have tried @lihuelworks url before posting? The very reason of my first post is that I was under the impression that it doesn't work either.
I just tried and still doesn't work. Am I doing something wrong?

Best regards

Screenshot_20200811_234451

@llacb47
Copy link

@llacb47 llacb47 commented Aug 11, 2020

Looks like Tiktok updated their strategies again.

That has nothing to do with downloading the video.

I 'm not sure I'm getting you @llacb47 . The download fails because of the captcha but that has nothing to do with downloading the video?
What am I getting wrong?

Look at the source code, the video URL is literally there. There is no captcha bypass needed to get the video.

@Nolaan
Copy link

@Nolaan Nolaan commented Aug 11, 2020

My bad (or not) I had to checkout the tiktok branch to make it work and didn't know it existed.
Snippet should be :

git clone https://github.com/skyme5/youtube-dl.git
cd youtube-dl/youtube_dl
git checkout origin/tiktok
python __main__.py url
@MohamedElashri
Copy link

@MohamedElashri MohamedElashri commented Aug 12, 2020

My bad (or not) I had to checkout the tiktok branch to make it work and didn't know it existed.
Snippet should be :

git clone https://github.com/skyme5/youtube-dl.git
cd youtube-dl/youtube_dl
git checkout origin/tiktok
python __main__.py url

can it be used to download all user videos ?

@Nolaan
Copy link

@Nolaan Nolaan commented Aug 12, 2020

@MohamedElashri yes it worked afterwards

@lihuelworks
Copy link

@lihuelworks lihuelworks commented Aug 13, 2020

It works! Hope it gets implemented soon, I'm really missing that functionality on mpv.

@notpushkin
Copy link

@notpushkin notpushkin commented Aug 14, 2020

pipx install https://github.com/skyme5/youtube-dl/archive/tiktok.zip --force to install the version from #22838. (Inspect changes here. If you don't use pipx yet, give it a try! Plain pip should work fine too.)

@fluffy0223024c
Copy link

@fluffy0223024c fluffy0223024c commented Aug 21, 2020

For anybody wondering: pipx install https://github.com/runraid/youtube-dl/archive/tiktokwatermarkless.zip --force to install a version by @runraid (#25895) which can get download tiktoks without a watermark!

(Inspect changes here. If you don't use pipx yet, give it a try! Plain pip should work fine too.)

I got the error Package cannot be a url

@AmperAndSand
Copy link

@AmperAndSand AmperAndSand commented Aug 22, 2020

For anybody wondering: pipx install https://github.com/runraid/youtube-dl/archive/tiktokwatermarkless.zip --force to install a version by @runraid (#25895) which can get download tiktoks without a watermark!
(Inspect changes here. If you don't use pipx yet, give it a try! Plain pip should work fine too.)

I got the error Package cannot be a url

Try using pip instead of pipx.

@fluffy0223024c
Copy link

@fluffy0223024c fluffy0223024c commented Aug 22, 2020

For anybody wondering: pipx install https://github.com/runraid/youtube-dl/archive/tiktokwatermarkless.zip --force to install a version by @runraid (#25895) which can get download tiktoks without a watermark!
(Inspect changes here. If you don't use pipx yet, give it a try! Plain pip should work fine too.)

I got the error Package cannot be a url

Try using pip instead of pipx.

The command worked with pip3 (python3-pip). Thank you!

@notpushkin
Copy link

@notpushkin notpushkin commented Aug 25, 2020

The only problem with installing these versions is that you wouldn't get updates from main youtube-dl branch (right now YouTube support is broken in both I think) until @skyme5 @runraid rebase their branches. If you only need TikTok support, you'll be fine though.

@Al-Muhandis
Copy link

@Al-Muhandis Al-Muhandis commented Aug 25, 2020

The only problem with installing these versions is that you wouldn't get updates from main youtube-dl branch (right now YouTube support is broken in both I think) until @skyme5 @runraid rebase their branches. If you only need TikTok support, you'll be fine though.

But watermarkless fork of @runraid do not works now (

@notpushkin
Copy link

@notpushkin notpushkin commented Aug 25, 2020

@Al-Muhandis It did work for older videos (before July 2020 I think) last time I checked 🤔

@Al-Muhandis
Copy link

@Al-Muhandis Al-Muhandis commented Aug 25, 2020

@Al-Muhandis It did work for older videos (before July 2020 I think) last time I checked 🤔

Yes, I noticed. It doesn't work for new videos (

@dtaust
Copy link

@dtaust dtaust commented Aug 25, 2020

@notpushkin the solution for that is to clone the current ytdl-org/youtube-dl repo and replace youtube_dl/extractor/tiktok.py with skyme5's one and then make/install.

@notpushkin
Copy link

@notpushkin notpushkin commented Aug 31, 2020

@dtaust Makes sense, but I'm too lazy personally :') (which is the reason I came up with the one-liners above)

@VasiliPupkin256
Copy link

@VasiliPupkin256 VasiliPupkin256 commented Sep 13, 2020

@blackjack4494 why can't it be merged here?

The recent youtube-dl version was released just recently and the tiktok support is not fixed in it.

@ytdl-org ytdl-org deleted a comment from blackjack4494 Sep 13, 2020
@skyme5
Copy link

@skyme5 skyme5 commented Sep 13, 2020

@VasiliPupkin256 that PR has been opened for nearly 328 days and still not merged by @dstftw.

youtube-dl with tiktok download support is available at blackjack4494/youtube-dlc

@sjmueller
Copy link

@sjmueller sjmueller commented Sep 18, 2020

Really confused about why tiktok remains broken for so long. Can Sergey @dstftw @remitamine or any of the other maintainers give us some visibility into what's happening and why? Let's make it easy, check one of the following:

  • The PR is not sufficient because of reason [x] so we won't merge until it is fixed
  • We favor PR [x] instead, and plan to merge that one when blocker [y] is resolved
  • We have our own solution in the works that will probably be finished in [x] weeks, please be patient until then
  • We don't really care about tiktok, and will be removing it from the list of youtube-dl's supported sites
@swan911
Copy link

@swan911 swan911 commented Sep 25, 2020

Hi! I downloaded link https://v16-web-newkey.tiktokcdn.com/blabla in browser and I got error 403. After I added header "Referer: https://www.tiktok.com/blabla" in my curl downloader example and I can downloaded tiktok video. We need to add header Referer when you download media link

@VasiliPupkin256
Copy link

@VasiliPupkin256 VasiliPupkin256 commented Sep 25, 2020

@sjmueller:

  • TikTok blackmail admins threatening to kill their uyghur families if they don't remove it from youtube-dl
@theBigDalt
Copy link

@theBigDalt theBigDalt commented Sep 26, 2020

For others as a workaround, here are curl and wget examples:

curl --output "video.mp4" --referer "https://www.tiktok.com/@user/video/123456789" -O "https://v16-web-newkey.tiktokcdn.com/......"

wget --output-document="video.mp4" --referer="https://www.tiktok.com/@user/video/123456789" "https://v16-web-newkey.tiktokcdn.com/....."
@jinthoa
Copy link

@jinthoa jinthoa commented Sep 28, 2020

For others as a workaround, here are curl and wget examples:

curl --output "video.mp4" --referer "https://www.tiktok.com/@user/video/123456789" -O "https://v16-web-newkey.tiktokcdn.com/......"
wget --output-document="video.mp4" --referer="https://www.tiktok.com/@user/video/123456789" "https://v16-web-newkey.tiktokcdn.com/....."

Where does "https://v16-web-newkey.tiktokcdn.com/....." come from ?

@theBigDalt
Copy link

@theBigDalt theBigDalt commented Sep 29, 2020

Where does "https://v16-web-newkey.tiktokcdn.com/....." come from ?

With the TikTok video open in the browser, right click it and inspect the element. Look for an element with video in it and a link similar to the above. That link is the actual video being requested, which is served by TikTok's CDN. However, the CDN requires the referral of the original link as it won't give you access to the video without it, hence the above workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.