script.module.urlresolver development

  Thread Rating:
  • 7 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
t0mm0 Offline
Fan
Posts: 486
Joined: Mar 2011
Reputation: 8
Location: UK
Post: #16
rogerthis Wrote:Big THANK YOU for this.

Had a quick look and it looking really good.

thanks!

rogerthis Wrote:You don't have this in your repository.
Is the plan to get the two scripts script.module.t0mm0.common and script.module.urlresolver into the official xbmc repository?

yes it is not in a repo at the moment because it is under heavy development. once it stabilises a bit i'll bung it in my repo, and hopefully once it's tested by lots of people it can go into the official one. i'm wary of distributing it too widely while it is still in such a state Wink

t0mm0
find quote
rogerthis Offline
Donor
Posts: 216
Joined: Apr 2011
Reputation: 1
Location: Connacht
Post: #17
I have been trying to make some url reslovers but I'm failing miserable.
What guides did you use to get started? Is there any other apps other that wireshark that you use?
find quote
t0mm0 Offline
Fan
Posts: 486
Joined: Mar 2011
Reputation: 8
Location: UK
Post: #18
rogerthis Wrote:I have been trying to make some url reslovers but I'm failing miserable.
What guides did you use to get started? Is there any other apps other that wireshark that you use?

i hardly ever need to use wireshark. you can work out what's going on on most sites with the developer tools in chrome (or firebug in firefox) and that is much more user friendly too. you only need to resort to wireshark for low level protocol sniffing which is hardly ever required!

if you want to give us a clue about the site you are trying to work on we might be able to point you in the direction of what to look for, or you could always try looking at a site for which code already exists and try and work out how the dev got to the answer.

t0mm0
find quote
rogerthis Offline
Donor
Posts: 216
Joined: Apr 2011
Reputation: 1
Location: Connacht
Post: #19
Thanks getting back so quick.

The site is vidreel
http://vidreel.com/video/OTM3NDM0/ which redirects to http://vidreel.com/human/OTM3NDM0/ straight away. I know that I have to include
Code:
"name" : "watch" and "action" : "#"
but how do I know what else needs to be included eg cookies, Referer. Is it trial and error?

Here is the code for the video.
Code:
<script type='text/javascript'>
var so = new SWFObject('../../9.swf','ply','600','340','9','#ffffff');
so.addParam('allowfullscreen','true');
so.addParam('allowscriptaccess','always');
so.addParam('wmode','transparent');
so.addVariable('file','08022eb20345a3d9fd77b34f087a97f8.mp4');
so.addVariable("skin", "../../dangdang.swf");
so.addVariable('bufferlength','5');
so.write('mediaspace');
</script>

Is the link?
Code:
http://vidreel.com/9.swf:08022eb20345a3d9fd77b34f087a97f8.mp4

Do I need to include the other parameters for the file to play?
find quote
t0mm0 Offline
Fan
Posts: 486
Joined: Mar 2011
Reputation: 8
Location: UK
Post: #20
so here is what i just did when taking a quick look at this site.....

rogerthis Wrote:Thanks getting back so quick.

The site is vidreel
http://vidreel.com/video/OTM3NDM0/ which redirects to http://vidreel.com/human/OTM3NDM0/ straight away. I know that I have to include
Code:
"name" : "watch" and "action" : "#"
but how do I know what else needs to be included eg cookies, Referer. Is it trial and error?

