Loading ...

VIMEO FIX (17/05/2012) (updated 04/07/2012)

Board index / PHP Melody - Video CMS / PHP Melody 1.6.x (old version)

Forums for the previous PHP Melody version (1.6.x)

Postby mephisto on May 17, 2012 8 pm


vimeo is no longer working, they switched to a new API, version 2.
The old megaloop link doesn't work anymore as of today.

here's an example
the old url we were using
http://vimeo.com/moogaloop/load/clip:41468749
the new one
http://vimeo.com/api/v2/video/41468749.xml

From the VIMEO API section
Making a Video Request

To get data about a specific video, use the following url:
Making the URL
http://vimeo.com/api/v2/video/video_id.output
video_id = The ID of the video you want information for
output = Specify the output type. We currently offer JSON, PHP, and XML formats.

The data returned from this method is the same as what is returned in any video list, except there is only one.

http://developer.vimeo.com/apis/simple#video-request

here's a temporary fix

this is for admin/src/vimeo.php

change target url to
Code: Select all
   $target_url = "http://vimeo.com/api/v2/video/" . $vid_id.".xml";


In the function get_thumb_link($video_data) change thumbnail to thumbnail_small, or thumbnail_medium or thumbnail_large depending on what you need, like in the line below.. (I used thumbnail_small)

Code: Select all
if(preg_match('/<thumbnail_small>(.*?)<\/thumbnail_small>/', $video_data[$i], $matches))


Scroll down to function video_details($video_data, $url, &$info) and change to ....
Code: Select all
function video_details($video_data, $url, &$info)
{

   $arr_length = count($video_data);

   for($i = 0; $i < $arr_length; $i++)
   {
      //   video title
      if(preg_match("/<title>(.*?)<\/title>/", $video_data[$i], $matches) != 0)
      {   
         $info['video_title'] = str_replace('"', '', $matches[1]);
      }
      //   video description
      if(preg_match("/<description>(.*?)<\/description>/", $video_data[$i], $matches) != 0)
      {   
         $info['description'] = str_replace('"', '', $matches[1]);
      }
   
      //   direct link
      if(preg_match("/<url>(.*?)<\/url>/", $video_data[$i], $matches) != 0)
      {
         $info['direct'] = $matches[1];
      }
      //   video id
      if(preg_match("/<id>(.*?)<\/id>/", $video_data[$i], $matches) != 0)
      {
         $info['yt_id'] = $matches[1];
      }
   }
   //   flv
   $info['url_flv'] = get_flv($video_data);
   
   //   thumbnail link
   $info['yt_thumb'] = get_thumb_link($video_data);
}

I added description to this as well since that was missing from the old vimeo src.
For those with a security obsession, you might want to parse description first to to make sure it is secure input, I trust vimeo and I always check/read the descriptions first anyway.
You could also add the video duration now, since it is in the xml response.

This is only a temporary fix, I notified Andrew via bug report. They'll have to come up with a final one if this needs more work, I just changed what I needed. There's no more links to the flv file I see so you'll have to use their player probably, unless Andrew and his team have a trick up their sleeves.

EDIT: one more thing to change
In function get_flv($video_data) You will need to change the value
Code: Select all
nodeId

to
Code: Select all
id


so replace
Code: Select all
      if(preg_match('/<nodeId>(.*?)<\/nodeId>/', $data, $matches) != 0)

with
Code: Select all
      if(preg_match('/<id>(.*?)<\/id>/', $data, $matches) != 0)


Seems to work, see
http://www.totallyfuzzy.net/ourtube/cha ... 22ae8.html
just added that using this fix.
Last edited by mephisto on Jul 04, 2012 9 am, edited 4 times in total.
mephisto
Verified Customer
Verified Customer
 
Posts: 2888
Joined: Sep 30, 2008 8 am
Reputation points: -6

Postby mephisto on May 17, 2012 9 pm


hmm trying to add another video now doesn't work... gives me the "video already in your database" error... while it is definitely not, if I click edit it gives me the previous one... hang on... let me sort this out...

I think this must be related to the flv file location not being set anymore.

The previous video set that location as
Code: Select all
http://vimeo.com/moogaloop/play/clip://?q=sd&type=local&embed_location=

the video ID is missing there because it doesn't find the flv anymore

If I add a new video that will return the same value of
Code: Select all
http://vimeo.com/moogaloop/play/clip://?q=sd&type=local&embed_location=

and phpmelody doesn't like that.. or won't even accept it.

FIXED: added the fix to the post above, see EDIT there.
And just added a series of vimeo videos to test it. Works fine.
Last edited by mephisto on May 18, 2012 2 pm, edited 1 time in total.
mephisto
Verified Customer
Verified Customer
 
Posts: 2888
Joined: Sep 30, 2008 8 am
Reputation points: -6

Postby morane57 on May 18, 2012 9 am


Thank You
User avatar
morane57
Verified Customer
Verified Customer
 
Posts: 399
Joined: Feb 27, 2011 3 pm
Reputation points: 140

Postby Trace on May 18, 2012 10 am


Confirmed working perfectly, thanks a lot :)
User avatar
Trace
Verified Customer
Verified Customer
 
Posts: 2543
Joined: Aug 16, 2010 3 pm
Location: The Netherlands
Reputation points: 1329

Postby Aryan on May 19, 2012 7 pm


thanks mephisto ;)
Aryan
Verified Customer
Verified Customer
 
Posts: 36
Joined: Apr 19, 2010 2 pm
Location: Argentina
Reputation points: 10

Postby mephisto on May 19, 2012 8 pm


you're all welcome. I needed it urgently so.. I might as well share it. Not that it is rocket science anyway ;)
I broke my head over so many APIs out there before, that by now it's starting to become obvious... most of the time.
mephisto
Verified Customer
Verified Customer
 
Posts: 2888
Joined: Sep 30, 2008 8 am
Reputation points: -6

Postby Andrew on May 29, 2012 8 am


Good fix. Made the topic into a "sticky" until it's included in the official package (update).
PHP Melody v3.0
New Series Module? Publish series and episodes right from PHP Melody's Dashboard -->
https://demo.phpmelody.com/admin/series.php
User avatar
Andrew
Founding Developer
 
Posts: 7504
Joined: Jul 07, 2007 1 pm
Reputation points: 428

Postby mephisto on Jul 04, 2012 6 am


your probably also noticed they added this annoying #at=0 to their links on their site
http://vimeo.com/45089420#at=0

Open admin/src/vimeo.php src, at the top

After
Code: Select all
   $video_data = array();

add
Code: Select all
   $tmp_url = explode('#',$url);
   $url = $tmp_url[0];


and it won't annoy you anymore
mephisto
Verified Customer
Verified Customer
 
Posts: 2888
Joined: Sep 30, 2008 8 am
Reputation points: -6

Postby brownbloodz on Aug 13, 2012 12 pm


Thanks for the fix.
User avatar
brownbloodz
Verified Customer
Verified Customer
 
Posts: 1243
Joined: May 01, 2008 8 pm
Reputation points: 261

Postby brownbloodz on Aug 28, 2012 4 pm


It stopped working. Existing videos work but I am not able to add new ones.
User avatar
brownbloodz
Verified Customer
Verified Customer
 
Posts: 1243
Joined: May 01, 2008 8 pm
Reputation points: 261


Who is online

Users browsing this forum: No registered users and 6 guests