Download & Extend

Validate the youtube ID before adding to the library

Project:Media: YouTube
Version:7.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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.

AttachmentSize
media_youtube_validate.patch1.03 KB

Comments

#1

Status:needs review» reviewed & tested by the community

Works for me!

#2

committed that, awesome. Thanks, mariancalinro

#3

Status:reviewed & tested by the community» fixed

#4

Status:fixed» closed (fixed)

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

nobody click here