Plugins Plugins can make site-specific changes to the proxy's behavior and parsing mechanisms. You can use plugins to overcome limitations of the base proxy script.


Closed Thread
 
LinkBack Thread Tools Display Modes
Old 03-23-2008, 01:55 AM   #1 (permalink)
Member
 
Join Date: Dec 2007
Posts: 91
Phantom
Default Youtube - Fresh new thread...

This is the new code for the youtube update, from steven again. Maby he should own this thread. I feel like I hijacked the youtube plugin lol


The JW Flash mediaplayer
Name mediaplayer.swf to videoplayer.swf and put in your root directory. Copy paste this into notepade and name youtube.com.php and upload to plugins.

Code:
<?php
$options['stripFlash']=true;
function preParse($html,$type){
if($type=='html'&&preg_match('/fullscreenUrl\s\=\s.*video\_id\=(.*)\&.*\&t\=(.*)\&/i',$html,$matches)){
$thumbid_arr=explode('&',basename($matches[1]));
$thumbid=array_shift($thumbid_arr);
$html=preg_replace('#<div id="watch-checker-div">(.*)to.write\("watch-checker-div"\);#is','<object type="application/x-shockwave-flash" data="'.optURL.'videoplayer.swf" height="395" width="480" allowfullscreen="true"><param name="movie" value="'.optURL.'videoplayer.swf" /><param name="flashvars" value="file='.proxifyURL('http://youtube.com/get_video?video_id='.$matches[1].'&t='.$matches[2]).'&image='.proxifyURL('http://i.ytimg.com/vi/'.$thumbid.'/0.jpg').'&type=flv&allowfullscreen=true&autostart=false&fullscreenpage=true&fsreturnpage=true&backcolor=0x000000&frontcolor=0xCCCCCC&lightcolor=0x996600" /><param name="menu" value="false" /></object>'.'<script type="text/javascript">',$html);
}
return$html;
}
?>


Phantom is offline
Country: Canada
 
Old 03-23-2008, 06:20 PM   #2 (permalink)
Junior Member
 
Join Date: Mar 2008
Posts: 9
hi_cannon
Default Re: Youtube - Fresh new thread...

maybe this is because of a incomplete flash plugin, but the current verrsion and past versions does not seem to work with Firefox 3. The mediaplayer.swf doesn't seem to load.
hi_cannon is offline
Country: United States
 
Old 03-23-2008, 10:25 PM   #3 (permalink)
Junior Member
 
Join Date: Mar 2008
Posts: 1
Silentg0d
Default Re: Youtube - Fresh new thread...

The mediaplayer doesnt load as stated above.
Silentg0d is offline
Country: United States
 
Old 03-23-2008, 11:51 PM   #4 (permalink)
Member
 
Join Date: Dec 2007
Posts: 91
Phantom
Default Re: Youtube - Fresh new thread...

I've tested it on firefox 2 and I.E 7 and works fine.
Your problem is firefox 3 which is also beta software.
and I Hardly doubt much school/workplaces are using firefox at all let alone ff3. I don't see this a problem.

Phantom is offline
Country: Canada
 
Old 03-24-2008, 04:21 PM   #5 (permalink)
Junior Member
 
Join Date: Mar 2008
Posts: 9
hi_cannon
Default Re: Youtube - Fresh new thread...

