You are here:  » Veoh Video RSS

Support Forum



Veoh Video RSS

Submitted by King Bukkum on Mon, 2009-01-26 14:26 in

Hi,

I have a problem. I try to get the items from this feed: {link saved}

But it isnt working. I use xml|RSS/CHANNEL/ITEM/ but the items do not appear.... What am I doing wrong?

Thanks for your help!

Submitted by support on Mon, 2009-01-26 14:51

Hi,

There are currently no items in that feed!

If you go to the URL: {link saved}

...and then use View > Source in your browser, you will see that no ITEM elements exist...

Cheers,
David.

Submitted by King Bukkum on Mon, 2009-01-26 15:38

Well David,

I do see items in the sourcecode. You need to scroll down. The are several items in the source code.....

Submitted by support on Mon, 2009-01-26 15:52

Hi,

It seems there are no items being returned when the URL is requested by a non-browser user-agent - I'm just trying to work out the requirements, bear with me...!

Cheers,
David.

Submitted by support on Mon, 2009-01-26 16:19

Hi again,

I have discovered that their RSS feed only returns items if your web browser includes a particular veoh.com cookie in the request; so this is going to make it very difficult to request this feed using anything other than a standard web browser...

If you need to use this feed, it would be worth contacting the publisher to make them aware of this issue as there are no easy work-arounds i'm afraid!

Cheers,
David.

Submitted by King Bukkum on Mon, 2009-01-26 19:38

That's very strange because I have deleted all cookies and accessed the url {link saved} directly and I do see the items....

Submitted by King Bukkum on Wed, 2009-01-28 10:09

Do you know maybe something more what is wrong?

Submitted by support on Wed, 2009-01-28 12:27

Hi,

Could you check the cookies again from your end - I have tried on 2 different browsers and it definitely seems to be cookie related - which makes it virtually impossible to request the feed automatically...

When deleting cookies, don't include the www. as their cookies are based on the domain veoh.com (in Firefox, go to Edit > Preferences > Privacy > Show Cookies and then type veoh.com in the box...

Cheers,
David.

Submitted by Huggie on Wed, 2009-01-28 20:07

If you request the feed with no cookies you'll get no items displayed, but a cookie is also sent at this time. A refresh of the page will then display the items.

The cURL library (if compiled in PHP) can do this for you.

I've written the following for you and it works a treat...

<?php
// Use MagicParser
require("MagicParser.php");
// Feed URL
$url "{link saved}";
// File to save cookies in (a private folder is more secure)
$cookie_file ".cookies";
// Make the initial call to get only the header to extract the cookies
$ch1 curl_init();
curl_setopt($ch1CURLOPT_URL$url);
curl_setopt($ch1CURLOPT_HEADERTRUE);
curl_setopt($ch1CURLOPT_NOBODYTRUE);
curl_setopt($ch1CURLOPT_RETURNTRANSFERTRUE);
curl_setopt($ch1CURLOPT_COOKIEJAR$cookie_file);
curl_exec($ch1);
curl_close($ch1);
// Make the second call with the cookies to get the entire feed
$ch2 curl_init();
curl_setopt($ch2CURLOPT_URL$url);
curl_setopt($ch2CURLOPT_HEADERFALSE);
curl_setopt($ch2CURLOPT_RETURNTRANSFERTRUE);
curl_setopt($ch2CURLOPT_COOKIEFILE$cookie_file);
$xml curl_exec($ch2);
curl_close($ch2);
// Call MagicParser with an XML string
MagicParser_parse("string://" $xmlmyRecordHandler"xml|RSS/CHANNEL/ITEM/");
// Callback function
function myRecordHandler($item) {
   
print_r($item);
}
?>

To see it in action visit {link saved}

Regards
Rich

Submitted by support on Wed, 2009-01-28 20:14

Hi Rich,

Good solution. If you are requesting this feed on an occasional basis it's probably fine as is; but if you are likely to be requesting it frequently would it be worth checking for the appropriate .cookie file and only making the double-request if it does not exist...

Or taking it a step further; make the inital request and look at the length of the response. If it is less than 1K (indicating an empty feed), then make the second request...

Cheers!
David.

Submitted by Huggie on Wed, 2009-01-28 20:38

Totally agree.

It was more a proof of concept than an actual solution.

Rich