Skip to content

Commit

Permalink
fixed m.youtube.com search issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
netptop committed Apr 9, 2020
1 parent 2b81422 commit 61e0644
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 24 deletions.
3 changes: 3 additions & 0 deletions Proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ let Proxy = ({urlModify, httpprefix, serverName, port, cookieDomainRewrite, loca

// put siteSpecificReplace at end
Object.keys(siteSpecificReplace).forEach( (site) => {
if (!req.url) {
return
}
if (req.url.indexOf(site) !== -1 || req.headers['referer'].indexOf(site) !== -1) {
keys = Object.keys(siteSpecificReplace[site])
keys.forEach( key => {
Expand Down
3 changes: 3 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ const siteSpecificReplace = {
'[&]{2}this\.connectedCallback[(][)][)]:': `):`, // &&this.connectedCallback()):
'="/sw.js"': `="/https/www.youtube.com/sw.js"`,
},
'm.youtube.com': {
'"/(results.search_query=)"': `"/https/m.youtube.com/$1"`,
},
'search.yahoo.com': {
'"./ra./click"': `"\\/https\\/search.yahoo.com\\/ra\\/click"`,
'(["\']).?/beacon': `$1${serverName}:${port}\\/https\\/search.yahoo.com\\/beacon`,
Expand Down
16 changes: 10 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,26 @@
</div>
</div>
<br />
<div class="descriptionSeg">1.请记下项目开源网址:<a href="https://github.com/netptop/siteproxy">https://github.com/netptop/siteproxy</a>以便在本网站失效后能找到新的网址
<div class="descriptionSeg">1.注意,本网站一定会被墙,时间未知. 请记下项目开源网址(不会被墙):<a href="https://github.com/netptop/siteproxy">https://github.com/netptop/siteproxy</a>以便在本网站失效后能找到新的网址
</div>
<br />
<div class="descriptionSeg">2.建议您从浏览器打开网页,避免被微信窃听! </div>
<div class="descriptionSeg">2.请尽量将上面的网址推荐给不会翻墙的朋友. </div>
<br />
<div class="descriptionSeg">3.由于从本代理发出的Google请求过多, google会自动限制搜索流量; 如果google不能用,请使用bing和yahoo搜索引擎. </div>
<div class="descriptionSeg">3.建议您从浏览器打开网页,避免被微信窃听! </div>
<br />
<div class="descriptionSeg">4.请降低youtube视频的分辨率,因为免费服务器每月的流量非常非常有限, 超过的话其他人都无法使用了 </div>
<div class="descriptionSeg">4.由于从本代理发出的Google请求过多, google会自动限制搜索流量; 如果google不能用,请使用bing和yahoo搜索引擎. </div>
<br />
<div class="descriptionSeg">5.请登录telegram,加群@siteproxy,以便及时获取更新</div>
<div class="descriptionSeg">5.使用手机打开youtube时, 页面顶端有一个搜索条, 可以中文搜索. </div>
<br />
<div class="descriptionSeg">6.请降低youtube视频的分辨率,因为免费服务器每月的流量非常非常有限, 超过的话其他人都无法使用了 </div>
<br />
<div class="descriptionSeg">7.请登录telegram,加群@siteproxy,以便及时获取更新</div>
<form class="lead-title">
<p>指定网址:<input class="lead-title" type="text" id="address" value="https://www.google.com">
<input id="addrAccess" class="lead-title button1" type="button" onclick="onsubmit" value="访问网站"/>
</p>
<input class="lead-title button1" type="button" onclick="window.location.href='/https/www.google.com'" value="Google搜索"/>
<input class="lead-title button1" type="button" onclick="window.location.href='/https/www.youtube.com'" value="Youtube(仅支持手机或火狐浏览器)"/>
<input class="lead-title button1" type="button" onclick="window.location.href='/https/www.youtube.com/results?search_query=中国'" value="Youtube"/>
<input class="lead-title button1" type="button" onclick="window.location.href='/https/www.bing.com/?mkt=en-us'" value="Bing搜索"/>
<input class="lead-title button1" type="button" onclick="window.location.href='/https/search.yahoo.com/'" value="Yahoo搜索"/>
<input class="lead-title button1" type="button" onclick="window.location.href='/https/zh.wikipedia.org'" value="维基百科"/>
Expand Down
37 changes: 19 additions & 18 deletions test/siteproxylocal.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,6 @@ test('remove integrity', async () => {
expect(response.data.indexOf(` integrity="`)).toBe(-1)
}, 30000);

test('google.com regex match issue.', async () => {
const url = `${httpprefix}://${serverName}:${port}/https/www.google.com/xjs/_/js/k=xjs.s.en_US.WX2ru19zjfM.O/ck=xjs.s.6ta1yGmmv4s.L.W.O/am=AAAAAEsAdt0BAv43QQAAsMcAAIAAN8HGAmGQUBDEqglAIA/d=1/exm=Fkg7bd,HcFEGb,IvlUe,MC8mtf,OF7gzc,RMhBfe,T4BAC,TJw5qb,TbaHGc,Y33vzc,cdos,csi,d,hsm,iDPoPb,jsa,mvYTse,tg8oTe,uz938c,vWNDde,ws9Tlc,yQ43ff/ed=1/dg=2/br=1/ct=zgms/rs=ACT90oFic3J6EOqrrX-rohmG1E0OJYTO1g/m=RqxLvf,aa,abd,async,dvl,fEVMic,foot,ifl,lu,m,mUpTid,mu,sb_wiz,sf,sonic,spch,wft,xz7cCd?xjs=s1`
const response = await axios({
method: 'get',
headers: {
'Accept': `text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9`,
},
url,
})
// console.log(`${JSON.stringify(response.headers)}`)
// console.log(`${response.data}`)
expect(response.data.indexOf(`href="/https/www.google.com/g);`)).toBe(-1)
}, 30000);

test('yorkbbs issue', async () => {
const url = `${httpprefix}://${serverName}:${port}/http/www.yorkbbs.ca/`
const response = await axios({
Expand Down Expand Up @@ -225,7 +211,7 @@ test('youtube homepage issue', async () => {
// console.log(`${JSON.stringify(response.headers)}`)
// console.log(`${response.data}`)
expect(response.data.indexOf(`"\\/service_ajax\\",`)).toBe(-1)
}, 3000); // should be done within 3 seconds.
}, 8000); // should be done within 3 seconds.

// heroku headers:
// h==== req.url:/https/id.google.com/verify/ALoz5hxFM5vKCyL4RFaFnt6WR_AuQbx7abPPVMjTqOcXGhuzO-IkSXVdsRZsYnmhe8kQSMl9uvqudUdIQBA07Fg_guEQ7c0GP6qrAPVQrScGetd8fAZfMhk, req
Expand Down Expand Up @@ -262,7 +248,7 @@ test('doubi issue', async () => {
url,
})
// console.log(`${JSON.stringify(response.headers)}`)
console.log(`${response.data}`)
// console.log(`${response.data}`)
expect(response.data.indexOf(`href="3x8ussyf.html"`)).toBe(-1)
expect(response.data.indexOf(` src="5ny9g1s2.gif" `)).toBe(-1)
}, 15000); // should be done within 3 seconds.
Expand All @@ -282,7 +268,7 @@ test('web.telegram.com href/src issues', async () => {
expect(response.data.indexOf(`src=js/app.js`)).toBe(-1)
}, 15000); // should be done within 3 seconds.

test('web.telegram.com href/src issues', async () => {
test('web.telegram.com href regular expression issue', async () => {
const url = `${httpprefix}://${serverName}:${port}/https/web.telegram.org/js/app.js`
const response = await axios({
method: 'get',
Expand All @@ -297,7 +283,7 @@ test('web.telegram.com href/src issues', async () => {
}, 15000); // should be done within 3 seconds.


test('web.telegram.com href/src issues', async () => {
test('google search issue', async () => {
const url = `${httpprefix}://${serverName}:${port}/https/www.google.com/search?ei=pJ5yXtfwHOPP0PEPwaGzqAk&q=%E7%BB%B4%E5%9F%BA%E7%99%BE%E7%A7%91`
const response = await axios({
method: 'get',
Expand All @@ -310,3 +296,18 @@ test('web.telegram.com href/src issues', async () => {
// console.log(`${response.data}`)
expect(response.data.indexOf(`/${httpprefix}://${serverName}:${port}/ht`)).toBe(-1)
}, 15000); // should be done within 3 seconds.


test('m.youtube.com search issue', async () => {
const url = `${httpprefix}://${serverName}:${port}/https/m.youtube.com/yts/jsbin/mobile-c3-vflPfniwW/mobile-c3.js`
const response = await axios({
method: 'get',
headers: {
'Accept': `text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9`,
},
url,
})
// console.log(`${JSON.stringify(response.headers)}`)
console.log(`${response.data}`)
expect(response.data.indexOf(`"/results?search_query="`)).toBe(-1)
}, 15000); // should be done within 3 seconds.

0 comments on commit 61e0644

Please sign in to comment.