in a incognito window (so you don't get any old cookies) of chrome, open dev tools (ctrl+shit+i) then load the page. as you say it is diverted to the /human page. right click on the 'continue to video' button and choose 'inspect element' and you will be taken to the html code for the button. you'll see that it is in a html form, but that the button itself is just an <a> tag which just links back to the original page. weird. unless there is some fancy javascript going on the form isn't being submitted.

click on the button and look at the top entry ion the network tab of the dev tools. you'll see that sure enough, it is just a GET request. you'll notice that there are some cookies sent (you can ignore all the tracking ones - '__utma', '__utmb' etc. - you'll notice these appear on lots of pages) - 'videohuman' an sometimes 'video'. maybe these are all that is required?

so i test in python. in the 'lib' directory of script.module.t0mm0.common i type python to enter the interactive interpretor and use the Net class with the debug flag enabled to load the page (this is easier than straight urllib2 as it handles cookies etc. with hardly any code required). it gets diverted to the /human page but you can see the cookies being set. so i load the page again, this time it desn't get diverted! so all you have to do is load the url twice, the first time the cookies get set and the second time it loads the real page. you can see my python session here

stage one done!

rogerthis Wrote:Here is the code for the video.
Code:
<script type='text/javascript'>
var so = new SWFObject('../../9.swf','ply','600','340','9','#ffffff');
so.addParam('allowfullscreen','true');
so.addParam('allowscriptaccess','always');
so.addParam('wmode','transparent');
so.addVariable('file','08022eb20345a3d9fd77b34f087a97f8.mp4');
so.addVariable("skin", "../../dangdang.swf");
so.addVariable('bufferlength','5');
so.write('mediaspace');
</script>

Is the link?
Code:
http://vidreel.com/9.swf:08022eb20345a3d9fd77b34f087a97f8.mp4

Do I need to include the other parameters for the file to play?

getting close.

as you noticed the javascript you posted above shows the file name but not the server or protocol - this means it is probably embeded in the swf file so we need to do more work.

pressing the play button on the flash player gives no entries in the network tab of the chrome dev tools so it is probably not just downloading the video via http. that makes it a little tougher.

i decided to use rtmpsrv which comes with rtmpdump and lets you intercept calls to rtmp servers and gives you an rtmpdump command line to use.

(this is on linux, dunno about other os's) first off i run the iptables command that diverts traffic for port 1935 (the rtmp port) to localhost. then run rtmpsrv and press play on the flash player. now don't forget to remove the iptables rule (or prepare to get very confused later!). my terminal output from this process is here.

copy and paste the rtmpdump command line to test - it works!

this gives you all the needed information to play the link in xbmc. the rtmp command line translates to
Code:
rtmp://213.163.74.245/vod/mp4:08022eb20345a3d9fd77b34f087a97f8.mp4 swfUrl=http://vidreel.com/7.swf pageUrl=http://vidreel.com/video/OTM3NDM0/
in xbmc talk. bung that in a .strm file to test and.... yay! that works too Wink

now all you need to do is try a bunch of different videos to see if they all use the same rtmp server, and if not work out how to tell the difference (hint: maybe the different numbered swf files refer to different servers? can you just pick one at random or do you need to use a specific server for a specific video? so many questions - this is where the fun of testing comes in Wink)

hope that helps - shout if you don't follow any of that. obviously it isn't written as a nice tutorial but is literally just notes i took as i was looking at the site. maybe we can turn it into a proper tutorial as part of the docs for this module.....

t0mm0.
find quote
rogerthis Offline
Donor
Posts: 216
Joined: Apr 2011
Reputation: 1
Location: Connacht
Post: #21
t0mm0, thanks so much for all that. I have setup ubuntu on vmware player and installed rtmpdump. I have been trying it with a few site, it's really handy.

But still having problem playing the video in xbmc. I have the .strm working once I removed the mp4: in the middle of the rtmp link
rtmp://213.163.74.245/vod/mp4:08022eb20345a3d9fd77b34f087a97f8.mp4

You have add the two extra variables in the .strm file swfUrl and pageUrl. I tried using this in my python file but no luck:

Code:
item = xbmcgui.ListItem(name.replace('(vidreel)',''))
item.setProperty("swfUrl", swfUrl)
item.setProperty("pageUrl", pageurl)
xbmc.Player(xbmc.PLAYER_CORE_DVDPLAYER).play(finalurl, item)

How did you get these variable names from? Or how did you know which ones to use?
(This post was last modified: 2011-08-03 23:56 by rogerthis.)
find quote
t0mm0 Offline
Fan
Posts: 486
Joined: Mar 2011
Reputation: 8
Location: UK
Post: #22
hi,

rogerthis Wrote:t0mm0, thanks so much for all that. I have setup ubuntu on vmware player and installed rtmpdump. I have been trying it with a few site, it's really handy.

But still having problem playing the video in xbmc. I have the .strm working once I removed the mp4: in the middle of the rtmp link
rtmp://213.163.74.245/vod/mp4:08022eb20345a3d9fd77b34f087a97f8.mp4

hmmm, that may be to do with the version of librtmp you have installed (i am using a very recent build). for me it works either with or without, so i guess leaving it out is cool.

rogerthis Wrote:You have add the two extra variables in the .strm file swfUrl and pageUrl. I tried using this in my python file but no luck:

Code:
item = xbmcgui.ListItem(name.replace('(vidreel)',''))
item.setProperty("swfUrl", swfUrl)
item.setProperty("pageUrl", pageurl)
xbmc.Player(xbmc.PLAYER_CORE_DVDPLAYER).play(finalurl, item)

How did you get these variable names from?

just put the whole thing in the finalurl exactly as you put in the .strm file and you don't need to bother with setProperty() stuff.

i'm not sure where i got the variable names that xbmc uses from, just searching the forum i think.

thanks,

t0mm0
find quote
rogerthis Offline
Donor
Posts: 216
Joined: Apr 2011
Reputation: 1
Location: Connacht
Post: #23
t0mm0, thanks again. It working now. I'm going to work on a few more resolver before I try and add one for your addon. I also need to clean up my code too.
find quote
Temhil Offline
Skilled Python Coder
Posts: 397
Joined: Apr 2008
Reputation: 1
Location: Canada
Post: #24
FYI here is an open source implementation of Megavideo: http://code.google.com/p/python-megavideo-parser/
That could be nice to have it available in the resolver.

[Image: passionxbmc_signature.png]
_____________________________

Repositories Installer: select and install unofficial repositories / TAC.TV: watch videos on TAC.TV
Installer Passion-XBMC: Download and Install Add-ons (pre-Dharma only)

[Image: project_thin_badge.gif]
find quote
t0mm0 Offline
Fan
Posts: 486
Joined: Mar 2011
Reputation: 8
Location: UK
Post: #25
hi temhil,

Temhil Wrote:FYI here is an open source implementation of Megavideo: http://code.google.com/p/python-megavideo-parser/
That could be nice to have it available in the resolver.

yes i remember looking at that a while ago but thanks for reminding me - i will definitely add it and make a resolver plugin to use it.

t0mm0
find quote
reni10 Offline
Junior Member
Posts: 29
Joined: Oct 2008
Reputation: 0
Post: #26
This looks great and exactly what I was looking for to play all the content I have uploaded or imported into my Premium Megaupload account!

I don't seem to be able to install the plugin though?
I get an error saying it has the wrong structure?!?

Any pointers on how to install this would be great as I can help test it...
find quote
rogerthis Offline
Donor
Posts: 216
Joined: Apr 2011
Reputation: 1
Location: Connacht
Post: #27
reni10 Wrote:This looks great and exactly what I was looking for to play all the content I have uploaded or imported into my Premium Megaupload account!

I don't seem to be able to install the plugin though?
I get an error saying it has the wrong structure?!?

Any pointers on how to install this would be great as I can help test it...
These instructions are for a windows based O/S.

1. Download this file https://github.com/t0mm0/xbmc-urlresolve...all/master
2. extract all files
3. go into the t0mm0-xbmc-urlresolver-9753bda folder
4. You will see 3 folders:
[INDENT]plugin.video.t0mm0.test[/INDENT]
[INDENT]script.module.t0mm0.common[/INDENT]
[INDENT]script.module.urlresolver[/INDENT]
5. for each folder, right click and send to - Compressed (zipped) Folder

From there you will have 3 plugins to install. You have to install plugin.video.t0mm0.test last, as it has dependencies for the other 2 plugins.
(This post was last modified: 2011-08-06 10:29 by rogerthis.)
find quote
reni10 Offline
Junior Member
Posts: 29
Joined: Oct 2008
Reputation: 0
Post: #28
rogerthis Wrote:These instructions are for a windows based O/S.

1. Download this file https://github.com/t0mm0/xbmc-urlresolve...all/master
2. extract all files
3. go into the t0mm0-xbmc-urlresolver-9753bda folder
4. You will see 3 folders:
[INDENT]plugin.video.t0mm0.test[/INDENT]
[INDENT]script.module.t0mm0.common[/INDENT]
[INDENT]script.module.urlresolver[/INDENT]
5. for each folder, right click and send to - Compressed (zipped) Folder

From there you will have 3 plugins to install. You have to install plugin.video.t0mm0.test last, as it has dependencies for the other 2 plugins.

Thanks for that but I am on OSX and iOS and tried to compress each file and install but still get the error the structure is incorrect!

Any ideas for OSX?
find quote
rogerthis Offline
Donor
Posts: 216
Joined: Apr 2011
Reputation: 1
Location: Connacht
Post: #29
reni10 Wrote:Thanks for that but I am on OSX and iOS and tried to compress each file and install but still get the error the structure is incorrect!

Any ideas for OSX?

Sorry, can't help with OSX, but I can upload them to dropbox:
http://dl.dropbox.com/u/31328853/plugin....0.test.zip
http://dl.dropbox.com/u/31328853/script....common.zip
http://dl.dropbox.com/u/31328853/script....solver.zip
find quote
reni10 Offline
Junior Member
Posts: 29
Joined: Oct 2008
Reputation: 0
Post: #30
rogerthis Wrote:Sorry, can't help with OSX, but I can upload them to dropbox:
http://dl.dropbox.com/u/31328853/plugin....0.test.zip
http://dl.dropbox.com/u/31328853/script....common.zip
http://dl.dropbox.com/u/31328853/script....solver.zip

Thanks I managed to install from these 3 zips!

It does not seem to work as I thought though, I was expecting it to be able to show me the list of files I have saved in my Premium Megaupload account and then be able to select one of those to play in XBMC.

I inputted my MU account details but when I select MU in the plugin it just plays a video file without giving me any option to select one from my own account!

Hopefully there is a way to change this?

Great plugin though if it works like I want to above?
find quote
Post Reply