This snippet includes a link that MAY contain malware or illegal content. If it does, you could be hacked or face legal consequences. Please do not open the link. If you must, ensure it is safe before proceeding. All content on PasteCode.io is user-generated, and we are not responsible for any harm caused by opening the link.
Untitled
unknown
plain_text
9 months ago
9.7 kB
86
No Index
{ "O_YouTube": { "useimg": 1, "link": "^(?:(?:(?:(?:\\w+\\.)?[yY][oO][uU][tT][uU][bB][eE](?:-nocookie|kids)?\\.com|youtube\\.googleapis\\.com)/(?:.*?\\#/)?(?:(?:(?:v|embed|e|shorts)/(?!videoseries|live_stream))|(?:(?:(?:watch|movie)(?:_popup)?(?:\\.php)?/?)?(?:\\?|\\#!?)(?:.*?[&;])??v=)))|youtu\\.be/)([0-9A-Za-z_-]{11})(?:\\?(thumb\\b))?(?:[?&](?:star)?t=(\\d+(?:\\.\\d+)?)s?)?(?:&end=(\\d+(?:\\.\\d+)?)s?)?.*$", "url": "https://www.youtube.com/embed/$1?$2&$3&$4", "res": ":\n// true = show thumbnail first, video second\n// false = show thumbnail last\nvar thumb_first = true;\n\nthumb_first = thumb_first || $[2];\n\nvar d, e, f={}, g=false, cipher, decsig, o, mfr, ps, basejs;\n\nx = new XMLHttpRequest\nx.open('GET', 'https://www.youtube.com' + JSON.parse($._.match(/\\\"[^\\\"]+player_ias[^\\\"]+\\/base.js\\\"/)[0]), false)\nx.send()\nbasejs = x.responseText\n\nconst escapeRegExp = s => s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\nconst parseunthrottle = data => {\n const fnnameresult = /\\.get\\(\"n\"\\)\\)&&\\(b=([^(]+?)(?:\\[(\\d+)\\])?\\([a-zA-Z0-9]\\)/.exec(data)\n var fnname = fnnameresult[1]\n if(fnnameresult[2]) fnname = new RegExp('var ' + escapeRegExp(fnname) + '\\\\s*=\\\\s*\\\\[(.+?)\\\\][,;]').exec(data)[1].split(',')[parseInt(fnnameresult[2])]\n const _argnamefnbodyresult = new RegExp(escapeRegExp(fnname) + '=function\\\\((.+?)\\\\){(.+?return b\\\\.join\\\\(\"\"\\\\))};', 's').exec(data)\n const [_, argname, fnbody] = _argnamefnbodyresult\n return new Function([argname], fnbody)\n}\nunthrottle = parseunthrottle(basejs)\nfunction nt(s) {\n var u = new URL(s)\n var p = u.searchParams\n var n = p.get('n')\n if(!n) return s\n p.set('n', unthrottle(n))\n u.search = p.toString()\n return u.toString()\n}\n\nconst api_key = 'AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8'\nconst client_ver = '2.20211221.00.00'\nconst sigtime = Number(basejs.match(/signatureTimestamp\\s*:\\s*(\\d+)/)[1]);\nconst vid = $[1];\nfunction player_response(embed){\n x.open('POST', 'https://www.youtube.com/youtubei/v1/player?key=' + api_key, false)\n x.setRequestHeader('Content-Type', 'application/json')\n var data = {\n context: {\n client: {\n clientName: 'WEB',\n clientVersion: client_ver\n }\n },\n videoId: vid,\n playbackContext: {\n contentPlaybackContext: {\n signatureTimestamp: sigtime,\n html5Preference: 'HTML5_PREF_WANTS'\n }\n },\n contentCheckOk: true,\n racyCheckOk: true\n }\n if(embed === 'agegate') data.context.client.clientScreen = 'EMBED'\n if(embed === 'embed') data.context.client = { clientName: 'TVHTML5_SIMPLY_EMBEDDED_PLAYER', clientVersion: '2.0' }\n if(embed) data.context.thirdParty = { embedUrl: 'https://www.youtube.com/' }\n x.send(JSON.stringify(data))\n o = JSON.parse(x.responseText)\n mfr = o.microformat || mfr\n ps = o.playabilityStatus\n return ps.status === 'OK'\n}\nfor(let i of [null, 'embed', 'agegate']) if(player_response(i)) break;\n\nif(['ERROR', 'LOGIN_REQUIRED'].indexOf(ps.status) != -1) return [ps.errorScreen.playerErrorMessageRenderer.thumbnail.thumbnails[0].url, '['+ps.status+', '+ps.reason+']'];\nvar q=o.videoDetails, r=mfr.playerMicroformatRenderer;\nvar p=q.title, u=parseInt(q.lengthSeconds), t=r.title.simpleText, h=r.thumbnail.thumbnails[0].url;\nvar ss=u % 60, mm=(u - ss) / 60 % 60, hh=(u - ss - mm * 60) / 3600;\nvar rt=Number(q.averageRating)\nvar c=[p, p !== t && t, q.author, r.publishDate, rt&&((rt<3 ? '🖓 ' : '🖒 ')+rt.toFixed(2)), '👁 '+(q.viewCount|0).toLocaleString(), (hh === 0 ? '' : hh + ':') + ('0' + mm).slice(-2) + ':' + ('0' + ss).slice(-2), q.shortDescription].filter(Boolean).join(' | ')\nif(ps.status !== 'OK') return [h, '['+ps.status+', '+ps.reason+'] ' + c];\nvar fs = o.streamingData.formats;\nif (!fs) return [h, '[No streamingData.formats, probably livestreaming] ' + c];\nfs.forEach(function(format){\n if (format.url) { f[format.itag] = nt(format.url); return;}\n cipher = new URLSearchParams(format.signatureCipher)\n if (cipher.get('sig')) { f[format.itag] = `${cipher.get('url')}&signature=${cipher.get('sig')}`; return;}\n g=true;\n});\nif (g) {\n try {\n c = '*' + c\n const parseDecsig = data => {\n if (data.startsWith('var script')) {\n // they inject the script via script tag\n const obj = {}\n const document = {\n createElement: () => obj,\n head: { appendChild: () => {} }\n }\n eval(data)\n data = obj.innerHTML\n }\n const fnnameresult = /=([a-zA-Z0-9\\$]+?)\\(decodeURIComponent/.exec(data)\n const fnname = fnnameresult[1]\n const _argnamefnbodyresult = new RegExp(escapeRegExp(fnname) + '=function\\\\((.+?)\\\\){(.+?)}').exec(data)\n const [_, argname, fnbody] = _argnamefnbodyresult\n const helpernameresult = /;(.+?)\\..+?\\(/.exec(fnbody)\n const helpername = helpernameresult[1]\n const helperresult = new RegExp('var ' + escapeRegExp(helpername) + '={[\\\\s\\\\S]+?};').exec(data)\n const helper = helperresult[0]\n return new Function([argname], helper + '\\n' + fnbody)\n }\n decsig = parseDecsig(basejs)\n } catch (ex) {\n console.error(ex)\n }\n fs.forEach(function(format){\n if (f[format.itag]) return;\n cipher = new URLSearchParams(format.signatureCipher)\n f[format.itag] = nt(`${cipher.get('url')}&${cipher.get('sp') || 'signature'}=${decsig(cipher.get('s'))}`)\n });\n}\ne = f[37] || f[22] || f[18] || f[59] || f[78] || f[46] || f[45] || f[44] || f[43];\nd = f[18] || f[59] || f[78] || f[46] || f[45] || f[44] || f[43] || f[37] || f[22];\nvar ct = ($[3] ? '#t='+$[3]+($[4] ? ','+$[4] : '')+'&' : '')+'#mp4';\ne = e ? (d === e ? [[e+ct, c]] : [[e+ct, c], [d+ct, c]]) : e\nreturn e ? (thumb_first ? [[h, c]].concat(e) : e.concat([[h, c]])) : [h, c]", "img": "^i(?:\\d|mg)?\\.ytimg\\.com/(?:vi|an_webp)[^/]*/([\\w\\-]{11})/(?:[\\w]+?)\\.(?:\\w+)", "loop": 2, "to": "www.youtube.com/embed/$1?thumb", "note": "Small modification by Imagus_fan to hopefully fix breakage\nDulus_No\nhttps://www.reddit.com/r/imagus/comments/uldmok/comment/iswnqal\nOLD\nhttps://www.reddit.com/r/imagus/comments/uldmok/comment/irfqcue\nhttps://www.reddit.com/r/imagus/comments/r19duk/super_slow_youtube_loading_and_buffering_time_on/hlyczin\nhttps://www.reddit.com/r/imagus/comments/nccjcp/youtube_no_longer_working/\n\n!!!\nОсновной фильтр для YouTube, по умолчанию - включен.\n+\nПоказывает сначала полноразмерную обложку ролика, потом - видео в разрешении 720p и далее - видео в более низком разрешении. Переключение режимов происходит колесиком мыши, по принципу альбома. Можно поменять этот порядок - сначала видео, потом картинка - установив в параметрах фильтра var thumb_first = false.\n+\nПри выборе этого фильтра старый дефолтный фильтр [youtube] должен быть отключен.\n+\nДля более надежного срабатывания рекомендуется установка расширения uBO (uBlock Origin) и фильтров для него (вкладка \"Мои фильтры\"):\nyoutube.com###hover-overlays\nyoutube.com###mouseover-overlay\n+\nДля перемотки видео (в режиме \"зумирования\") можно использовать сочетание клавиш CTRL+RIGHT/CTRL+LEFT. в Imagus Mod можно назначить любые клавиши, например RIGHT/LEFT.\n+\nФильтр работает в т.ч. и на внешних ссылках - но для Хромиум-браузеров требуется установка расширения SMH и правил к нему - см. FAQ, п.12.\n+\nИзвестные ограничения:\n1. Не показывает ролики разрешением выше 720p.\nhttps://www.reddit.com/r/imagus/comments/4jmost/comment/d3ffsmu\n2. Не показывает некоторые ролики с возрастным ограничением.\nhttps://github.com/yt-dlp/yt-dlp/pull/575#issuecomment-888837000.\n==\nBasic rule for YouTube, enabled by default.\n+\nShows first a full-size cover of the video, then a 720p video and then a lower-resolution video. Switching modes occurs with the mouse wheel, according to the principle of the album. You can change this order - first the video, then the picture - by setting var thumb_first = false in the sieve parameters.\n+\nWhen selecting this rule, the old default rule [youtube] should be disabled.\n+\nFor more reliable operation, it is recommended to install the uBO (uBlock Origin) extension and the filters for it (on the \"My filters\" tab):\nyoutube.com###hover-overlays\nyoutube.com###mouseover-overlay\n+\nTo rewind the video (in the \"zoom\" mode), you can use the keyboard shortcut CTRL+RIGHT/CTRL+LEFT. In Imagus Mod you may assign RIGHT/LEFT key.\n+\nThe rule works on external links for Firefox, but for Chromium browsers the SMH extension and its rules must be installed - see FAQ, p.12.\n+\nKnown limitations:\n1. Only displays videos at 720p.\nhttps://www.reddit.com/r/imagus/comments/4jmost/comment/d3ffsmu\n2. Age-gated tier 4 from can't be bypassed.\nhttps://github.com/yt-dlp/yt-dlp/pull/575#issuecomment-888837000.\n\n\nПРИМЕРЫ / EXAMPLES:\n(внешние ссылки / external links)\nhttps://www.reddit.com/domain/youtube.com/\nhttps://www.reddit.com/r/imagus/comments/r19duk/comment/hxfd2pa" } }
Editor is loading...
Leave a Comment