Sign up here and you can log into the forum!

Ability to play videos from a website

Discussion, features, plugins--everything about zoster's UMSP UPnP Media Server software

Ability to play videos from a website   

Postby biomedica » Wed Apr 04, 2012 6:45 pm

Hi everybody,

There is a Portuguese news channel that has a lot of news that are always being updated. They publish the videos in mp4 format which is compatible with the box. I have tried to retrieve the source code for this script, however I was not able to get the feed. It seems there is a javascript function called feed() which points to a PHP file in the server. From my understanding that function retrieves the latest videos and presents it as a list of links. Is there a way we could extract those links into an UMSP plugin?

The website is http://i.rtp.pt. Then in order to get the videos, you have to click on the following:

Vídeos
Notícias
Últimas

After clicking on those links you will retrieve the list of the videos available.

Your help would be really appreciated.

Thanks
biomedica
DLX'er
 
Posts: 83
Joined: Tue Oct 12, 2010 9:14 pm

Re: Ability to play videos from a website   

Postby Gui » Tue Apr 17, 2012 6:12 am

Hey all,

I'm just a beginner and probably should exist different/better approaches but this is what I've done:

I went to http://i.rtp.pt -> Videos -> Notícias -> Últimas and with Firebug for Firefox i analyzed the page and like biomedica mentioned I've found that POST listaultimos.php retrieves the latest videos.
Then I've inspected the POST parameters :
area=News (Notícias)
sk=2 (videos)
tm= (category) Recent don have category so it shows empty value

What give's me this link : http://i.rtp.pt/listaultimos.php?area=News&sk=2

After that i look after the categories:
tm=2 (Saúde) http://i.rtp.pt/listaultimos.php?area=News&sk=2&tm=2
tm=3 (Desporto) http://i.rtp.pt/listaultimos.php?area=News&sk=2&tm=3
etc...

Then i had to preg_match the desired values so i used this regex:
Code: Select all
'#<a.*?href\s*=\s*["\']([^"\']+)[^>]*>\s*<img.*?src\s*=\s*["\']([^"\']+)[^>]*>\s*<h6>(.*?)<\/h6>(.*?)<\/a>#s'


I had to use the "s" (enables "single-line mode") modifier to scrap it.

And then i just had to build the pulgin.
Observations:
Had to urlencode the 'id' of the cats (area=News&sk=2&tm=2)
Had to utf8_encode the titles in order to show the accentuation correctly

You can download the plugin here: http://forum.wdlxtv.com/viewtopic.php?f=53&t=6897

Sorry for my bad English.

Abraço,
Gui
User avatar
Gui
Developer
 
Posts: 161
Joined: Wed Jan 11, 2012 4:19 pm
Location: Hellgarve

Re: Ability to play videos from a website   

Postby biomedica » Tue Apr 17, 2012 6:55 am

Wow this is awesome!!! I am going to try it tonight when I get home. Thanks for taking the time.
biomedica
DLX'er
 
Posts: 83
Joined: Tue Oct 12, 2010 9:14 pm


Return to UMSP Media Server

Who is online

Users browsing this forum: No registered users and 2 guests