Athlon1600 / php-proxy

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

Youtube images not be proxified #34

Open Shawn-Tong opened 7 years ago

Shawn-Tong commented 7 years ago

In the video page of youtube such as this one: https://www.youtube.com/watch?v=GeoUELDgyM4

The images on the right of the page are not proxified, such as this one: https://i.ytimg.com/vi/Q6dsRpVyyWs/hqdefault.jpg?custom=true&w=168&h=94&stc=true&jpg444=true&jpgq=90&sp=68&sigh=CdrLZ13uW2VKmznBKnQypFadBcI

In some places, ytimg.com is blocked too. Then those images can't be shown.

Could you please fix it?

webaddicto commented 7 years ago

Looks like requests to i.ytimg.com are not proxied: https://postimg.org/image/jmcoapf6x/

webaddicto commented 7 years ago

Found the fix:

Edit \src\Plugin\ProxifyPlugin.php

And add this line:

$str = preg_replace_callback('@data-thumb=(["|\'])(.*?)\1@i', array($this, 'html_src'), $str);

After line 167:

$str = preg_replace_callback('@src\s*=\s*(["|\'])(.*?)\1@i', array($this, 'html_src'), $str);