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 12-28-2007, 11:06 PM   #1 (permalink)
Senior Member
 
Join Date: Oct 2007
Posts: 162
steven will become famous soon enoughsteven will become famous soon enough
Send a message via AIM to steven Send a message via MSN to steven Send a message via Yahoo to steven
Default youtube

full credit due to
http://proxy.org/forum/1198884211.html

origionally for phproxy at above link -- modified for glype

its probably not the most efficient / correct way of doing it


though I do not like doing things the 'right' way so much (for example to version of glype on my server is 1 file - 1 line of code - ~14 kb in size with literally most of the code in the official release stripped but leaving all usefullness that i could figure would be used)




<?
function preParse($html,$type) {
if($type!='html')
return $html;

preg_match('/fullscreenUrl\s\=\s(.*)\&sk\=/', $html, $matches);
preg_match('/video\_id\=(.*)/',$matches[1],$matches);
$link = proxifyURL('http://youtube.com/get_video?video_id='.$matches[1],'');

$s&#91;] = '/var v = "7";(.*?)player_div\);/is';
$r&#91;] = '';

$s&#91;] = '#\/\/ \<\!\[(.*?)\/\/ \]\]\>#is';
$r&#91;] = "
var p = new SWFObject('http://gtfomy.biz/mediaplayer.swf&#39;,&#39;...9;,&#39;7&#39;);
p.addParam('allowfullscreen','true');
p.addVariable('file','$link');
p.addVariable('backcolor','0x000000');
p.addVariable('frontcolor','0xCCCCCC');
p.addVariable('lightcolor','0x996600');
p.addVariable('overstretch','true');
p.addVariable('type','flv');
p.addVariable('volume','50');
p.write('playerDiv');";
$html = preg_replace( $s, $r, $html);
return $html;
}
function postParse($html,$type) {

return $html;
}
?>
steven is offline
Country: United States
 
Old 12-28-2007, 11:50 PM   #2 (permalink)
Senior Member
 
Join Date: Oct 2007
Posts: 162
steven will become famous soon enoughsteven will become famous soon enough
Send a message via AIM to steven Send a message via MSN to steven Send a message via Yahoo to steven
Default Re: youtube

(looks like compression needs to be disabled for this to work without the video being cut off (content-size, i bet anything))


I'll take another look at the code after I've wasted my mind awake with video games for a few hours
steven is offline
Country: United States
 
Old 12-30-2007, 02:29 PM   #3 (permalink)
Senior Member
 
Join Date: Oct 2007
Posts: 162
steven will become famous soon enoughsteven will become famous soon enough
Send a message via AIM to steven Send a message via MSN to steven Send a message via Yahoo to steven
Default Re: youtube

I never did end up finding out why glype was cutting the flv files out so early (around 3 minutes into it)

anyone know what could possibly be causing this to happen?



// for now I have $link pointing to a old copy of phproxy to get the flv files as it doesnt end the file video short of the end
steven is offline
Country: United States
 
Old 12-30-2007, 07:38 PM   #4 (permalink)
Junior Member
 
Join Date: Dec 2007
Posts: 1
lfod
Default Re: youtube

The problem with videos being cut off seems to be the default of 60 secs for $toSet[CURLOPT_TIMEOUT] in browse.php not being long enough to download longer videos from youtube.
lfod is offline
Country: United States
 
Old 12-31-2007, 01:59 PM   #5 (permalink)
Senior Member
 
Join Date: Oct 2007
Posts: 162
steven will become famous soon enoughsteven will become famous soon enough
Send a message via AIM to steven Send a message via MSN to steven Send a message via Yahoo to steven
Default Re: youtube

that was it, I had not thought of that because the server has a 100 mb/s inbound connection, so I assumed it would not take long to download from youtube, but it looks like youtube has some sort of speed limiter on their flv file connections.

thanks for that :] saved me from needing to use 2 different scripts on one site


also I recommend changing
var p = new SWFObject('http://gtfomy.biz/mediaplayer.swf&#39;,&#39;...9;,&#39;7&#39;);

to
var p = new SWFObject('".optURL."mediaplayer.swf','single','45 0','370','7');


then either just save the swf from the url in my post or directly from the source http://www.jeroenwijering.com/?item=JW_Media_Player
steven is offline
Country: United States
 
Old 12-31-2007, 03:08 PM   #6 (permalink)
Senior Member
 
Join Date: Aug 2007
Posts: 313
Nick
Default Re: youtube

Good job. I was going to say you might want to change that if you value your bandwidth! :P

As for the timeout, I'm sure I must have downloaded a file through the script that took more than 60 seconds before. I guess not - maybe the script should use a bigger value by default?
Nick is offline
Country: United Kingdom
 
Old 12-31-2007, 11:59 PM   #7 (permalink)
Member
 
Join Date: Dec 2007
Posts: 91
Phantom
Default Re: youtube

So how do I implement this into glype?
Phantom is offline
Country: Canada
 
Old 01-01-2008, 03:04 AM   #8 (permalink)
Member
 
Join Date: Nov 2007
Posts: 50
llamafier
Default Re: youtube

You make a file named youtube.com.php and paste that code into it. Theres more info in the sticky in this section...
llamafier is offline
Country: United States
 
Old 01-01-2008, 11:03 PM   #9 (permalink)
Junior Member
 
Join Date: Dec 2007
Posts: 4
theurge
Default Re: youtube

Thanks for posting this - it's working great on my site.

One small problem though - I am getting a undefined offset on lines 7 and 8...
I noticed someone over in the phproxy thread was getting the same message. It was suggested that error reporting is turned off, but I'm not sure how to do that in Glype. It's not a big deal, but I like to keep my site looking as professional as possible, and things like this bug me

Any ideas?
theurge is offline
Country: United States
 
Old 01-01-2008, 11:21 PM   #10 (permalink)
Senior Member
 
Join Date: Oct 2007
Posts: 162
steven will become famous soon enoughsteven will become famous soon enough
Send a message via AIM to steven Send a message via MSN to steven Send a message via Yahoo to steven
Default Re: youtube

Originally Posted by Nick
Good job. I was going to say you might want to change that if you value your bandwidth! :P

As for the timeout, I'm sure I must have downloaded a file through the script that took more than 60 seconds before. I guess not - maybe the script should use a bigger value by default?
from what I understand the timeout would be the servers time downloading the file, not your browsers time to download it

so it may well have indeed took more than 60 seconds for you before, but the server with a high speed connection could have loaded it in seconds


-----


also, if a few users hotlinked a 30 kb swf file on my server was able to over run the bandwidth, I do not think I would have any business adding youtube support where each video takes 10 (ish?) mb upload and download per view :] I just said to get their own copy for reasons like my site being blocked/theirs not-- if they happen to be using ssl- the link i posted was not using it (security warning would result) -- though overall it would still be smartest not to use the url on my site, It was late when i originally wrote this topic after seeing the phproxy one and i forgot to change that in the first post




Originally Posted by theurge
Thanks for posting this - it's working great on my site.

One small problem though - I am getting a undefined offset on lines 7 and 8...
I noticed someone over in the phproxy thread was getting the same message. It was suggested that error reporting is turned off, but I'm not sure how to do that in Glype. It's not a big deal, but I like to keep my site looking as professional as possible, and things like this bug me

Any ideas?
includes / init.php

first couple lines you will not miss it, just change the 1 to a 0
steven is offline
Country: United States
 
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 10:04 AM.
© 2006-2010 Glype. All Rights Reserved.