Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

优酷PC客户端 #118

Closed
fxshpac opened this issue Aug 28, 2013 · 36 comments
Closed

优酷PC客户端 #118

fxshpac opened this issue Aug 28, 2013 · 36 comments

Comments

@fxshpac
Copy link

fxshpac commented Aug 28, 2013

好像不能用
capture

Same result when setting the proxy http://yo.uku.im/proxy.pac in IE and Firefox.

Works fine when opening the same view in Firefox though.

Maybe PC client works different than the web version and it was able to detect the US IP anyhow.

Sohu PC client works fine however.

Just want to get confirmation whether not supporting Youku PC client is a known limitation.

@zhuzhuor
Copy link
Member

Do you mean this one? http://c.youku.com/pc-client
Did IE work fine as Firefox?

I guess the reason might be the Youku PC client doesn't use the system-wide config for proxy.

@fxshpac
Copy link
Author

fxshpac commented Aug 29, 2013

Yes that's the one which wasn't working. It seems talking thru proxy though because i can see the access logs when i run the ub.uku.js.cmd proxy on the same PC. So it may be possible to change the rules in the proxy to let it believe it's connecting from China.

@karlcheong
Copy link
Contributor

Don't know why but the program was thrown out BEX errors when I execute it.
I believe most of those kinds of PC clients ignore the proxy setting, or have other protections,
so it is much harder to get it bypass the restriction.
I am wonder Why don't you use browsers instead?

@fxshpac
Copy link
Author

fxshpac commented Aug 29, 2013

I know at least Sohu PC client works very well with the same setup. I wish I can understand the proxy implementation better to make the Youku PC client works as well. I want to run the PC clients on my HTPC which are much easier to launch and navigate comparing to the one in the browser. But I can live with the web based clients if these are the only ones which are officially supported. Thanks for you both for the excellent solution and input on this topic.

@karlcheong
Copy link
Contributor

@chenjhcg Solved the problem of youku pc client on my pc, it is due to DEP function of Wndows

The "PC clients ignore the proxy setting" thing can be solve by using proxifier, or by connecting reverse proxy.
I was tried to analyse the addresses of those PC Clients used to verify user IP.

When PC Clients of other services like tudou, iqiyi, tencent video, letv, sohu are fine as they don't use SSL on serving address.
I found out that youku pc client is using SSL connection to get the video address
(under domain openapi.youku.com)

This is first time to see SSL on china video services EXCEPT logging in & out.
As the nodejs server wasn't employed code for SSL support ATM,
(As I know, it is possible to use port 443 SSL on the backend china server that the nodejs server use)
Right now you need to find an other proxy for tunnelling SSL proxy in Proxifier

Here is my rules in proxifier

rules

@zhuzhuor HTTP CONNECT method is necesary to tunnel SSL, please consider to add it.

@fxshpac
Copy link
Author

fxshpac commented Aug 29, 2013

@karlcheong I will definitely play with Proxifier. One question, in your screen capture under Action column, I kinda understand what Proxy HTTP privoxy means but not sure what is Proxy HTTPs sohu or how to set that up myself.

@karlcheong
Copy link
Contributor

sohu & privoxy are user-defined names of proxies.
privoxy is windows version of the program in #80 & #106, I use as an alternative to PAC
sohu is a python proxy program to authenticate with sohu proxy. I use it to switch to china IP.
It support both HTTP & HTTPS.

@zhuzhuor
Copy link
Member

@karlcheong 我这两天在搬家有点忙,过几天我看看https的代理

@zhuzhuor
Copy link
Member

zhuzhuor commented Sep 9, 2013

@karlcheong 我现在在尝试实现 https 代理(实现 CONNECT method 的部分)
突然发现个潜在的问题,这 CONNECT 请求只发送网站的域名给代理服务器
例如 api.github.com:443 或者 ajax.googleapis.com:443
CONNECT 之后的数据通讯都是加密过的,代理服务器看不到具体的数据

这样的话我们就不能做非常具体的基于 URL pattern 的 access control 了
到时候对 https 的代理只能精确到域名,例如只允许 openapi.youku.com 和 443 端口

@zhuzhuor
Copy link
Member

@chenjhcg @karlcheong
The HTTPS proxy is now finished at the branch
https://github.com/zhuzhuor/Unblock-Youku/tree/connect
You may have a test run if you have some time. openapi.youku.com is already added to the url list of the code.

