A nice feature would be that a form does not get past validation when a user submits a video link that doesn't exist.
Right now when i add youtube.com/no_video as an video link, a youtube player gets embedded on the node without any content.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | youtube_id_validate30052012_update.patch | 828 bytes | vedpareek |
| #4 | Youtube_id_validate30052012.patch | 2.54 KB | vedpareek |
| #1 | validate-youtube-id-1295688-1.patch | 2.11 KB | wbobeirne |
Comments
Comment #1
wbobeirne commentedIssue still exists in latest version, attached a patch for a fix. However, I think someone could probably do better. I had to use a custom error handler that throws an error for warnings because the validation method I used was plugging the video ID in to http://gdata.youtube.com/feeds/api/videos/%VIDEO_ID_HERE% which gives you a 400 error page if it's an invalid video ID. file_get_contents throws a warning at 400 pages which can't be caught in a regular try/catch block. So if anyone wants to make this patch better, be my guest.
Comment #2
wbobeirne commentedComment #3
jec006 commentedWe should check this for both vimeo and youtube.
Both vimeo and youtube return 404's on the actual video page if the video doesn't exist. It would be better to just check that.
We should use drupal_http_request which will return the http response code which can tell us whether it is there or not. file_get_contents doesn't always work on remote urls.
Comment #4
vedpareek commentedComment #5
vedpareek commentedPlease use new version of patch..
Issue still exists in latest version, attached a patch for a fix. I think someone could probably do better. I had to use a custom error handler Please check this patch.
please check this updated patch.
THanks
Comment #6
indigoxela commentedHi,
is somebody still working on this?
Probably it would be a good idea to make the 404 check applicable for all providers, not only for youtube and/or vimeo.
It is easy to add custom providers in additional (custom) modules and validation should work for all of them.
I see no problem in either using get_headers() or drupal_http_request() as last check inside video_embed_field_field_validate() to get the http response code for $item['video_url'] as it is common to all providers. Or am I missing something?
An example for a check (works with 7.x-2.0-beta5 as last check in field validation):
Comment #7
anybodySadly the patch format in #5 is wrong. Should be a unified DIFF please.