Athlon1600/php-proxy

m.youtube.com not appearing

Opened this issue · 4 comments

I set up the proxy on my site schlarman.org/web/ I am mainly doing my browsing from a mobile device and when I enter YouTube.com it redirects to m.youtube.com and it just shows a blank page.

I attempted to create a plugin as suggested Athlon1600/php-proxy-app#37 but it can't seem to get it to work.

What is not working? The plugin itself? Is it enabled?
https://github.com/Athlon1600/php-proxy-app/blob/master/config.php

It has to be added here:

$config['plugins'] = array(

I followed what you said and made sure to have it enabled from the config.php file. the code that is in the plugin looks like this:

use Proxy\Plugin\AbstractPlugin;
use Proxy\Event\ProxyEvent;

class YoutubeMobilePlugin extends AbstractPlugin {

	public function onBeforeRequest(ProxyEvent $event){
		$event['request']->headers->set('user-agent', 'Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25');
	}

	public function onHeadersReceived(ProxyEvent $event){
		// fired right after response headers have been fully received - last chance to modify before sending it back to the user
	}

	public function onCurlWrite(ProxyEvent $event){
		// fired as the data is being written piece by piece
	}

	public function onCompleted(ProxyEvent $event){
		// fired after the full response=headers+body has been read - will only be called on "non-streaming" responses
	}
}

It still doesn't seem to want to work, I even uploaded the version with the plugin to part of my website ( unblockit.schlarman.org ) and it doesn't seem to work. I am trying to get it to work on a screen the size of an Ipad or smaller.

I gave up on the main issue and then replaced

$event['request']->headers->set('user-agent', 'Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25');

With

$event['request']->headers->set('user-agent', 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0');

So now I get the desktop version of any site instead of the mobile version

I sacrifice any sort of phone user, but I plan on only using tablets as the smallest device on the site.