gpl2731
Junior Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору Код: {"O_vixen|tushy|tushyraw|blacked|slayed|deeper":{"link":"(vixen|tushy|tushyraw|blacked|blackedraw|slayed|deeper)\\.com/videos/[^#]+(?:#(.+))?","res":":\nif ($[2]) {\n return decodeURIComponent(atob($[2]));\n}\n\nconst vid_quality = 1; // 0=best, 1=2nd-best etc\n\nconst m = /videoTokenId\":\"(\\d+)/g.exec($._);\nconst vidId = m ? m[1] : null;\nif (!vidId) return;\n\nconst url_selector = $[0].split('/').slice(3).join('/');\nconst a_elems = document.querySelectorAll(`a[href*=\"${url_selector}\"]`);\n\nasync function getTrailer(vidId, a_elems) {\n const url = `https://www.${$[1]}.com/graphql`;\n\n fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: `{\"operationName\":\"getToken\",\"variables\":{\"videoId\":\"${vidId}\",\"device\":\"trailer\"},\"query\":\"query getToken($videoId: ID!, $device: Device!) {generateVideoToken(input: {videoId: $videoId, device: $device}) {p270 {token cdn __typename}p360 {token cdn __typename}p480 {token cdn __typename}p480l {token cdn __typename}p720 {token cdn __typename}p1080 {token cdn __typename}p2160 {token cdn __typename}hls {token cdn __typename}__typename}}\"}`,\n })\n .then(response => response.json())\n .then(data => {\n let trailer = null;\n let trailers = data.data.generateVideoToken;\n\n if (!trailers) return;\n\n const resolutions = Object.keys(trailers).sort((key1, key2) => {\n const res1 = Number(key1.replace(/[^\\d]/g, ''));\n const res2 = Number(key2.replace(/[^\\d]/g, ''));\n return res1 > res2 ? -1 : 1;\n });\n trailer = trailers[resolutions[vid_quality]].token;\n if (trailer) {\n [...a_elems].forEach(a_elem => {\n a_elem.href += `#${btoa(encodeURIComponent(trailer))}`;\n if (a_elem.innerText.length > 0) {\n a_elem.innerText =\n String.fromCodePoint(parseInt('25B6', 16)) +\n ' ' +\n a_elem.innerText;\n }\n if (location.hostname.includes($[1])) {\n if (!a_elem.getAttribute('data-test-component')) {\n a_elem.parentElement.style.cssText +=\n 'border-bottom: 3px solid #ebff00; !important';\n }\n if (\n a_elem.parentElement.getAttribute('data-test-component') ==\n 'FeaturedVideoListItem'\n ) {\n a_elem.childNodes[0].style.cssText +=\n 'border-top: 3px solid #ebff00; !important';\n }\n }\n });\n }\n });\n}\n\ngetTrailer(vidId, a_elems);\nreturn;\n","note":"by gpl2731\nhttp://forum.ru-board.com/topic.cgi?forum=5&topic=48222&start=3620#6"}} | Я поправил. Были некоторые лишние символы, которые мешали работе фильтра. Это должно быть исправлено сейчас. | Всего записей: 52 | Зарегистр. 26-09-2021 | Отправлено: 19:31 29-09-2021 | Исправлено: gpl2731, 19:45 29-09-2021 |
|