| 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. |
04-02-2008, 05:08 AM
|
#21 (permalink)
|
|
Junior Member
Join Date: Apr 2008
Posts: 2
|
Re: Youtube - Fresh new thread...
Steven's fix is working with my beta 2
|
|
|
|
04-02-2008, 09:17 AM
|
#22 (permalink)
|
|
Junior Member
Join Date: Mar 2008
Posts: 29
|
Re: Youtube - Fresh new thread...
Ok here it is my modified YouTube plugin with thumbnail support. Sorry it took a while there was an error in my syntax which I had to solve before releasing. I just noticed steven made an improved version of the original plugin, I can't seem to implement my code into the new one properly (well not without errors) perhaps someone could help me out with that. Anyway here it is:
|
Code:
|
<?php
##############################################
# Plugin: YOUTUBE.COM
# Thumbnail Support By: Dominic Robinson
##############################################
/* ABOUT ---------------------------------
/ This plugin replaces the default YouTube video player
/ with our own player that loads the flv file through
/ the proxy.
-----------------------------------------*/
##########################################
# REMOVE NON-WORKING FLASH OBJECTS
##########################################
$options['stripFlash'] = true;
##########################################
# EXTRA PARSING BEFORE MAIN PROXY PARSER
##########################################
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);
$s[] = '/var v="7";(.*?)player_div\);/is';
$r[] = '';
$s[] = '#// <!\[(.*?)// \]\]>#is';
$r[] = '';
$s[] = "#Hello, you either have JavaScript turned off or an old version of Adobe's Flash Player.#";
$r[] = '';
$s[] = "#</noscript>#";
$r[] = '</noscript><div style="visibility: hidden;">';
$s[] = '#<div id="actionsAreaDiv">#';
$r[] = '</div><div id="actionsAreaDiv">';
$s[] = '#<div style="padding: 20px; font-size:14px; font-weight: bold;">#';
$r[] = '<div>';
$s[] = '#Get the latest Flash player</a>.#';
$r[] = "</a>";
$s[] = '#<div id="playerDiv">#';
$r[] = '<div><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>';
$html = preg_replace($s,$r,$html);
}
return $html;
}
##########################################
# EXTRA PARSING AFTER MAIN PROXY PARSER
##########################################
function postParse(&$html,$type) {
// Replace unproxified image
if ( $type == 'javascript' )
return str_replace('http://s.ytimg.com/yt/img/pixel-vfl73.gif',proxifyURL('http://s.ytimg.com/yt/img/pixel-vfl73.gif'),$html);
return $html;
}
?> |
PLACE THE ATTACHED PLAYER IN YOUR PROXY DIRECTORY, DO NOT PUT IT INTO THE PLUGINS DIRECTORY!
This is the new JW Media Player (3.16) which hasn't been released yet, I ripped it directly from the JW site.
|
|
|
|
04-02-2008, 01:22 PM
|
#23 (permalink)
|
|
Junior Member
Join Date: Apr 2008
Posts: 3
|
Re: Youtube - Fresh new thread...
|
Originally Posted by darkness193
|
Ok here it is my modified YouTube plugin with thumbnail support. Sorry it took a while there was an error in my syntax which I had to solve before releasing. I just noticed steven made an improved version of the original plugin, I can't seem to implement my code into the new one properly (well not without errors) perhaps someone could help me out with that. Anyway here it is:
[...]
|
This works like a charm. Since I would rather keep everything plugin related on the plugins directory, I modify it to read the videoplayer.swf from /plugins/. The currently playing videos doesn't even show, which is great (it is a Youtube feature I would rather live without).
|
|
|
|
04-02-2008, 09:11 PM
|
#24 (permalink)
|
|
Junior Member
Join Date: Feb 2008
Posts: 10
|
Re: Youtube - Fresh new thread...
is working good
|
|
|
|
04-04-2008, 05:57 AM
|
#25 (permalink)
|
|
Junior Member
Join Date: Apr 2008
Posts: 3
|
Re: Youtube - Fresh new thread...
|
Originally Posted by darkness193
|
Ok here it is my modified YouTube plugin with thumbnail support. Sorry it took a while there was an error in my syntax which I had to solve before releasing. I just noticed steven made an improved version of the original plugin, I can't seem to implement my code into the new one properly (well not without errors) perhaps someone could help me out with that. Anyway here it is:
|
Code:
|
<?php
##############################################
# Plugin: YOUTUBE.COM
# Thumbnail Support By: Dominic Robinson
##############################################
/* ABOUT ---------------------------------
/ This plugin replaces the default YouTube video player
/ with our own player that loads the flv file through
/ the proxy.
-----------------------------------------*/
##########################################
# REMOVE NON-WORKING FLASH OBJECTS
##########################################
$options['stripFlash'] = true;
##########################################
# EXTRA PARSING BEFORE MAIN PROXY PARSER
##########################################
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);
$s[] = '/var v="7";(.*?)player_div\);/is';
$r[] = '';
$s[] = '#// <!\[(.*?)// \]\]>#is';
$r[] = '';
$s[] = "#Hello, you either have JavaScript turned off or an old version of Adobe's Flash Player.#";
$r[] = '';
$s[] = "#</noscript>#";
$r[] = '</noscript><div style="visibility: hidden;">';
$s[] = '#<div id="actionsAreaDiv">#';
$r[] = '</div><div id="actionsAreaDiv">';
$s[] = '#<div style="padding: 20px; font-size:14px; font-weight: bold;">#';
$r[] = '<div>';
$s[] = '#Get the latest Flash player</a>.#';
$r[] = "</a>";
$s[] = '#<div id="playerDiv">#';
$r[] = '<div><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>';
$html = preg_replace($s,$r,$html);
}
return $html;
}
##########################################
# EXTRA PARSING AFTER MAIN PROXY PARSER
##########################################
function postParse(&$html,$type) {
// Replace unproxified image
if ( $type == 'javascript' )
return str_replace('http://s.ytimg.com/yt/img/pixel-vfl73.gif',proxifyURL('http://s.ytimg.com/yt/img/pixel-vfl73.gif'),$html);
return $html;
}
?> |
PLACE THE ATTACHED PLAYER IN YOUR PROXY DIRECTORY, DO NOT PUT IT INTO THE PLUGINS DIRECTORY!
This is the new JW Media Player (3.16) which hasn't been released yet, I ripped it directly from the JW site.
|
trying with the new 0.6b2 but videos just keep loading showing the loading indicator in the screen but never get to play
any ideas
thank you
|
|
|
|
04-06-2008, 11:23 AM
|
#26 (permalink)
|
|
Junior Member
Join Date: Apr 2008
Posts: 5
|
Re: Youtube - Fresh new thread...
Plz someone help me :S
 i got some questions
