#!name=YouTube Enhance #!desc=Block ads. Enable background play, PiP, up to 4x speed and On-the-go controls.\nBased on Maasea's code (Apache-2.0). #!category=gholts #!arguments=block_upload:true,block_shorts:false,auto_hd:true,block_games:true,block_vertical_live:false,jump_ahead:true,block_store:true,block_ai:true,on_the_go:true #!arguments-desc=block_upload\n └ Remove upload tab\nblock_shorts\n └ Remove Shorts tab\nauto_hd\n └ Prefer highest offered resolution; Premium bitrate when authorized\nblock_games\n └ Remove Playables on homepage\nblock_vertical_live\n └ Remove Vertical live on homepage\njump_ahead\n └ Enable Jump Ahead button\nblock_store\n └ Remove creator stores, product cards and overlays\nblock_ai\n └ Remove Ask, AI summaries and related controls\non_the_go\n └ On-the-go controls when compatible UI components are available #!requirement=SYSTEM = 'iOS' [Script] youtube.enhance.ad-break = type=http-request,pattern=^https:\/\/youtubei\.googleapis\.com\/youtubei\/v1\/player\/ad_break(?:\?.*)?$,engine=jsc,script-path=https://raw.githubusercontent.com/gholts/surge/main/scripts/youtube/request.js youtube.enhance.response = type=http-response,pattern=^https:\/\/youtubei\.googleapis\.com\/youtubei\/v1\/(?:navigation\/resolve_url|browse|next|player|search|reel\/reel_watch_sequence|guide|account\/get_setting|get_watch)(?:\?.*)?$,requires-body=1,max-size=-1,binary-body-mode=1,engine=webview,script-path=https://raw.githubusercontent.com/gholts/surge/main/scripts/youtube/response.js,argument="{"blockUpload":{{{block_upload}}},"blockShorts":{{{block_shorts}}},"blockGames":{{{block_games}}},"blockVerticalLive":{{{block_vertical_live}}},"jumpAhead":{{{jump_ahead}}},"autoHd":{{{auto_hd}}},"blockStore":{{{block_store}}},"blockAi":{{{block_ai}}},"onTheGo":{{{on_the_go}}}}" youtube.enhance.key = type=http-response,pattern=^https:\/\/youtubei\.googleapis\.com\/youtubei\/v1\/(?:config|log_event)(?:\?.*)?$,requires-body=1,max-size=-1,binary-body-mode=1,engine=jsc,script-path=https://raw.githubusercontent.com/gholts/surge/main/scripts/youtube/key.js youtube.enhance.ump = type=http-response,pattern=^https?:\/\/[\w-]+\.googlevideo\.com\/initplayback(?:\?.*)?$,requires-body=1,max-size=-1,binary-body-mode=1,engine=webview,script-path=https://raw.githubusercontent.com/gholts/surge/main/scripts/youtube/ump.js,argument="{"blockGames":{{{block_games}}},"blockVerticalLive":{{{block_vertical_live}}},"jumpAhead":{{{jump_ahead}}},"autoHd":{{{auto_hd}}},"blockStore":{{{block_store}}},"blockAi":{{{block_ai}}},"onTheGo":{{{on_the_go}}}}" youtube.enhance.init = type=http-request,pattern=^https?:\/\/[\w-]+\.googlevideo\.com\/initplayback(?:\?.*)?$,requires-body=1,max-size=-1,binary-body-mode=1,engine=jsc,script-path=https://raw.githubusercontent.com/gholts/surge/main/scripts/youtube/request.js,argument="{"autoHd":{{{auto_hd}}}}" youtube.enhance.auto-hd = type=http-request,pattern=^https?:\/\/[\w-]+\.googlevideo\.com\/videoplayback(?:\?.*)?$,requires-body=1,max-size=-1,binary-body-mode=1,engine=jsc,script-path=https://raw.githubusercontent.com/gholts/surge/main/scripts/youtube/request.js,argument="{"autoHd":{{{auto_hd}}}}" #!REQUIREMENT "'{{{auto_hd}}}' == 'true'" youtube.enhance.log-event = type=http-request,pattern=^https:\/\/youtubei\.googleapis\.com\/youtubei\/v1\/log_event(?:\?.*)?$,engine=jsc,script-path=https://raw.githubusercontent.com/gholts/surge/main/scripts/youtube/request.js [URL Rewrite] ^https:\/\/www\.youtube\.com\/(pagead|pcs)\/ - reject ^https:\/\/s\.youtube\.com\/api\/stats\/ads - reject [MITM] hostname = %APPEND% *.googlevideo.com, youtubei.googleapis.com, www.youtube.com, s.youtube.com