Please report any bugs/problems here if you see any.
I will merge it to the master branch when it is stable enough and more bug-free, since I made a lot of changes on the original version.

@zhuzhuor
Copy link
Member

I have merged all the new code to the master branch, and it will be pushed to the proxy server.
Let's give it a try, and hope there won't be any big problems...

@fxshpac
Copy link
Author

fxshpac commented Sep 12, 2013

@zhuzhuor
I just tested it again with the same Youku PC client and PAC address http://yo.uku.im/proxy.pac set in IE. The result is the same as last time. I wonder if the reason is because the PAC address is still pointing to the old version.

@zhuzhuor
Copy link
Member

@chenjhcg
The PAC file is already updated in my case.
You may have to use proxifier as @karlcheong suggested

@karlcheong
Copy link
Contributor

@chenjhcg I have tested the unblock node server v1.7.0, it can do the ssl proxy job well. 💯
Also, the Youku PC client seems to ignore IE proxy setting, you will have to use proxifier to enforce it.
Just make sure that in the youku rule, proxy type is HTTPS

@redline99cs
were you get blocked by netease cloud music? Website or PC client?
I can directly access the service by pc client, website & mobile apps.

@fxshpac
Copy link
Author

fxshpac commented Sep 12, 2013

@zhuzhuor @karlcheong

Great news. With a proxifier rule set to force Youku PC client to use proxy server that I run on the same PC with the following command, I can now play at least one video clip which wasn't possible. Will continue trying more to be sure but so far so good.

ub.uku.js.cmd --local_only --mitm_proxy

@karlcheong I set the proxy server type to HTTPS but it failed to pass checking so I changed it to HTTP type it passed. However, Youku client works either with the type set to HTTPS or to HTTP. With server type set to HTTPS, I saw following repeated error messages from both proxifier and ub.uku.js proxy server windows while Youku client is running. I thought you may be interested to see that.

proxifier

[09.12 14:06:41] YoukuMediaCenter.exe - openapi.youku.com:443 error : Could not connect through proxy ub.uku.js.cmd - Reading proxy replay on a connection request failed with error 10054
[09.12 14:06:42] YoukuMediaCenter.exe - openapi.youku.com:443 error : Could not connect through proxy ub.uku.js.cmd - Reading proxy replay on a connection request failed with error 10054

ub.uku.js

12 Sep 14:06:48 - [ub.uku.js] Worker 7120 is now connected to 127.0.0.1:8888
[ub.uku.js] 127.0.0.1: CONNECT 61.135.196.99:443
[ub.uku.js] Caught uncaughtException: TypeError: Cannot call method 'on' of undefined
TypeError: Cannot call method 'on' of undefined
at Server.connect_req_handler (C:\Users...\AppData\Roaming\npm\node_modules\ub.uku.js\server\server.js:333:23)
at Server.EventEmitter.emit (events.js:106:17)
at Socket.socket.ondata (http.js:1986:14)
at TCP.onread (net.js:525:27)
[ub.uku.js] Worker 7120 exited with error code: 213

@zhuzhuor
Copy link
Member

@chenjhcg Thanks for your detailed feedback.
It seems the err msg for ub.uku.js is caused by a bug... I will fix it tonight.

@karlcheong
Copy link
Contributor

@chenjhcg
It is interesting that when I set the mode as http
I see the following error
[09.13 09:20:05] YoukuDesktop.exe - openapi.youku.com:443 open through proxy XXXX HTTP
[09.13 09:20:05] YoukuDesktop.exe - openapi.youku.com:443 HTTP connection error : Client sent incorrect HTTP request. Please make sure that client uses HTTP protocol.

Per the help file in proxifier 3.21, Working with proxifier -> Proxy Server Settings
When you need to proxy ssl connection, proxy type should be HTTPS
proxy type HTTP can only tunnel HTTP connection

HTTPS — HTTP proxy with SSL support for arbitrary ports.
Technical documentation can be found at: http://www.ietf.org/rfc/rfc2817.txt
HTTP proxy with SSL tunnel support is also known as:

CONNECT proxy
SSL proxy

WARNING!

Many HTTP proxy servers do not support SSL tunneling; therefore, they cannot be used as HTTPS. If an HTTP proxy works properly in the browser but fails in Proxifier, it most likely means that SSL support is unavailable. You can also check the proxy with the Proxy Checker tool.

