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

Error when adding Youtube video - v12b #16

Open
jtoutee opened this issue Jun 5, 2022 · 13 comments
Open

Error when adding Youtube video - v12b #16

jtoutee opened this issue Jun 5, 2022 · 13 comments

Comments

@jtoutee
Copy link

jtoutee commented Jun 5, 2022

Hello,
For some reason I get an error when adding a Youtube video (see screeshot below). I do this for years and not sure what has changed. Is there any possibility to get more info on the error ?
It says not to use this form for Youtube but in the same time at the bottom it says it is for Youtube (and others).
Not that the othe option, with embedded code, works (but it is a pain as you need to manually select a thumbnail photo).
The video itself is not the problem, I tried to add some previously successfully added Youtibe video but I now always have this error.
I do well specify a valid target album (this fields is set to blank after I submit the form).
Any help/hint appreciated, @plegall

image

Jerome Toutee

@jtoutee
Copy link
Author

jtoutee commented Sep 14, 2022

Happened again today, very strange : could add 4 videos norma;lly and then the error is then again ! And once the error is there, no way to get back to normal, any further addition will show the same error :-(

@phil78500
Copy link

Hi,
I have the same issue.
Does someone have a solution?
Thanks

@jtoutee
Copy link
Author

jtoutee commented Feb 12, 2023

Hi, I have the same issue. Does someone have a solution? Thanks

Hi phil,
I think I found the exact circunstances of the issue : it is when your Youtube video is under the form of short video, with 'shorts' in the path, like this one : https://www.youtube.com/shorts/a3JL0uK-MeI
In this case the workaround is to play the video, then righ-click on the video and use the option to copy the URL of the video. It will give you another URL (for the same video) this time without the short keyword in the path, in my example : https://youtu.be/a3JL0uK-MeI and with this URL I do not encounter the issue any longer !
URL is almost the same except that www.youtube.com turns into youtube.be and there is no /shorts/ in the path.
(when I have time I will learn PHP and propose myself a correction to the code to address this issue).
Would be interested to hear from you if you confirm my finding.

@phil78500
Copy link

Thanks jtoutee, it was the issue.

@bersierj
Copy link

bersierj commented Nov 2, 2024

I have changed the code to work with https://youtube.com/shorts/ in functions.inc.php

case 'youtube':
{
  parse_str($url['query'], $url['query']);

  // Prüfe auf "shorts" URLs
  if (strpos($url['path'], '/shorts/') === 0) {
    $url['path'] = explode('/', $url['path']);
    $video['video_id'] = $url['path'][2]; // Extrahiere die Video-ID
  } elseif (!empty($url['query']['v'])) {
    $video['video_id'] = $url['query']['v'];
  } else {
    return false; // Video-ID konnte nicht gefunden werden
  }
}

@jtoutee
Copy link
Author

jtoutee commented Nov 3, 2024

Hi bersierj,

Thanks, I have just tested it, updated function.inc.php in /public_html/piwigo/plugins/gvideo/include

It works well but I have the following Notice and Warning when I add the short video (line 32 is the line with parse_str):

`Notice: Undefined index: query in /home/choeu530/public_html/piwigo/plugins/gvideo/include/functions.inc.php on line 32

Warning: Cannot modify header information - headers already sent by (output started at /home/choeu530/public_html/piwigo/plugins/gvideo/include/functions.inc.php:32) in /home/choeu530/public_html/piwigo/include/page_header.php on line 99`

Not sure why and if it is a problem ? (new to php)

Thanks anyway !

@bersierj
Copy link

bersierj commented Nov 3, 2024

Enclosed I send you the whole file.
I have added the .txt extension, please remove it.
functions.inc.php.txt

@jtoutee
Copy link
Author

jtoutee commented Nov 3, 2024

Thanks but it is exactly the same I built with adding your new case structure. Just to be 100% sure I however uploaded your full version (removed the .txt) and I still have the same Notice and Warning, but it works :-)
Just weird that I do have those warnings and not you...

@bersierj
Copy link

bersierj commented Nov 3, 2024

In which logs you have the error?
I can‘t see errors

@jtoutee
Copy link
Author

jtoutee commented Nov 3, 2024

In the GUI, the web page itself. See the attached screenshot.
2024-11-03 17 00 19 Le web des Toutée à St-Bruno (

@bersierj
Copy link

bersierj commented Nov 4, 2024

Hi Jtoutee
I don't have this errror

@jtoutee
Copy link
Author

jtoutee commented Nov 4, 2024

Hi bersierj,
Well this is strange but not a big deal.
Do you intend to push your fix in the next Piwigo release ?
That would be nice !
Thanks again !

@bersierj
Copy link

bersierj commented Nov 5, 2024

Sorry i am only Customer, Not the maintener

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

3 participants