Athlon1600 / php-proxy

A web proxy script written in PHP and built as an alternative to Glype.
https://www.php-proxy.com
MIT License
296 stars 158 forks source link

m.youtube.com not appearing #73

Open schlarmanorg opened 6 years ago

schlarmanorg commented 6 years ago

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.

schlarmanorg commented 6 years ago

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

Athlon1600 commented 6 years ago

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(
schlarmanorg commented 6 years ago

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.

schlarmanorg commented 6 years ago

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.