HTTP — the most common type of proxy servers. Unfortunately, such proxies can only be used for HTTP connections. You can enable this protocol at Profile->Advanced->HTTP Proxy Servers... Please make sure that you have read and understood the HTTP proxy servers topic before using this option!

@fxshpac
Copy link
Author

fxshpac commented Sep 13, 2013

@karlcheong @zhuzhuor

For some reason I got issue reloading any Youku videos again. I can't see any video titles showing up for clicking. The client seems unable to reach the Youku server at all.

I thought it might be related to the error in server.js I spotted earlier so I went ahead and modified line 333:23 to the one shown below.

client_socket.on('error', function(err) {

With that change, I can at least load the video titles but when I try to play it I see the same error as in my post #1.

In ub.uku.js.cmd window, I see following logs which indicate the request is sent to the remote proxy server.

[ub.uku.js] 127.0.0.1: CONNECT 61.135.196.99:443
[ub.uku.js] 127.0.0.1: CONNECT 61.135.196.99:443

@karlcheong I would like try your node server or the sohu proxy server you mentioned in proxifier to see if that makes any difference. That may help isolate whether the issue is due to the proxy server used by ub.uke.js.cmd.

@zhuzhuor
Copy link
Member

@chenjhcg The server-side code is just updated. Please try again to see if you see similar problems.

@karlcheong
Copy link
Contributor

@chenjhcg
Figured out some clue that should be related to your case.
Check in the proxifier that it resolves dns through proxy server.
It makes great different as if you resolve dns at system, the proxy server only see the server IP instead of domain name
so the unblock proxy server just connect directly as the server IP is not in the url list.

or you can edit the url list, add the follow url:

'https://61.135.196.99/',
'https://220.181.185.150/
',

restart the proxy, and it should be good to go.

zhuzhuor added a commit that referenced this issue Sep 13, 2013
#118 workaround, speedup sohu mobile app
@fxshpac
Copy link
Author

fxshpac commented Sep 13, 2013

@karlcheong

Both approaches worked for me. I noticed the page loading is a bit slower now which makes sense since it's going through the china server.

@zhuzhuor
Copy link
Member

@chenjhcg In any case, only necessary network traffic/connections are proxied via servers in mainland.
So the delay might be caused by the latency of the proxy.uku server or your local proxy.

@fxshpac
Copy link
Author

fxshpac commented Sep 13, 2013

@karlcheong @zhuzhuor

Maybe this is not the same topic but I also have problem with QQLive PC client. With a rule in Proxifier set for QQLive similar to the screenshot in the earlier @karlcheong post, I can get the client to pass the region check and pass the advertisement but it gets stuck at the following stage.

capture2

I remember QQLive PC client is a supported client based on comments in some commits so maybe there is a fix to that.

@karlcheong
Copy link
Contributor

@chenjhcg
I am not good at providing support of all PC clients because of my progamming and networking skill is not good(T^T) . I still can't figure out how to further limit the url it needed to access.

In theory, It should work with node server with mitm_proxy even you forward all traffic.
Just wait for update : )

@zhuzhuor
when I send all traffic of QQ PC client to node server (mitm_proxy on), it just repeatedly loading like this
[ub.uku.js] 127.0.0.1: GET http://video.store.qq.com:80/10263016/6e16ltbhaYe.mp4?sdtfrom=v2001&vkey=712D22B927D074A5535075EE3763977FBA24ECA86707C5511C3A22B7FBE68EB8
[ub.uku.js] 127.0.0.1: GET http://video.store.qq.com:80/10263016/6e16ltbhaYe.mp4?sdtfrom=v2001&vkey=712D22B927D074A5535075EE3763977FBA24ECA86707C5511C3A22B7FBE68EB8
....

the server will do 302 redirect to http://14.17.28.161/10263016/6e16ltbhaYe.mp4?sha=74b91b90f5c62614d331a01e186e83a358af14e2&sdtfrom=v2001&vkey=712D22B927D074A5535075EE3763977FBA24ECA86707C5511C3A22B7FBE68EB8 and should connect to the actual video file.

May you please check about this?

With privoxy with exactly the same forward rule of QQ PC clients, it works pretty well.

@fxshpac
Copy link
Author

fxshpac commented Sep 13, 2013

@karlcheong

While waiting for update, I would like to try privoxy solution you mentioned, which is from #106 I believe. I assume I need more recent files than those you put on dropbox because there has been multiple changes since then.

@fxshpac
Copy link
Author

fxshpac commented Sep 13, 2013

@karlcheong

I set up the privoxy just to test it out. The latest config files I can find is from your comment below. With these files neither Youku PC client nor QQLive PC client worked. But both of them worked in Firefox. You mentioned that QQLive PC client works for you with privoxy setup so I assume you have a more up-to-date version of these files.

#80 (comment)

@zhuzhuor
Copy link
Member

@karlcheong
I just tried the QQLive PC client, and can reproduce the problem you mentioned.
These connections got disconnected in a second and repeated to reconnect.

But I don't understand the causes for this problem.
If you try the link at http://14.17.28.161/... in a web browser such as IE or Chrome, you will see it will download the file as normal.
You can try setting the proxy of the browser either by IE connection setting or Proxifier. The results are the same in my case.

So the local proxy server and Proxifier should be working fine.
I don't know why the QQLive PC client behaved so differently.

@karlcheong
Copy link
Contributor

@chenjhcg
I've packed a windows version privoxy which I am using, with configuration.
https://docs.google.com/file/d/0B_ERKrE-rugFSGlWMGlMeWhMTlk/edit?usp=sharing

Once you extract it, run new.exe, the proxy will listen on 0.0.0.0:8123
Then it is all set. node.js server is not needed.

@fxshpac
Copy link
Author

fxshpac commented Sep 14, 2013

@karlcheong @zhuzhuor

Both Youku and QQLive PC Clients are working now with the files finally. Thanks guys for your help.

I just wonder one thing, the vanilla privoxy server can't load the cnforward.action file due to unsupported sogou-header option on line 15 as shown below.

{+forward-override{forward h0.edu.bj.ie.sogou.com:80} +sogou-header{Reason}}

If I replace it with the line below, the vanilla privoxy.exe loads the file just fine. And QQLive PC client still works afterwards but Youku PC client no longer works. So my guess is that sogou-header{Reason} option is making the difference. I'm just curious to know why. And whether there is a way to get around that with vanilla privoxy.exe.

{+forward-override{forward h0.edu.bj.ie.sogou.com:80}}

@karlcheong
Copy link
Contributor

That's a modified version of privoxy 3.0.19 which added support of sogou proxy authentication
if you want to use the config with official version
replace {+forward-override{forward h0.edu.bj.ie.sogou.com:80} +sogou-header{Reason}} with
{+forward-override{forward YOURPROXYADDRESS:PORT}}
which YOURPROXYADDRESS:PORT = the nodejs server / china proxy server

@fxshpac
Copy link
Author

fxshpac commented Sep 14, 2013

I tried running official version with that line changed to

{+forward-override{forward localhost:8888}} (my own node.js proxy server running on the same PC at port 8888)

and then to

{+forward-override{forward digito.wlmacao.tk:8000}} (the proxy server being used by @zhuzhuor)

But Youku PC client fails to play videos. So I still have no way to make Youku work with official privoxy version.

@fxshpac
Copy link
Author

fxshpac commented Sep 14, 2013

Sorry I spoke too soon. The node.js server I ran on my own PC doesn't have latest changes for youku below. Once I added the changes, Youku PC client now works. And I'm sure the @zhuzhuor server should work as well once the changes are included there as well.

#118 (comment)

@whuhacker
Copy link
Contributor

最近研究了下 @karlcheong 的 privoxy 代理方式,一直疑惑

{+forward-override{forward h0.edu.bj.ie.sogou.com:80} +sogou-header{Reason}}

的设定,居然在这个 issue 里找到了。请问 @karlcheong 能介绍下你的 modified version of privoxy 3.0.19 吗?

@karlcheong
Copy link
Contributor

@whuhacker
是在operachina論壇(已關閉)找到的一個修改版本
多了一個sogou-header 加入驗證header功能
這樣就可以在Privoxy中直接連接sogou代理

source code: https://mega.co.nz/#!tMkTUQ5Y
pass: c5v86HiMivyo6nCqYkqYqi0v9XlvorWJ9hjd5l6CieU

@whuhacker
Copy link
Contributor

@karlcheong Thank you so much.

@chang256
Copy link

@karlcheong
可以在分享一下Privoxy直接使用sogou代理的方式嗎

@zhuzhuor zhuzhuor closed this as completed Jun 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants