diff --git a/config.js b/config.js
index 1bb6b78..e9f61ed 100644
--- a/config.js
+++ b/config.js
@@ -83,8 +83,11 @@ const pathReplace = ({host, httpType, body}) => {
let myRe = new RegExp(`href=([\"\']?)/([-a-z0-9_]+?)`, 'g')
body = body.replace(myRe, `href=$1/${httpType}/${host}/$2`)
- myRe = new RegExp(`href[ ]?=[ ]?"/`, 'g')
- body = body.replace(myRe, `href="/${httpType}/${host}/`)
+ myRe = new RegExp(`href[ ]?=[ ]?"/([-a-z0-9_])`, 'g')
+ body = body.replace(myRe, `href="/${httpType}/${host}/$1`)
+
+ myRe = new RegExp(`(href=\\\\")\\\\/`, 'g')
+ body = body.replace(myRe, `$1\\/${httpType}\\/${host}\\/`)
myRe = new RegExp(` src=([\"\']?)/([-a-z0-9_]+?)`, 'g')
body = body.replace(myRe, ` src=$1/${httpType}/${host}/$2`)
@@ -106,6 +109,9 @@ const pathReplace = ({host, httpType, body}) => {
myRe = new RegExp('("url":[ ]?")/([-a-z0-9_]+?)', 'g')
body = body.replace(myRe, `$1/${httpType}/${host}/$2`)
+ myRe = new RegExp('("url":[ ]?")(\\\\/)([-a-z0-9_]+?)', 'g')
+ body = body.replace(myRe, `$1$2${httpType}$2${host}/$3`) // {"url":"\/watch?v=tTzRY7F_1OU",...}
+
myRe = new RegExp('(sUrl":[ ]?")/([-a-z0-9_]+?)', 'g')
body = body.replace(myRe, `$1/${httpType}/${host}/$2`)
@@ -170,13 +176,16 @@ const siteSpecificReplace = {
'[&]{2}this\.connectedCallback[(][)][)]:': `):`, // &&this.connectedCallback()):
'="/sw.js"': `="/https/www.youtube.com/sw.js"`,
'"://"([+])': `"://${serverName}:${port}/https/"$1`,
- '("././)(www.google.com)': `$1${serverName}:${port}/https/www.google.com`,
+ '("\\\\/\\\\/)(www.google.com)': `$1${serverName}:${port}/https/www.google.com`,
'"://([a-z]+[.]youtube.com/)"': `"://${serverName}:${port}/https/$1"`,
- '"(.../).../www.google.com': `"$1$1${serverName}:${port}$1www.google.com`, // tConfig('COMMENTS_BG_IU', \"\\\/\\\/www.google.com
+ '"(\\\\\\\\\\\\/).../www.google.com': `"$1$1${serverName}:${port}$1www.google.com`, // tConfig('COMMENTS_BG_IU', \"\\\/\\\/www.google.com
+ // '(.\..=this\.fx[(][)]);return (.)': `$1;$2.bandwidthEstimate=1000.1;return $2`,// a.C=this.fx();return a
+ '[a-zA-Z]\.setSizeStyle[(]..,.[)]': `1`,
+ 'a\.....\.style.display=0===.."none":"";': `;`, // a.A[c].style.display = 0 === b ? "none" : "";
},
'm.youtube.com': {
'"/(results.search_query=)': `"/https/m.youtube.com/$1`,
- '"./(results.search_query=)': `"\\/https\\/m.youtube.com\\/$1`,
+ '"\\\\/(results.search_query=)': `"\\/https\\/m.youtube.com\\/$1`,
'mobile-topbar-header-content search-mode"': `mobile-topbar-header-content non-search-mode"`, // enable search on youtube.
' non-search-mode cbox"': ` search-mode cbox"`,
'PLAYER_JS_URL":"': `PLAYER_JS_URL":"\\/https\\/m.youtube.com`,
@@ -190,8 +199,7 @@ const siteSpecificReplace = {
'PLAYER_CSS_URL":"': `PLAYER_CSS_URL":"\\/https\\/www.youtube.com`,
'(action=.")/results': `$1/https/www.youtube.com/results`,
// '"/channel': `"/https/www.youtube.com/channel`,
- '"(./channel)': `"\\/https\\/www.youtube.com$1`,
- '.\.....\.style.display=0===.."none":"";': `;`, // a.A[c].style.display = 0 === b ? "none" : "";
+ '"(\\\\/channel)': `"\\/https\\/www.youtube.com$1`,
},
'search.yahoo.com': {
'"./ra./click"': `"\\/https\\/search.yahoo.com\\/ra\\/click"`,
diff --git a/index.html b/index.html
index f8dfd24..82aa0fa 100644
--- a/index.html
+++ b/index.html
@@ -727,7 +727,7 @@
@@ -773,32 +773,32 @@
@@ -815,47 +815,47 @@
@@ -872,22 +872,17 @@
-
@@ -965,7 +960,7 @@
$('#txt').keydown(function(ev){
// 回车键的处理
if(ev.keyCode==13){
- window.open(thisSearch + $('#txt').val())
+ window.open(thisSearch + $('#txt').val(), "_self")
// $('#txt').val('');
$('#box ul').html('')
}
@@ -1008,7 +1003,7 @@
$("#search-btn").click(function(){
var textValue = $('#txt').val();
if(textValue != ''){
- window.open(thisSearch + textValue)
+ window.open(thisSearch + textValue, "_self")
}
});
diff --git a/test/siteproxylocal.test.js b/test/siteproxylocal.test.js
index f91ef78..c68a018 100644
--- a/test/siteproxylocal.test.js
+++ b/test/siteproxylocal.test.js
@@ -154,7 +154,7 @@ test('youtube url check issue', async () => {
url,
})
// console.log(`${JSON.stringify(response.headers)}`)
- console.log(`${response.data}`)
+ // console.log(`${response.data}`)
// expect(response.data.indexOf(`"Captions URL"`)).toBe(-1)
expect(response.data.indexOf(`("//${serverName}:${port}/https/"+this.`)).not.toBe(-1)
expect(response.data.indexOf(`://i1.ytimg.com/vi`)).toBe(-1)
@@ -185,6 +185,21 @@ test('youtube desktop_polymer_v2.js issue', async () => {
+test('/watch url conversion', async () => {
+ const url = `${httpprefix}://${serverName}:${port}/https/www.youtube.com/watch?v=ii1fTxhD_D0&spf=navigate`
+ 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`,
+ 'Cookie': `VISITOR_INFO1_LIVE=WxtnB8UaTM4; YSC=QPym_D-ojR0`,
+ },
+ url,
+ })
+ // console.log(`${JSON.stringify(response.headers)}`)
+ // console.log(`${JSON.stringify(response.data)}`)
+ expect(JSON.stringify(response.data).indexOf(`/https/www.youtube.com/watch?v=`)).not.toBe(-1)
+}, 30000);
+
test('youtube url conversion', async () => {
const url = `${httpprefix}://${serverName}:${port}/https/www.youtube.com/watch?v=I9K4MbvlDss&frags=pl%2Cwn`
const response = await axios({
@@ -414,6 +429,34 @@ test('youtube Url www.google.com issue', async () => {
url,
})
// console.log(`${JSON.stringify(response.headers)}`)
- // console.log(`${response.data}`)
+ //console.log(`${response.data}`)
expect(response.data.indexOf(`\"interpreterUrl\":\"\/\/www.google.com\/js\/bg\/jeQSBy52GP_vj-aLADK6D_RsHFfZXrt-vZElH-uv2ok.js\"`)).toBe(-1)
}, 15000); // should be done within 3 seconds.
+
+test('youtube href fonts.googleapis.com issue', async () => {
+ const url = `${httpprefix}://${serverName}:${port}/https/www.youtube.com/watch?v=5HHRBe8bskE&list=PLPVsJMpVPkCd_OUBs7Aj_dYEbwgO8ZtLY&index=6&t=0s&frags=pl%2Cwn`
+ 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.youtube.com//127.0.0.1:8011/https/fonts.googleapis.com/css`)).toBe(-1)
+}, 15000); // should be done within 3 seconds.
+
+test('youtube watch address bar issue', async () => {
+ const url = `${httpprefix}://${serverName}:${port}/https/www.youtube.com/watch?v=tTzRY7F_1OU&spf=navigate`
+ 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(`${JSON.stringify(response.data)}`)
+ expect(JSON.stringify(response.data).indexOf(`{"url":"/watch?v=tTzRY7F_1OU"`)).toBe(-1)
+}, 15000); // should be done within 3 seconds.