I was messing with it and this version works with 0.6 beta and firefox3 b4 and ie7. It should work w/ firefox2 but I'm too lazy to try. All I did was (very badly) implement it using the way on FLV-Scrubber.
Code:
<?
##########################
##Youtube Plugin for Glype Proxy Script.
##www.glype.com
## No need to change url to mediaplayer.swf It is called with optURL
##########################
function preParse($html,$type){
if($type=='html'&&preg_match('/fullscreenUrl\s\=\s.*video\_id\=(.*)\&.*\&t\=(.*)\&/i',$html,$matches)){
$s&#91;]='/var v="7";(.*?)player_div\);/is';$r&#91;]='';
$s&#91;]='#// <!\[(.*?)// \]\]>#is';$r&#91;]='';
$s&#91;]="#Hello, you either have JavaScript turned off or an old version of Adobe's Flash Player.#";$r&#91;]='';
$s&#91;]="#</noscript>#";$r&#91;]='</noscript><div style="visibility: hidden;">';
$s&#91;]='#<div id="actionsAreaDiv">#';$r&#91;]='</div><div id="actionsAreaDiv">';
$s&#91;]='#<div style="padding: 20px; font-size:14px; font-weight: bold;">#';$r&#91;]='<div>';
$s&#91;]='#Get the latest Flash player</a>.#';$r&#91;]="</a>";
$s&#91;]='#<div id="playerDiv">#';$r&#91;]=
'<div>
<object id="youvid" width="425" height="355" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/s...sion=9,0,0,0">
<param name="movie" value="'.optURL.'mediaplayer.swf"/>
<param name="allowFullScreen" value="true"/>
<param name="flashvars" value="file='.proxifyURL('http://youtube.com/get_video?video_id='.$matches[1].'&t='.$matches[2]).'"/>
<embed src="'.optURL.'mediaplayer.swf" bgcolor="#000000" width="425" height="355" name="youvid" allowfullscreen="true" flashvars="file='.proxifyURL
('http://youtube.com/get_video?video_id='.$matches[1].'&t='.$matches[2]).'" type="application/x-shockwave-flash" 
pluginspage="http://www.adobe.com/go/getflashplayer">
</object>';
$html=preg_replace($s,$r,$html);
}
return$html;
}
?>
hi_cannon is offline
Country: United States
 
Old 03-25-2008, 12:00 AM   #6 (permalink)
Junior Member
 
Join Date: Mar 2008
Posts: 9
hi_cannon
Default Re: Youtube - Fresh new thread...

Ha. Upon further inspection, all I did was change from Phantom's clean flash satay method to the original bogged down double method. :P
Oh well... At least it works. Why? beats me.
hi_cannon is offline
Country: United States
 
Old 03-25-2008, 04:20 PM   #7 (permalink)
Junior Member
 
Join Date: Mar 2008
Posts: 29
darkness193
Default Re: Youtube - Fresh new thread...

Dunno if anyone wants this but I've modified my plugin to get the thumbnails for each video (not the small ones either they are the full sized ones)

Let me know
darkness193 is offline
Country: United Kingdom
 
Old 03-25-2008, 05:19 PM   #8 (permalink)
Member
 
Join Date: Dec 2007
Posts: 91
Phantom
Default Re: Youtube - Fresh new thread...

Sure post the code for us if you want t share. I was actually curious where the thumbnails where comming from. I spent about 30 mintues examing the http headers and html and couldn't figure where they wher coming from except for some url called /vi/[0-9]/defualt.jpg
( If I can remember correctly)
Phantom is offline
Country: Canada
 
Old 03-25-2008, 05:20 PM   #9 (permalink)
Junior Member
 
Join Date: Mar 2008
Posts: 9
hi_cannon
Default Re: Youtube - Fresh new thread...

That's great!
Post it!
hi_cannon is offline
Country: United States
 
Old 03-28-2008, 02:03 AM   #10 (permalink)
Member
 
Join Date: Dec 2007
Posts: 91
Phantom
Default Re: Youtube - Fresh new thread...

Can someone tell me what this does in the code,
Code:
$s&#91;]=' '
$r&#91;]=' '
I'm taking a good guess it means Search & replace. Although I'm not sure is this is built in function in PHP or where is referenced in glype code?

edit: ah,
Code:
$html=preg_replace($s,$r,$html);
It all makes sense now. I love learning PHP,
Its preg_replace $s with $r.
Phantom is offline
Country: Canada
 
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 09:50 AM.
© 2006-2010 Glype. All Rights Reserved.