Update clean params (#1207)

This commit is contained in:
the1812 2020-11-18 20:40:38 +08:00
parent 61ed09d383
commit a448e8d832
2 changed files with 6 additions and 1 deletions

View File

@ -1 +1 @@
(()=>(t,e)=>{const o=["spm_id_from","from_source","from_spmid","from","seid","share_source","share_medium","share_plat","share_tag","bbid","ts","timestamp","unique_k","rt","tdsourcetag","accept_quality","broadcast_type","current_qn","current_quality","playurl_h264","playurl_h265","quality_description","network","network_status","platform_network_status","p2p_type","referfrom"];const r=[{match:/\/\/www\.bilibili\.com\/audio\/(au[\d]+|mycollection)/,param:"type"}];const s=[/game\.bilibili\.com\/fgo/];const a=t=>t;const c=["videocard_series"];const i=()=>{const t=location.search.substring(1).split("&");if(t.some((t=>c.some((e=>t.includes(e)))))){return}const e=t.filter((t=>{if(o.some((e=>t.startsWith(`${e}=`)))){return false}if(r.some((({match:e,param:o})=>document.URL.match(e)&&t.startsWith(`${o}=`)))){return false}return true}));const s=e.join("&");const i=a(document.URL.replace(location.search,""));const n=s?"?"+s:"";const m=i+n;if(m!==document.URL){console.log("[URL params clean]",document.URL,m);history.replaceState({},document.title,m)}};fullyLoaded((()=>{if(document.contentType==="text/html"){i();Observer.videoChange((()=>i()))}}))})();
(()=>(t,e)=>{const o=["spm_id_from","from_source","from_spmid","from","seid","share_source","share_medium","share_plat","share_tag","bbid","ts","timestamp","unique_k","rt","tdsourcetag","accept_quality","broadcast_type","current_qn","current_quality","playurl_h264","playurl_h265","quality_description","network","network_status","platform_network_status","p2p_type","referfrom","visit_id"];const s=[{match:/\/\/www\.bilibili\.com\/audio\/(au[\d]+|mycollection)/,param:"type"},{match:/\/\/live\.bilibili\.com\//,param:"session_id"}];const r=[/game\.bilibili\.com\/fgo/];const i=t=>t;const a=["videocard_series"];const c=()=>{const t=location.search.substring(1).split("&");if(t.some((t=>a.some((e=>t.includes(e)))))){return}const e=t.filter((t=>{if(o.some((e=>t.startsWith(`${e}=`)))){return false}if(s.some((({match:e,param:o})=>document.URL.match(e)&&t.startsWith(`${o}=`)))){return false}return true}));const r=e.join("&");const c=i(document.URL.replace(location.search,""));const n=r?"?"+r:"";const m=c+n;if(m!==document.URL){console.log("[URL params clean]",document.URL,m);history.replaceState({},document.title,m)}};fullyLoaded((()=>{if(document.contentType==="text/html"){c();Observer.videoChange((()=>c()))}}))})();

View File

@ -26,11 +26,16 @@ const blockParams = [
'platform_network_status',
'p2p_type',
'referfrom',
'visit_id',
]
const siteSpecifiedParams = [
{
match: /\/\/www\.bilibili\.com\/audio\/(au[\d]+|mycollection)/,
param: 'type',
},
{
match: /\/\/live\.bilibili\.com\//,
param: 'session_id',
}
]
const noNormalizes = [