Canalplus Plugin - Ask for help.

We want to create a plugin for Canalplus Player... we need some help &
Hi,
This was originally an answer to the post "Arte.tv Plugin"
[http://forums.plexapp.com/index.php?showtopic=4843](http://forums.plexapp.com/index.php?showtopic=4843)

But I decided to start a new post.

Rongnan ask for a plugin for Canal Plus Player
Canal plus : [http://player.canalplus.fr/#/selection-can...incontournables](http://player.canalplus.fr/#/selection-canal/les-incontournables)

So, I'm having a look at the Canalplus player...
It's barely possible to do something. I just need a bit of help with XML parsing and Coding.
I'm a newbie, but I think I can help.

First,
We got the url of the XML that list all the different theme (this could the first menu of the plugin) :
[http://webservice.canal-plus.com/rest/bigplayer/initPlayer](http://webservice.canal-plus.com/rest/bigplayer/initPlayer)

Inside this one you can find :

<?xml version="1.0" encoding="UTF-8"?><br />
<INIT_PLAYER><br />
<RECHERCHE><br />
<PUB><br />
<PAVE>recherchep</PAVE><br />
</PUB><br />
</RECHERCHE><br />
<MES_VIDEOS/><br />
<THEMATIQUES><br />
<THEMATIQUE SELECTION_CANAL="OUI"><br />
<ID>3</ID><br />
<NOM>SELECTION CANAL</NOM><br />
<URL_RACINE>/pid1744-c-accueil.html?</URL_RACINE><br />
<COULEUR>#FFFFFF</COULEUR><br />
<RUBRIQUAGE><br />
<UNIVERS/><br />
</RUBRIQUAGE><br />
<PUB><br />
<INTERSTITIEL/><br />
</PUB><br />
<SELECTIONS><br />
<SELECTION><br />
<ID>1</ID><br />
<NOM>LES INCONTOURNABLES</NOM><br />
<PUB><br />
<PAVE>selectionp</PAVE><br />
</PUB><br />
</SELECTION><br />
</SELECTIONS><br />
</THEMATIQUE><br />
<THEMATIQUE><br />
<ID>4</ID><br />
<NOM>SPORT</NOM><br />
<URL_RACINE>/pid1747-c-sport.html?</URL_RACINE><br />
<COULEUR>#33FF33</COULEUR><br />
<RUBRIQUAGE><br />
<UNIVERS>SPORT</UNIVERS><br />
</RUBRIQUAGE><br />
<PUB><br />
<INTERSTITIEL/><br />
</PUB><br />
<SELECTIONS><br />
<SELECTION><br />
<ID>2</ID><br />
<NOM>LES INCONTOURNABLES</NOM><br />
<PUB><br />
<PAVE>sportp</PAVE><br />
</PUB><br />
</SELECTION><br />
<SELECTION><br />
<ID>73</ID><br />
<NOM>LES PLUS RECENTES</NOM><br />
<PUB><br />
<PAVE>sportp</PAVE><br />
</PUB><br />
</SELECTION><br />
<SELECTION><br />
<ID>72</ID><br />
<NOM>LES PLUS VUES</NOM><br />
<PUB><br />
<PAVE>sportp</PAVE><br />
</PUB><br />
</SELECTION><br />
<SELECTION><br />
<ID>3</ID><br />
<NOM>TOUT LE FOOTBALL</NOM><br />
<PUB><br />
<PAVE>sportp</PAVE><br />
</PUB>....etc...



With that we have to parse the and of the different .
For example : The "Theme" number 1 (1) will be entitled "LES INCONTOURNABLES" (LES INCONTOURNABLES)
or : The "Theme" number 73 (73) will be entitled "LES PLUS RECENTES" (LES PLUS RECENTES) (aka in English : the most recent.)

This will point to the second menu of the plugin which is the list of videos from a specific theme
The url then used for that is :
[http://webservice.canal-plus.com/rest/bigplayer/getMEAs/1](http://webservice.canal-plus.com/rest/bigplayer/getMEAs/1) (the 1 at the end is the ID of the Theme we want... it could have been of course 73 ;) )

inside this new xml you can find the different shows (called MEA here) :

<?xml version="1.0" encoding="UTF-8"?><br />
<MEAS><br />
<MEA><br />
<ID>243452</ID><br />
<TYPE>VOD STREAM</TYPE><br />
<INFOS><br />
<DESCRIPTION><br />
<![CDATA[Du lundi au vendredi retrouvez le meilleur de tous les sports partout dans le monde.]]><br />
</DESCRIPTION><br />
<NB_VUES>1399</NB_VUES><br />
<NOTE><br />
<AUTORISER>OUI</AUTORISER><br />
<MOYENNE>4</MOYENNE><br />
<NB_VOTES>5</NB_VOTES><br />
</NOTE><br />
<TITRAGE><br />
<TITRE><br />
<![CDATA[Zapsport]]><br />
</TITRE><br />
<SOUS_TITRE><br />
<![CDATA[19/05]]><br />
</SOUS_TITRE><br />
</TITRAGE><br />
</INFOS><br />
<MEDIA><br />
<IMAGES><br />
<GRAND>http://media.canal-plus.com/wwwplus/image/1/12/1/ZAPSPORT_EMISSION_GENERIQUE_1_image_H.jpg</GRAND><br />
<PETIT>http://media.canal-plus.com/wwwplus/image/1/12/1/ZAPSPORT_EMISSION_GENERIQUE_1_image_L.jpg</PETIT><br />
</IMAGES><br />
</MEDIA><br />
<RUBRIQUAGE><br />
<UNIVERS>SPORT</UNIVERS><br />
<RUBRIQUE>ZAPSPORT</RUBRIQUE><br />
<CATEGORIE>EMISSION</CATEGORIE><br />
</RUBRIQUAGE><br />
</MEA><br />
<MEA><br />
<ID>243393</ID><br />
<TYPE>VOD STREAM</TYPE><br />
<INFOS><br />
<DESCRIPTION><br />
<![CDATA[Le meilleur de toutes les chaînes, tous les jours.<br />
Emission du 19 mai 2009]]><br />
</DESCRIPTION><br />
<NB_VUES>24344</NB_VUES><br />
<NOTE><br />
<AUTORISER>OUI</AUTORISER><br />
<MOYENNE>4.06</MOYENNE><br />
<NB_VOTES>54</NB_VOTES><br />
</NOTE><br />
<TITRAGE><br />
<TITRE><br />
<![CDATA[Zapping]]><br />
</TITRE><br />
<SOUS_TITRE><br />
<![CDATA[19/05/09]]><br />
</SOUS_TITRE><br />
</TITRAGE><br />
</INFOS><br />
<MEDIA><br />
<IMAGES><br />
<GRAND>http://media.canal-plus.com/wwwplus/image/6/20/1/ZAPPING_EMISSION_090519_CAN_89460_image_H.jpg</GRAND><br />
<PETIT>http://media.canal-plus.com/wwwplus/image/6/20/1/ZAPPING_EMISSION_090519_CAN_89460_image_L.jpg</PETIT><br />
</IMAGES><br />
</MEDIA><br />
<RUBRIQUAGE><br />
<UNIVERS>DOCUS ET INFOS</UNIVERS><br />
<RUBRIQUE>ZAPPING</RUBRIQUE><br />
<CATEGORIE>EMISSION</CATEGORIE><br />
</RUBRIQUAGE><br />
</MEA><br />
<MEA><br />
<ID>243121</ID><br />
<TYPE>VOD PROG</TYPE><br />
<INFOS><br />
<DESCRIPTION>



So, here we can parse the infos of the many shows.
Example :
The show which ID is "243452" (243452) is entitled "Zapsport" ().
There is a description (),
and some thumbnails (Big (GRAND) and Small (PETIT)) (http://media.canal-plus.com/wwwplus/image/6/20/1/ZAPPING_EMISSION_090519_CAN_89460_image_H.jpghttp://media.canal-plus.com/wwwplus/image/6/20/1/ZAPPING_EMISSION_090519_CAN_89460_image_L.jpg).

There's no url for the video, and we need to parse another xml to find it.
this url is :
[http://webservice.canal-plus.com/rest/bigp...eosLiees/243452](http://webservice.canal-plus.com/rest/bigplayer/getVideosLiees/243452) (243452 at the end is the ID of the show :) )

Inside the xml we will find the url if the video :

<?xml version="1.0" encoding="UTF-8"?><br />
<VIDEOS><br />
<VIDEO><br />
<ID>243452</ID><br />
<TYPE>VOD STREAM</TYPE><br />
<INFOS><br />
<DESCRIPTION><br />
<![CDATA[Du lundi au vendredi retrouvez le meilleur de tous les sports partout dans le monde.]]><br />
</DESCRIPTION><br />
<NB_VUES>1420</NB_VUES><br />
<AUTEUR><br />
<![CDATA[CANAL+]]><br />
</AUTEUR><br />
<PARTIE>1</PARTIE><br />
<CONTENU_LIE><br />
<LIBELLE/><br />
<URL/><br />
</CONTENU_LIE><br />
<NOTE><br />
<AUTORISER>OUI</AUTORISER><br />
<MOYENNE>4</MOYENNE><br />
<NB_VOTES>5</NB_VOTES><br />
</NOTE><br />
<PUBLICATION><br />
<DATE>19/05/2009</DATE><br />
<HEURE>19:30:00</HEURE><br />
</PUBLICATION><br />
<TITRAGE><br />
<TITRE><br />
<![CDATA[Zapsport]]><br />
</TITRE><br />
<SOUS_TITRE><br />
<![CDATA[19/05]]><br />
</SOUS_TITRE><br />
</TITRAGE><br />
</INFOS><br />
<RUBRIQUAGE><br />
<UNIVERS>SPORT</UNIVERS><br />
<RUBRIQUE>ZAPSPORT</RUBRIQUE><br />
<CATEGORIE>EMISSION</CATEGORIE><br />
</RUBRIQUAGE><br />
<MEDIA><br />
<IMAGES><br />
<GRAND>http://media.canal-plus.com/wwwplus/image/1/12/1/ZAPSPORT_EMISSION_GENERIQUE_1_image_H.jpg</GRAND><br />
<PETIT>http://media.canal-plus.com/wwwplus/image/1/12/1/ZAPSPORT_EMISSION_GENERIQUE_1_image_L.jpg</PETIT><br />
</IMAGES><br />
<VIDEOS><br />
<BAS_DEBIT>rtmp://vod-fms.canalplus.fr/ondemand/videos/0905/ZAPSPORT_EMISSION_090519_AUTO_3152_43_video_L.flv</BAS_DEBIT><br />
<HAUT_DEBIT>rtmp://vod-fms.canalplus.fr/ondemand/videos/0905/ZAPSPORT_EMISSION_090519_AUTO_3152_43_video_H.flv</HAUT_DEBIT><br />
<HD>rtmp://vod-fms.canalplus.fr/ondemand/videos/0905/ZAPSPORT_EMISSION_090519_AUTO_3152_43_video_HD.mp4</HD><br />
</VIDEOS><br />
</MEDIA><br />
<PUB><br />
<PAVE>sportp</PAVE><br />
<BILLBOARD>sportb</BILLBOARD><br />
<HABILLAGE><br />
<VISUEL/><br />
<DESTINATION/><br />
</HABILLAGE><br />
</PUB><br />
</VIDEO><br />
</VIDEOS>



There you can find the various URL of the video.
a Low bandwidth version (rtmp://vod-fms.canalplus.fr/ondemand/videos/0905/ZAPSPORT_EMISSION_090519_AUTO_3152_43_video_L.flv)
a High bandwith version (rtmp://vod-fms.canalplus.fr/ondemand/videos/0905/ZAPSPORT_EMISSION_090519_AUTO_3152_43_video_H.flv)
and even a HD one ;) (rtmp://vod-fms.canalplus.fr/ondemand/videos/0905/ZAPSPORT_EMISSION_090519_AUTO_3152_43_video_HD.mp4)

And voila !
You just have to be aware of the accent and everything... french is a weird language !

I'm waiting for your help ! Thanks.

Hey!

I just finished working on a Canal Plus plugin. For now I didn’t test it a lot, just with a few videos in different category, but it seems to work. It’s quite limited, but the basic is here : you can choose a category (“Humour”, “Musique”, “Sport”), then a sub-category, and finally the list of the videos in it.

I don’t have any merit though, I took most of The Escapist plugin as a base and built by looking how it was done. As for the Canal Plus website, I used a wonderful XBMC plugin (available here : http://passion-xbmc.org/tpmod/?dl)) which unfortunately doesn’t work with Plex, to see how the website was traversed.

But you found a better way to retrieve the URL of the videos, so I used that. However there is one problem : the URL provided in this XML file use the RTMP protocol, which as far as I know is not supported by Plex. So I had to do some replacement to get an URL with the HTTP protocol, but it seems to work.



So, yeah, if you’re interested I could give you the little code I wrote and we could try to make it better. For now I think I’ll just go to sleep, it’s 2AM and even if I was inspired by already existing code, it wasn’t easy. Good night!

Cool, Thanks !



I’ll study it and will try to convert it for Plex.

I’ll let you know guyz when it’ll be done.



:wink:

That’s not what I said :smiley: .

I already wrote a plugin compatible for Plex, and it works more or less well (it can play all the videos, it’s the most important I guess), but it is quite limited apart from that. I asked if you wanted to see the code I wrote so that we could team up and add new functionalities. It’s better to do that than restart from the beginning, I don’t think the code I wrote is THAT bad :lol: .

If you want to do it all by yourself, that’s fine too, of course. Keep us informed!




oh sorry... I was a bit tired...
I've read you wrong.

We can team up, but I'm a newbie, I don't know anything about python.
But if I can help... for sure I'll do !

Oh, don’t worry about that. I didn’t know anything about Python a week ago either. I just read the tutorial on the official website, took a look at The Escapist plugin, and that was enough. Plex Media Server’s API is surprisingly easy to use. Well, that and the fact that The Escapist plugin was used as a basis for this one and already did part of the work.



So anyway, here’s the plugin. In case you don’t know, you have to put the .bundle in ~/Library/Application Support/Plex Media Server/Plug-ins. Don’t hesitate to test it, see what it lacks, and tell me or modify the code yourself and reupload it if you can.

For now the plugin allow access to HQ and LQ videos. I’m not sure HD videos are available trough HTTP, I’ll have to find one first : most of the videos are not available in HD at all anyway.



And of course, if anyone else want to test it or modify it, you’re more than welcome too. It would be nice to know if it works outside France. I don’t think there are any geographical restriction, but I’m not sure.



Oh, and I need to find better images for the menus. The one I used here are just placeholders.

It must be too early, I read this as “Cannabis Plugin”…



You're a king man !
You were so fast... BRAVO !

I can do easily the design you need.
I did a first quick update and change the icon and background to be more "Canal plus"-esque. ;)

Preview here :

http://bayimg.com/image/oaabmaaca.jpg



The version 0.2 of the bundle is here : CanalPlus.bundle.zip (25.7 KB)

Thanks again, that was exactly the plugin I wanted !!
You made my day man.

Here is the 0.3 version !



I add the categories backgrounds & folders. :wink:

http://bayimg.com/image/caalgaaca.jpg



http://bayimg.com/image/caalpaaca.jpg



Here is the bundle : CanalPlus.0.3.bundle.zip (373 KB)

Wow, that is really nice! The plugin looks much better now, and I like how each category has its own icon and its own background. It really makes navigating in the menus a more pleasant experience.



I’m probably going to add it to the list of Unsupported Plugins, if you don’t think you’ll add anything else (and you’ve done quite a lot of work already). That way people will be able to download it, test it and tell us what they think. Could you change the title of the topic so that people know where to post? After enough testing and if it’s good enough we could even try to push it to the App Store for everyone to enjoy.



Ah, I don't know what a Cannabis Plugin would do, though it would probably be interesting...Plex is already a good way to chill out with your favourite videos anyway :lol:.


Yeah, it'll be good to submit it to the Unsupported Plugins !
I'll let you do that, you seem to know what you're talking about. ;)

Again, thanks a lot for your help.

Heu... I must be stupid, but I don't know how to change the title of the topic... :unsure:

App store... yes ! great !

Here it goes.



For the topic’s title, maybe you can’t change it, some forums allow it, some don’t. I put a link to this topic in the wiki’s page for the plugin anyway, so people will know where to post.



Now we’ll just have to wait for people to try it and tell us what they think. I’ll also have to do some researches for videos available in HD. If they can be downloaded with HTTP, it would be nice to add them to the plugin when they’re available.

Thanks man you rock !



I created an official topic for the plugin here :

http://forums.plexapp.com/index.php?showtopic=6613



And I updated the link in the wiki. :wink:

Looking great!

Is this still working? I am looking at CanalPlus and when I try to invoke the URL for Salut les terriens of today I get rejected for all of the video qualities.



my original URL is

rtmp://vod-fms.canalplus.fr/ondemand/videos/0909/SALUT_LES_TERRIENS_EMISSION_090926_AUTO_4331_43_video_HD.mp4



and this was denied

http://vod-flash.canalplus.fr/WWWPLUS/STREAMING/SALUT_LES_TERRIENS_EMISSION_090926_AUTO_4331_43_video_HD.mp4



any idea??



I got the information from this feed:



http://www.canalplus.fr/rest/bootstrap.php?/bigplayer/getVideosLiees/279349



Thanks



Yeah I know there is a problem of rejection.
In fact I'm not the coder of this plugin. [Meuhcoin](http://forums.plexapp.com/index.php?/user/2973-meuhcoin/) helped me on the code.

I don't really know how to solve this problem.
But if any of you wants to have a look at the code, you're welcome !

[crxs](http://forums.plexapp.com/index.php?/user/5241-crxs/) may be a good help for that,
I know he changed the code of the [Arte+7](http://wiki.plexapp.com/index.php/Arte%2B7) plugin streaming problem.
[crxs](http://forums.plexapp.com/index.php?/user/5241-crxs/) if you read this post... help ! ;)

Geekbarns.

Do you use the latest version ? Take a look at the wiki .

I recently updated the plugin because it indeed didn’t work anymore. URLs in the XML files are all wrong, so we have to use Canal+'s player on their website. That means there are less controls, but at least everything works.

I watched “La semaine du petit journal” yesterday and it was working correctly. I’ll try that again but I think you just have an old version.



You probably should have posted in this topic, it’s more up to date :slight_smile: .



Actually I noticed the other thread after I posted my message.

It seems like you are doing a backdoor use of their plugin using another backdoor

http://www.canalplus.fr/c-infos-documentaires/pid1830-c-zapping.html?vid=

I think that the url IS valid but RTMP is very capricious and it can be painful to find the right url for the video to play.

On the other hand, have you considered looking inside the player ? It must be doing something with videoId to figure out what is the video url. It was 2am so I did not investigate much further but it seems to be that we could figure out that url looking at wireshark capture as well.

What do you mean, “backdoor use of their plugin”? Whose plugin, I wrote that one with the help of geekbarns :lol: .



There’s nothing special with the plugin, the only “strange” thing it does is using the Zapping video page to display any video. But that doesn’t change anything for someone using the plugin with Plex.



As for the URLs that are or are not valid, here is what I said in the other tread to explain that:


So that's what I did because it is way easier like that. Though you're right, there may be a way to find the URL to the video using their player. Not sure though, if it's happening somewhere else I don't know how I could find it. Let's see...Hm, the player "flashvars" have a crapload of URLs but I don't see any that could be useful... If it can't be extracted from the page I don't know how it could be figured out.

So that’s what I did because it is way easier like that. Though you’re right, there may be a way to find the URL to the video using their player. Not sure though, if it’s happening somewhere else I don’t know how I could find it. Let’s see…Hm, the player “flashvars” have a crapload of URLs but I don’t see any that could be useful… If it can’t be extracted from the page I don’t know how it could be figured out.



Yes and no. I am trying to write the same plugin for PlayOn and they do not support anythink like “WebVideo” so my alternative is to reverse engineer the SWF and figure out the feed encryption. I am sure it comes from there since if you look in the referer field you can see it. My experience with other websites is that the really good stuff is hidden in the player, the key here is the videoId, I believe.



I’ll let you know if I make any breakthrough since my findings could directly be applied to your plugin as well.