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] Unable to download webpage: 'An existing connection was forcibly closed by the remote host' #30546

Open
5 tasks done
MVMnn opened this issue Jan 21, 2022 · 17 comments
Open
5 tasks done

Comments

@MVMnn
Copy link

MVMnn commented Jan 21, 2022

Checklist

  • I'm reporting a broken site support
  • I've verified that I'm running youtube-dl version 2021.12.17
  • 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

C:\yd>youtube-dl.exe https://www.tiktok.com/@klrdubs/video/7020527490435140870 -v
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['https://www.tiktok.com/@klrdubs/video/7020527490435140870', '-v']
[debug] Encodings: locale cp1252, fs mbcs, out cp437, pref cp1252
[debug] youtube-dl version 2021.12.17
[debug] Python version 3.4.4 (CPython) - Windows-2012ServerR2-6.3.9600
[debug] exe versions: none
[debug] Proxy map: {}
[TikTok] Setting up session
ERROR: Unable to download webpage: [WinError 10054] An existing connection was forcibly closed by the remote host (caused by ConnectionResetError(1005
4, 'An existing connection was forcibly closed by the remote host', None, 10054, None)); please report this issue on https://yt-dl.org/bug . Make sure
 you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpupik7c6w\build\youtube_dl\extractor\common.py", line 634, in _request_webpag
e
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpupik7c6w\build\youtube_dl\YoutubeDL.py", line 2288, in urlopen
  File "C:\Python\Python34\lib\urllib\request.py", line 464, in open
  File "C:\Python\Python34\lib\urllib\request.py", line 482, in _open
  File "C:\Python\Python34\lib\urllib\request.py", line 442, in _call_chain
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpupik7c6w\build\youtube_dl\utils.py", line 2737, in https_open
  File "C:\Python\Python34\lib\urllib\request.py", line 1186, in do_open
  File "C:\Python\Python34\lib\http\client.py", line 1227, in getresponse
  File "C:\Python\Python34\lib\http\client.py", line 386, in begin
  File "C:\Python\Python34\lib\http\client.py", line 348, in _read_status
  File "C:\Python\Python34\lib\socket.py", line 378, in readinto
  File "C:\Python\Python34\lib\ssl.py", line 748, in recv_into
  File "C:\Python\Python34\lib\ssl.py", line 620, in read

Description

Tiktok parsing fails every time with "Unable to download webpage: [WinError 10054] An existing connection was forcibly closed by the remote host" error. I tried with different video URLs and also from different countries. The latest official build was used.
There was a similar problem in the past (Issue 10084), one of the top developers investigated it but had to close because it did not reproduce. It'd be good to check it the same way now, since the call stack is identical. In the past the problem was with a different site, and now it seems to be 100% reproducible.

@dirkf
Copy link
Contributor

dirkf commented Jan 21, 2022

To repeat the response to #30545...

The TikTok extractor seems to fail in all sorts of interesting ways, even with PR #30224, PR #30479 or other patches. The yt-dlp extractor for TT, which doesn't try to look at the actual webpage, succeeds with your target.

@MVMnn
Copy link
Author

MVMnn commented Jan 21, 2022

Thank you so much, sir! I saw that fork in the past, but I am happy to hear a confirmation from you. Hope to see porting of that logic to the original repository.

To repeat the response to #30545...

The TikTok extractor seems to fail in all sorts of interesting ways, even with PR #30224, PR #30479 or other patches. The yt-dlp extractor for TT, which doesn't try to look at the actual webpage, succeeds with your target.

@flashdagger
Copy link

From my experience this error is related to https requests on Windows. Never experienced it on POSIX.
--no-check-certificate option might help...

@MVMnn
Copy link
Author

MVMnn commented Jan 21, 2022

From my experience this error is related to https requests on Windows. Never experienced it on POSIX. --no-check-certificate option might help...

Tried, unfortunately did not work for me. On Ubuntu it hangs on '[TikTok] Setting up session'.

@dirkf
Copy link
Contributor

dirkf commented Jan 21, 2022

What about --user-agent 'Mozilla/5.0', or perhaps some real UA string from a current browser?

@october262
Copy link

you can also download the video if you have an browser add-on
that allows right click, just rith click on the video and select "save video as "
to download the video as mp4.

@dirkf
Copy link
Contributor

dirkf commented Jan 22, 2022

I have an alternate tool that works:
...

a) as the log shows, it uses the same tactic as yt-dlp: see #30538 (comment);
b) thanks to your test it is clear that some unwanted or non-default header is causing the issue;
c) for form's sake: that's nice..

@MVMnn
Copy link
Author

MVMnn commented Jan 23, 2022

What about --user-agent 'Mozilla/5.0', or perhaps some real UA string from a current browser?

Tried both ways, same error.

@MVMnn
Copy link
Author

MVMnn commented Jan 25, 2022

I have an alternate tool that works:

PS C:\> tiktok 7020527490435140870
GET http://api2.musical.ly/aweme/v1/aweme/detail/?aweme_id=7020527490435140870
GET http://v16m-default.akamaized.net/26569ec19350e923d1e04d11e8effe98/61eb2540/video/tos/useast2a/tos-useast2a-ve-0068c004/1b518c34ba36434a9fca617d5458ecb7/

https://github.com/89z/mech

Thank you sir, it works and is very FAST.

@dirkf
Copy link
Contributor

dirkf commented Jan 30, 2022

From discussions elsewhere, HTTP/2 may be the discriminator that TT is using. According to the Go net/http documentation, HTTP/2 is the default, which would explain why the above tool isn't blocked. yt-dl Python versions only know about HTTP/1.1.

@koopa990
Copy link

Thank you sir, it works and is very FAST.

How do you get this to work? The author barely provided instruction on how to use it.

@koopa990
Copy link

You should ask that question on the other repo

They specifically said in the description that they only help patreon/paid users.

@koopa990
Copy link

OK fair enough, but why you do think asking a question about another repo here is a good idea?

Where else? Do you expect me to pay them if I instantly use their stuff? That is unfair

@dirkf
Copy link
Contributor

dirkf commented Oct 29, 2022

I suppose @koopa990 realises that "them" is @89z?

@koopa990
Copy link

I suppose @koopa990 realises that "them" is @89z?

yes.

@koopa990
Copy link

I am sorry for the distraction my original comment (from January) has caused. I removed it, but someone quoted it, so here we are. I would repeat that anyone with a question regarding that comment, should not be asking about it on the YouTube-DL tracker.

Thank you very much for the repo.

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

No branches or pull requests

6 participants
@dirkf @flashdagger @MVMnn @koopa990 @october262 and others