ok i will copy the mediaplayer.swf to my Scripts main directory.
Then??
where i will write this code? must be included in index.php or is it must be another php file like youtube.php?
if it must be like youtube.php ,, is there anything i gotta do for index.php?
|
|
|
|
04-06-2008, 11:41 AM
|
#27 (permalink)
|
|
Member
Join Date: Feb 2008
Posts: 46
|
Re: Youtube - Fresh new thread...
You just need to make a youtube.php file inside your plugins folder. The index never has to be altered.
|
|
|
|
04-07-2008, 10:15 AM
|
#28 (permalink)
|
|
Senior Member
Join Date: Feb 2008
Posts: 142
|
Re: Youtube - Fresh new thread...
ok, i finally figured out why youtube would not work on my proxy. its so simple and stupid, that i have to share it just in case anyone else has this same issue. ok, i put my list of proxies on my blacklist, since i dont want anyone to go to my proxy, through my proxy, get it? so i added them all to my blacklist. well, since my site was on the blacklist, it was not allowing the mediaplayer.swf to load. so, i just put the mediaplayer onto one of my other sites that is not on the blacklist and modified the plugin to reflect the new location of the mediaplayer. problem solved. here is my modified section of the plugin that i changed:
|
|
|
|
04-07-2008, 06:26 PM
|
#29 (permalink)
|
|
Member
Join Date: Dec 2007
Posts: 91
|
Re: Youtube - Fresh new thread...
|
Originally Posted by kevin186
|
|
ok, i finally figured out why youtube would not work on my proxy. its so simple and stupid, that i have to share it just in case anyone else has this same issue. ok, i put my list of proxies on my blacklist, since i dont want anyone to go to my proxy, through my proxy, get it? so i added them all to my blacklist. well, since my site was on the blacklist, it was not allowing the mediaplayer.swf to load. so, i just put the mediaplayer onto one of my other sites that is not on the blacklist and modified the plugin to reflect the new location of the mediaplayer. problem solved. here is my modified section of the plugin that i changed:
|
What if the site your hotlinking the mediaplayer is blocked?
All files should be hosted on the same domain. If you want to block your proxy from going threw it self use an .htaccess rule.
|
Code:
|
<Limit GET HEAD POST>
order allow,deny
#your ip
deny from xx.xx.xx.xx
allow from all
</LIMIT> |
That will still allow your proxy to work fine and stop proxy chaining/looping threw your own proxies on your IP. Btw, as I said all file should be on the same domain its not wise to hotlink any files. Even images..say trying to save a few bits of bandwidth hotlinking your homepage images from photobucket/imageshack would not work becuase thats blocked in filters as "social networking/file sharing"
-phantom
|
|
|
|
04-08-2008, 02:14 PM
|
#30 (permalink)
|
|
Senior Member
Join Date: Feb 2008
Posts: 142
|
Re: Youtube - Fresh new thread...
thanks for the response. but actually i am hotlinking the mediaplayer.swf from one of my other websites on the same server. i essentially use the other site to host files for just this purpose. this other site just has folders of files, with no structure and only an index.php that kicks someone out if they go to the site. and, i cant block my ip on the htaccess because it is a server in my house, which would prevent me from going to my site. but thanks for the suggestion, i will use that when i move to an actual paid hosting server. i was going to go with glype's suggestion of hosting, but i looked one day at the prices, and came back the next day to make the purchase and the prices had gone up drastically. so, if you have any suggestions for a fast and cheap host i would appreciate it.
|
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 10:39 AM.
© 2006-2010 Glype. All Rights Reserved.
|
|