Hi everybody.

I had a case with a client, who copy pasted partial url's of youtube videos, and because we were using fckeditor they would not see the broken video inside it. Although they could click "view source" and remove the code from there, they requested us a better solution.

The only thing i could came up with was to test if the id found using preg_match inside MediaInternetYouTubeHandler's function "parse" was that of a valid video. For this I used the Google Data API, using the API call "Retrieving a specific video entry" - documentation here: http://code.google.com/apis/youtube/2.0/developers_guide_php.html#Unders.... I then test if the headers contain the 200 OK value, or not. If not I do not add the video to the library, and also throw a MediaInternetValidationException about the invalid ID.

I think this is a useful functionality, and could be included in the module, so I am pasting the patch here.

media_youtube_validate.patch1.03 KBmariancalinro
Members fund testing for the Drupal project. Drupal Association Learn more


mikeytown2’s picture

Status: Needs review » Reviewed & tested by the community

Works for me!

aaron’s picture

committed that, awesome. Thanks, mariancalinro

aaron’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

corrected the message