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 Error #30445

Open
UnixCro opened this issue Dec 31, 2021 · 16 comments
Open

TikTok Error #30445

UnixCro opened this issue Dec 31, 2021 · 16 comments

Comments

@UnixCro
Copy link

UnixCro commented Dec 31, 2021

~/files/Tiktok $ youtube-dl --verbose https://vm.tiktok.com/ZM8Kf5sqY/
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--verbose', 'https://vm.tiktok.com/ZM8Kf5sqY/']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2021.12.17
[debug] Python version 3.10.1 (CPython) - Linux-4.14.87+-armv8l-with-libc
[debug] exe versions: ffmpeg 4.4.1, ffprobe 4.4.1
[debug] Proxy map: {}
[generic] ZM8Kf5sqY: Requesting header
[redirect] Following redirect to https://www.tiktok.com/@elektrokurzschluss/video/7042661503035526406?_d=secCgwIARCbDRjEFSACKAESPgo8Py%2BWHrKmQ8k916xwcDBjDWlzWI3uyW3d84Z2wwgZBwA6dO9mCxynY1r%2BVVrZKE4rOvdHB5S4NR7cJt0sGgA%3D&language=de&preview_pb=0&sec_user_id=MS4wLjABAAAAwkLYynP5HnlwKtmz4yBJ6cCjmTTfkDfupLpi6htOTGYDBqQw03ruYBKCSem4mD-x&share_app_id=1233&share_item_id=7042661503035526406&share_link_id=5391ca27-a864-405f-84d3-8fec6466ad88&source=h5_m&timestamp=1640954903&u_code=de7i359c99ad13&user_id=6866698620222948358&utm_campaign=client_share&utm_medium=android&utm_source=copy&_r=1
[TikTok] Setting up session
[TikTok] 7042661503035526406: Downloading webpage
ERROR: Unable to extract data; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/youtube_dl/YoutubeDL.py", line 815, in wrapper
    return func(self, *args, **kwargs)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/youtube_dl/YoutubeDL.py", line 836, in __extract_info
    ie_result = ie.extract(url)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/youtube_dl/extractor/common.py", line 534, in extract
    ie_result = self._real_extract(url)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/youtube_dl/extractor/tiktok.py", line 110, in _real_extract
    page_props = self._parse_json(self._search_regex(
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/youtube_dl/extractor/common.py", line 1012, in _search_regex
    raise RegexNotFoundError('Unable to extract %s' % _name)
youtube_dl.utils.RegexNotFoundError: Unable to extract data; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
@dirkf
Copy link
Contributor

dirkf commented Dec 31, 2021

Duplicate of #30251, where a patch that appears to work is provided.

@UnixCro
Copy link
Author

UnixCro commented Dec 31, 2021

No thx

@p1ratrulezzz
Copy link

p1ratrulezzz commented Dec 31, 2021

Applied patch from #30251 (comment) and it worked for me.

Tutorial:

  1. Save patch as /tmp/tiktok.patch. (or download attachment). Open it and change first lines as following:
--- old/youtube-dl/youtube_dl/extractor/tiktok.py
+++ new/youtube-dl/youtube_dl/extractor/tiktok.py

to

--- old/extractor/tiktok.py
+++ new/extractor/tiktok.py
  1. if you use venv - activate it by
source venv/bin/activate
  1. Find out site-packages folder location by running
venv_dir=$(python3 -c "import sysconfig; print(sysconfig.get_path('purelib'))")
echo $venv_dir
  1. change dir to site-packages and apply the patch
cd $venv_dir/youtube_dl
patch -p1 < /tmp/tiktok.patch
  1. If using a venv, run
deactivate
  1. It should work now.

@dirkf
Copy link
Contributor

dirkf commented Dec 31, 2021

Save patch as /tmp/tiktok.patch. (or download attachment). Open it and change first lines as following:

Or use patch -p2 ... later on (step 4). -p says how many of the leading directories in the patch script to strip when finding the file to be patched, which obviously depends on where the patch is relative to the package being patched.

Obviously the procedure doesn't apply if the installation is a single file or not a site-packages installation, but that should encourage people to pip their installation.

@p1ratrulezzz
Copy link

p1ratrulezzz commented Dec 31, 2021

-p says how many of the leading directories in the patch script to strip

Thanks, for some reason I didn't even try to check manual, just was using p1 as I got used to many years ago. Now I knew something new!

Yes, I believe people mostly use pip to install this package, as I'm not a python dev I even searched if there is a way to say pip to apply patch but haven't found anything. I hope the solution is temporary unless it will be fixed someday...

I also checked solution with go script by @89z and it also works, I was able to build it under ubuntu 20.04 and go 1.17 but it lacks of some nice paratemeters like "set output filename" or download using shortcut as youtube-dl does.

@p1ratrulezzz
Copy link

wow thanks! I'll use it in bot, I was about to add this output argument by myself but you did it so fast and this is very nice!

@UnixCro
Copy link
Author

UnixCro commented Jan 2, 2022

I LOVE YOU DUDE. IT WORKED YOU A GENIUS BRO @p1ratrulezzz

@ghost ghost mentioned this issue Jan 3, 2022
@UnixCro
Copy link
Author

UnixCro commented Jan 7, 2022

Good Morning,

after the patch everything went as usual, but this morning I noticed that youtube-dl was getting problems, regardless of which Tiktok video. It stops at Session and doesn't do anything anymore.

youtube-dl -v https://vm.tiktok.com/ZM8o81GJ6/
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', 'https://vm.tiktok.com/ZM8o81GJ6/']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2021.12.17
[debug] Python version 3.10.1 (CPython) - Linux-4.14.87+-armv8l-with-libc
[debug] exe versions: ffmpeg 4.4.1, ffprobe 4.4.1
[debug] Proxy map: {}
[generic] ZM8o81GJ6: Requesting header
[redirect] Following redirect to https://www.tiktok.com/@tal_dahan_98/video/7024900237076483329?_d=secCgwIARCbDRjEFSACKAESPgo8YrY3EKdj1E6gxwNUHIw1x1pyS1GuRWH%2B7yBvtTroH1PZUFsEa6LLl7vAD373o7DlJP0ex0LcUx3xx5RIGgA%3D&checksum=86caa7b721ef97df33eae17f7050f10a2df3b3563b7dbad85fc24c6108f71d6d&language=de&preview_pb=0&sec_user_id=MS4wLjABAAAAwkLYynP5HnlwKtmz4yBJ6cCjmTTfkDfupLpi6htOTGYDBqQw03ruYBKCSem4mD-x&share_app_id=1233&share_item_id=7024900237076483329&share_link_id=B9546FAF-D8BE-478F-B1D6-A82C83A8DCD6&source=h5_m&timestamp=1641475816&tt_from=copy&u_code=de7i359c99ad13&user_id=6866698620222948358&utm_campaign=client_share&utm_medium=ios&utm_source=copy&_r=1
[TikTok] Setting up session

Has anyone noticed the same bug?

@dirkf
Copy link
Contributor

dirkf commented Jan 7, 2022

See #30251.

@UnixCro
Copy link
Author

UnixCro commented Jan 7, 2022

Thank you @dirkf. But how exactly do I install the new version now?

@dirkf
Copy link
Contributor

dirkf commented Jan 7, 2022

You have to replace the extractor module with the one from the PR. See #30479 (comment).

@UnixCro
Copy link
Author

UnixCro commented Jan 7, 2022

Same mistake. It gets stuck after the setting up session.

pip install --force-reinstall -U git+https://github.com/ytdl-org/youtube-dl@refs/pull/30184/merge 

@dirkf
Copy link
Contributor

dirkf commented Jan 7, 2022

... (substitute PR number 30479 and file youtube_dl/extractor/tiktok.py as appropriate) ...

You installed PR #30184 instead of #30479!

@UnixCro
Copy link
Author

UnixCro commented Jan 7, 2022

Ah nice 😂😂. It worked @dirkf. Hopefully 100 years with you.

pip install --force-reinstall -U git+https://github.com/ytdl-org/youtube-dl@refs/pull/30479/merge

@VasiliPupkin256
Copy link

@dirkf this PR doesn't work anymore. "Could not send HEAD request to https://www.tiktok.com/....: The read operation timed out"

@dirkf
Copy link
Contributor

dirkf commented Feb 22, 2022

Indeed, that's why it hasn't been merged: #30538.

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

Successfully merging a pull request may close this issue.

4 participants