Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {"YOUTUBE-q-h-p":{"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})(?!&lc=)(?:\\?(thumb\\b))?(?:[?&](?:star)?t=(\\d+(?:\\.\\d+)?)s?)?(?:&end=(\\d+(?:\\.\\d+)?)s?)?.*$","url":": (()=>{ var disable_on_thumbs = false , disable_on_links = false , disable_on_iframe = false ; if(disable_on_iframe&&this.node.IMGS_TRG?.localName==='iframe'||disable_on_links&&!this.node.IMGS_TRG||disable_on_thumbs&&(/\\/embed\\/[\\w-]{11}\\?thumb\\?/.test(this.node.href)||this.node.id===\"thumbnail\")||(this.node.nodeName===\"YTD-BADGE-SUPPORTED-RENDERER\"||this.node.id!==undefined&&this.node.id!=='title'&&this.node.id!=='video-title'&&/^(?:yt-simple-endpoint style-scope ytd-compact-movie-renderer|movie-metadata style-scope ytd-compact-movie-renderer|badge badge-style-type-ypc style-scope ytd-badge-supported-renderer style-scope ytd-badge-supported-renderer|ytp-impression-link(?:-[a-z]+)?|badge badge-style-type-live-now-alternate style-scope ytd-badge-supported-renderer style-scope ytd-badge-supported-renderer|ytp-youtube-button ytp-button yt-uix-sessionlink|ytp-title-link yt-uix-sessionlink|style-scope ytd-thumbnail-overlay-hover-text-renderer|progress|style-scope ytd-thumbnail-overlay-toggle-button-renderer|playlist-drag-handle style-scope ytd-playlist-panel-video-renderer|style-scope ytd-thumbnail(?:-overlay-time-status-renderer)?|style-scope ytd-playlist-panel-video-renderer|editable style-scope ytd-playlist-panel-video-renderer style-scope ytd-playlist-panel-video-renderer|yt-simple-endpoint style-scope ytd-structured-description-playlist-lockup-renderer|style-scope ytd-macro-markers-list-item-renderer|style-scope ytd-structured-description-playlist-lockup-renderer|yt-simple-endpoint style-scope ytd-structured-description-video-lockup-renderer|style-scope ytd-structured-description-video-lockup-renderer|style-scope ytd-badge-supported-renderer|badge badge-style-type-simple style-scope ytd-badge-supported-renderer style-scope ytd-badge-supported-renderer|yt-simple-endpoint style-scope ytd-compact-video-renderer|badges style-scope ytd-compact-video-renderer|style-scope ytd-video-meta-block)$/.test(this.node.className)))throw new Error('YouTube sieve not used on this page element');return 'https://www.youtube.com/embed/'+$[1]+'?'+$[2]+'&'+$[3]+'&'+$[4]})()","res":":\n// config options\nvar config = {\n// change the display order of the image/videos by using 1, 2, 3, or 4. disable with 0\n order: {\n \"thumb\": 1,\n \"native (360p)\": 2,\n \"hls (1080p/4K)\": 3,\n \"embed (360p-1080p)\": 4\n },\n returnDislikes: true, // get dislikes and rating from ReturnYouTubeDislike.com\n useSidebar: true, // show description at the left of the thumbnail (Requires either thumbVideoInfo, nativeVideoInfo, or both to be set to true)\n lowResFirst: false, // native player shows 360p video, toggle resolution with TAB\n useSmallerThumbnail: false, // use lower resolution thumbnail\n thumbVideoInfo: true, // display sidebar or detailed caption on thumbnail\n nativeVideoInfo: false // display sidebar or detailed caption on native player\n}\n\nfallback = () => {\n this.TRG.IMGS_ext_data = [['', `<imagus-extension type=\"iframe\" url=\"https://youtube.com/embed/${$[1]}?${timeParam}\"></imagus-extension>`]]\n return { loop: 'imagus://extension' }\n}\n\nvar fL, fH, f = {}, g = false, cipher, decsig, o, mfr, ps, basejs, hls\nvar x = new XMLHttpRequest\nwindow.imagusCache = window.imagusCache || {}\n\nvar timeParam = ($[3] ? 't=' + $[3] + ($[4] ? ',' + $[4] : '') + '&' : '')\nvar baseJsUrl = 'https://www.youtube.com' + JSON.parse($._.match(/\\\"[^\\\"]+player_[^\\\"]+\\/base.js\\\"/)[0])\nif (window.imagusCache[baseJsUrl]) {\n basejs = window.imagusCache[baseJsUrl]\n} else {\n try {\n x.open('GET', baseJsUrl, false)\n x.send()\n basejs = x.responseText\n window.imagusCache[baseJsUrl] = basejs\n } catch (e) {\n return fallback(this)\n }\n}\n\nconst escapeRegExp = s => s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\nconst parseunthrottle = data => {\n const fnnameresult = /\\.[A-Za-z]&&\\([A-Za-z]=[A-Za-z]+\\(\\),[A-Za-z]{2}\\([A-Za-z]\\),[A-Za-z]=[A-Za-z]\\.[A-Za-z]\\[[A-Za-z]\\]\\|\\|null\\)&&\\([A-Za-z]=([^(]+?)(?:\\[(\\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 \\\\w\\\\.join\\\\(\"\"\\\\))};', 's').exec(data)\n const [_, argname, fnbody] = _argnamefnbodyresult\n return new Function([argname], fnbody.replace(/if\\(typeof \\w+===\"undefined\"\\)return \\w;/,''))\n}\ntry {\n var unthrottle = window.imagusCache[baseJsUrl + '_unthrottle'] || parseunthrottle(basejs)\n window.imagusCache[baseJsUrl + '_unthrottle'] = unthrottle\n} catch(e) {\n console.error('Imagus: cannot parse unthrottle function. Error:', e)\n}\n\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 ? 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/%70%6C%61%79%65%72?imagus&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}\n\nfunction getDislikes(id) {\n try {\n x.open('GET', `https://returnyoutubedislikeapi.com/Votes?videoId=${id}`, false)\n x.send()\n return JSON.parse(x.responseText)\n } catch (e) { }\n}\n\nconst prepResult = (res, content) => {\n // hls\n if(hls)res.push(['', `<imagus-extension type=\"videojs\" url=\"${hls}\"></imagus-extension>${title}`])\n // embeded player\n res.push(['', `<imagus-extension type=\"videojs\" url=\"https://youtube.com/embed/${$[1]}?${timeParam}\"></imagus-extension>`])\n\n if (config.useSmallerThumbnail) res[0][0] = res[0][0].replace('maxresdefault', '0')\n\n if (config.useSidebar) {\n content = content.replace(/https?:\\/\\/[\\w\\.\\/?=&+@#\\-]+/g, '<a href=\"$&\" target=\"_blank\">$&</a>')\n if(config.nativeVideoInfo&&fL?.length)res.find(i=>/\\.googlevideo\\.com\\/videoplayback\\?/.test(i[0]))[1] = `<imagus-extension type=\"sidebar\">${content}</imagus-extension>`\n if(config.thumbVideoInfo)res.find(i=>/\\.ytimg\\.com\\//.test(i[0]))[1] = `<imagus-extension type=\"sidebar\">${content}</imagus-extension>`\n } else {\n content = content.replace(/https?:\\/\\/[\\w\\.\\/?=&+@#\\-]+/g, '')\n content = content.replace(/[\\s\\n]*\\n[\\s\\n]*/g, ' | ')\n if(config.nativeVideoInfo&&fL?.length)res.find(i=>/\\.googlevideo\\.com\\/videoplayback\\?/.test(i[0]))[1] = content\n if(config.thumbVideoInfo)res.find(i=>/\\.ytimg\\.com\\//.test(i[0]))[1] = content\n }\n var orderSort = Object.entries(config.order).filter(i=>i[1]>=1).sort((a,b)=>a[1]-b[1]).map(i=>i[0])\n var ordered = orderSort.map(type => {\n switch (type) {\n case 'thumb': return res[0]\n case 'native (360p)': return res[1] || res[2]\n case 'hls (1080p/4K)': return res[2] || res[1]\n case 'embed (360p-1080p)': return res[3] || res[2] || res[1]\n }\n })\n ordered.length = res.length\n ordered = ordered.filter(Boolean)\n this.TRG.IMGS_ext_data = ordered\n return { loop: 'imagus://extension' }\n}\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 title = q.title, lenSec = parseInt(q.lengthSeconds), sText = r.title.simpleText, thumbnail = r.thumbnail.thumbnails[0].url+'?noloop'\nvar ss = lenSec % 60, mm = (lenSec - ss) / 60 % 60, hh = (lenSec - ss - mm * 60) / 3600\nvar lenStr = (hh === 0 ? '' : hh + ':') + ('0' + mm).slice(-2) + ':' + ('0' + ss).slice(-2)\nvar rt = Number(q.averageRating)\nvar dl = config.returnDislikes ? getDislikes(q.videoId) : undefined\nif (dl?.rating) {\n var colorShift = Math.round(120 * Math.max(0, dl.rating - 3) / 2) // rates from 0 to 3 will be red; from 3 to 5: scale from red to green\n var rateStyle = `background-color: hsl(${colorShift} 100% 31%); padding: 0 3px 0 1px; border-radius: 2px; color: white; line-height: 18px; display: inline-block`\n dl.rating = `<span style=\"${rateStyle}\">⭐${Math.round(dl.rating * 20 * 10) / 10}%</span>`\n}\nvar descr = [\n `<h3>${title}</h3>`,\n title !== sText && sText,\n 'Author:\\t<a href=\"//www.youtube.com/channel/' + q.channelId + '\" target=\"_blank\" style=\"color:white\">' + q.author + '</a>',\n 'Date:\\t' + (r.publishDate ? new Date(Date.parse(r.publishDate)).toLocaleString() : ''),\n 'Length:\\t' + lenStr,\n 'Views:\\t' + (q.viewCount | 0).toLocaleString(),\n dl ? `Rating:\\t${dl.rating} | 👍🏻${dl.likes?.toLocaleString()} | 👎🏻${dl.dislikes?.toLocaleString()} <br>(by returnyoutubedislike.com)` : '',\n '\\n' + q.shortDescription\n].filter(Boolean).join('\\n')\n\nif (ps.status !== 'OK') return prepResult([[thumbnail, '']], `<h3>${ps.status} - ${ps.reason}</h3><br>` + descr)\n\nvar fs = o.streamingData.formats\n\nif(Number(config.order['hls (1080p/4K)']) > 0){\n x.open('POST', 'https://www.youtube.com/youtubei/v1/%70%6C%61%79%65%72?imagus&key=' + api_key, false)\n x.setRequestHeader('Content-Type', 'application/json')\n var hls_data = {\n context: {\n client: {\n clientName: 'IOS',\n clientVersion: '19.09.3',\n deviceModel: 'iPhone14,3',\n userAgent: 'com.google.ios.youtube/19.09.3 (iPhone14,3; U; CPU iOS 15_6 like Mac OS X)',\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 x.send(JSON.stringify(hls_data))\n hls = JSON.parse(x.responseText).streamingData?.hlsManifestUrl\n }\nif (!fs) return prepResult([[thumbnail, '']], '<h3>No suitable formats to download, probably livestreaming</h3><br>' + descr)\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 descr = '*' + descr\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}\n\nfL = f[18] || f[59] || f[78] || f[46] || f[45] || f[44] || f[43] || f[37] || f[22]\nfH = f[37] || f[22] || f[18] || f[59] || f[78] || f[46] || f[45] || f[44] || f[43] || fL\nvar ct = (timeParam ? '#' + timeParam : '') + '#mp4'\n\nvar res = [[thumbnail, title]]\nif (fH) {\n fH = [(!config.lowResFirst ? '#' : '') + fH + ct, (config.lowResFirst ? '#' : '') + fL + ct]\n res.push([fH, title])\n}\nreturn prepResult(res, descr)","img":"^(?:i(?:\\d|mg)?\\.ytimg\\.com/(?:vi|an_webp)[^/]*/([\\w\\-]{11})/(?:[\\w]+?)\\.(?:\\w+)(?!.*[&?]noloop)|^(?:(?:(?:(?:\\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})(?!&lc=)(?:\\?(thumb\\b))?(?:[?&](?:star)?t=(\\d+(?:\\.\\d+)?)s?)?(?:&end=(\\d+(?:\\.\\d+)?)s?)?.*$)","loop":2,"to":"www.youtube.com/embed/$1$2?thumb","note":"Dulus_No + hababr/Imagus_fan (edit)\nhttps://old.reddit.com/r/imagus/comments/1hb2fmu/the_native_player_in_the_youtubep_sieve_stopped/m1nq37f/\nOLD\nhttps://www.reddit.com/r/imagus/comments/1ftusq5/comment/lpzeorh\nhttps://www.reddit.com/r/imagus/comments/1ftusq5/comment/lpvtoy5\nhttps://www.reddit.com/r/imagus/comments/1epkwu4/comment/lho76ct\n\n\n\n!!!\nВся информация о возможностях и особенностях фильтра, а также о представленных в нем опциях: ЧаВо, п.11.\n==\nAll information about the capabilities and features of the sieve, and also about the options presented in it: see FAQ, p.11.\n\n\nПРИМЕРЫ / EXAMPLES\nhttps://www.reddit.com/domain/youtube.com/new\nhttps://www.reddit.com/r/imagus/comments/r19duk/comment/hxfd2pa\nhttps://www.reddit.com/r/imagus/comments/18pcszv/comment/kj7uh7s\nhttps://www.youtube.com/playlist?list=UUMOXuqSBlHAE6Xw-yeJA0Tunw"}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement