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

[YouTube Bridge] - YouTube failed with error 0 #2947

Closed
dariottolo opened this issue Aug 1, 2022 · 16 comments · Fixed by #2949
Closed

[YouTube Bridge] - YouTube failed with error 0 #2947

dariottolo opened this issue Aug 1, 2022 · 16 comments · Fixed by #2949

Comments

@dariottolo
Copy link

I am having the following issue with Youtube bridge for a couple of days.

Please let me know if you need additional information

Uncaught Exception HttpException: HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1) (92) at lib/contents.php line 230

#0 index.php:32
#1 actions/DisplayAction.php:136
#2 bridges/YoutubeBridge.php:342
#3 bridges/YoutubeBridge.php:227
#4 lib/contents.php:284
#5 lib/contents.php:107
#6 lib/contents.php:230

Query string:action=display&bridge=YoutubeBridge&context=By+channel+id&c=UCHL9bfHTxCMi-7vfxQ-AYtg&duration_min=&duration_max=&format=Html
Version:git.master.a0a0d52

Error_log is full of:
[01-Aug-2022 09:43:37 UTC] HttpException: HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1) (92) in /home/diludovi/public_html/bridge/lib/contents.php:230
Stack trace:
#0 /home/diludovi/public_html/bridge/lib/contents.php(107): _http_request('https://www.you...', Array)
#1 /home/diludovi/public_html/bridge/lib/contents.php(284): getContents('https://www.you...', Array, Array)
#2 /home/diludovi/public_html/bridge/bridges/YoutubeBridge.php(227): getSimpleHTMLDOM('https://www.you...', Array, Array, true, true, 'UTF-8', false, '\r\n', ' ')
#3 /home/diludovi/public_html/bridge/bridges/YoutubeBridge.php(342): YoutubeBridge->ytGetSimpleHTMLDOM('https://www.you...')
#4 /home/diludovi/public_html/bridge/actions/DisplayAction.php(136): YoutubeBridge->collectData()
#5 /home/diludovi/public_html/bridge/index.php(32): DisplayAction->execute(Array)
#6 {main}

@dvikan
Copy link
Contributor

dvikan commented Aug 1, 2022

Looks like intermittent network failure. But if you are persistently getting this error it's concerning. Are you sure it's persistent? Is it your private instance? I am not getting this error on my instance.

@dariottolo
Copy link
Author

I started noticing a couple of days ago. Since then, every single update has the same output.
RSS-Bridge in on my shared hosting account, password protected. All other bridges are working fine.
I am not very tech savvy, but if you want me to run more tests, let me know.

@dvikan
Copy link
Contributor

dvikan commented Aug 1, 2022

What's the server OS and php version?

@dariottolo
Copy link
Author

LiteSpeed V8.0.1 Cloudlinux 1.3
PHP Version 8.1.8

@dvikan
Copy link
Contributor

dvikan commented Aug 1, 2022

I don't fully understand this errror yet. Maybe the most recent php/curl uses HTTP 2 by default or something. Maybe try this patch if you are able to edit the files:

diff --git a/lib/contents.php b/lib/contents.php
index 94e45b95..6a146c68 100644
--- a/lib/contents.php
+++ b/lib/contents.php
@@ -181,6 +181,7 @@ function _http_request(string $url, array $config = []): array
     curl_setopt($ch, CURLOPT_TIMEOUT, $config['timeout']);
     curl_setopt($ch, CURLOPT_ENCODING, '');
     curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
+    curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
     if ($config['proxy']) {
         curl_setopt($ch, CURLOPT_PROXY, $config['proxy']);
     }

@dariottolo
Copy link
Author

I added the line to contents.php but there were no differences in the output

@dvikan
Copy link
Contributor

dvikan commented Aug 1, 2022

Might be a cached result you are seeing. Wait a bit (3 hours) or enable debugging with touch DEBUG or edit the CACHE_TIMEOUT in bridges/YoutubeBridge.php

@dariottolo
Copy link
Author

You were absolutely right. I enabled debugging and it is now working as expected (so far, fingers crossed).
Thanks a lot.

@dvikan
Copy link
Contributor

dvikan commented Aug 1, 2022

So looks like recent version of libcurl uses HTTP 2 by default instead of HTTP 1.1. I'm not familiar with HTTP 2 and I still don't understand why the error. But I guess we can merge this change into master to preserve the usage of HTTP 1.1.

dvikan added a commit to dvikan/rss-bridge that referenced this issue Aug 1, 2022
@dvikan
Copy link
Contributor

dvikan commented Aug 3, 2022

I was unable to reproduce this on Debian 11, PHP 8.1.8. Maybe it was a youtube intermittent error?

@dariottolo
Copy link
Author

Should I un-apply your patch and see if the error occurs?

@dvikan
Copy link
Contributor

dvikan commented Aug 3, 2022

Sure :)

@dariottolo
Copy link
Author

I removed the patch and the bridge does not work for me.

@dvikan
Copy link
Contributor

dvikan commented Aug 3, 2022

My install has libcurl 7.74.0 which I found via <?php phpinfo();. Whats yours?

@dariottolo
Copy link
Author

cURL Information: 7.84.0

dvikan added a commit that referenced this issue Aug 5, 2022
Since curl 7.62.0 the default option is: CURL_HTTP_VERSION_2TLS

Before that the default used to be: CURL_HTTP_VERSION_1_1

Fix #2947
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

Successfully merging a pull request may close this issue.

2 participants