Guest User

Найти фильм в ВК, RuTube или flcksbr

a guest
Sep 7th, 2025
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Найти фильм в ВК, RuTube или flcksbr — ФИНАЛЬНАЯ ВЕРСИЯ 2025
  3. // @namespace    http://tampermonkey.net/
  4. // @version      1.6
  5. // @description  Добавляет кнопки поиска фильма в ВК, RuTube и открытия на flcksbr через sspoisk.ru. Использует актуальные селекторы и прямые URL.
  6. // @author       @shittykitty_
  7. // @match        *://www.kinopoisk.ru/film/*
  8. // @match        *://www.imdb.com/title/*
  9. // @grant        none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13.     'use strict';
  14.  
  15.     function addButton() {
  16.         let title = "";
  17.         let targetElement = null;
  18.         let filmId = null;
  19.  
  20.         // Извлекаем ID фильма из URL (только для Кинопоиска)
  21.         if (window.location.hostname.includes("kinopoisk.ru")) {
  22.             const match = window.location.pathname.match(/\/film\/(\d+)\//);
  23.             if (match) {
  24.                 filmId = match[1];
  25.             }
  26.  
  27.             const selectors = [
  28.                 'span[data-tid="75209b22"]', // АКТУАЛЬНЫЙ 2025
  29.                 '.film-header__title',
  30.                 '.film-page__title',
  31.                 'h1[itemprop="name"]',
  32.                 'h1',
  33.                 'span[itemprop="name"]'
  34.             ];
  35.             for (let sel of selectors) {
  36.                 const el = document.querySelector(sel);
  37.                 if (el && el.innerText.trim().length > 0) {
  38.                     title = el.innerText.trim();
  39.                     targetElement = el;
  40.                     break;
  41.                 }
  42.             }
  43.         }
  44.  
  45.         // Для IMDb
  46.         if (window.location.hostname.includes("imdb.com")) {
  47.             const selectors = [
  48.                 'h1[data-testid="hero__pageTitle"]',
  49.                 '.hero__primary-text',
  50.                 'h1[itemprop="name"]',
  51.                 'h1'
  52.             ];
  53.             for (let sel of selectors) {
  54.                 const el = document.querySelector(sel);
  55.                 if (el && el.innerText.trim().length > 0) {
  56.                     title = el.innerText.trim();
  57.                     targetElement = el;
  58.                     break;
  59.                 }
  60.             }
  61.         }
  62.  
  63.         if (!title || !targetElement) return;
  64.  
  65.         // Проверяем, не добавлены ли уже кнопки
  66.         if (targetElement.parentNode.querySelector('.film-search-btns')) return;
  67.  
  68.         // Контейнер для кнопок
  69.         const container = document.createElement("div");
  70.         container.className = "film-search-btns";
  71.         container.style.cssText = `
  72.             display: flex;
  73.             gap: 8px;
  74.             margin: 12px 0 12px 16px;
  75.             flex-wrap: wrap;
  76.         `;
  77.  
  78.         // Кнопка ВК
  79.         const btnVK = document.createElement("button");
  80.         btnVK.innerText = "🔍 Найти в ВК";
  81.         btnVK.style.cssText = `
  82.             padding: 10px 16px;
  83.             background: #4C75A3;
  84.             color: white;
  85.             border: none;
  86.             border-radius: 8px;
  87.             cursor: pointer;
  88.             font-size: 14px;
  89.             font-weight: bold;
  90.             box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  91.             transition: all 0.2s ease;
  92.         `;
  93.         btnVK.onmouseover = () => {
  94.             btnVK.style.background = "#3a5a7f";
  95.             btnVK.style.transform = "translateY(-1px)";
  96.             btnVK.style.boxShadow = "0 4px 8px rgba(0,0,0,0.3)";
  97.         };
  98.         btnVK.onmouseout = () => {
  99.             btnVK.style.background = "#4C75A3";
  100.             btnVK.style.transform = "translateY(0)";
  101.             btnVK.style.boxShadow = "0 2px 5px rgba(0,0,0,0.2)";
  102.         };
  103.         btnVK.addEventListener("click", (e) => {
  104.             e.preventDefault();
  105.             const vkUrl = `https://vk.com/search/video?q=${encodeURIComponent(title)}`;
  106.             window.open(vkUrl, "_blank", "noopener,noreferrer");
  107.         });
  108.  
  109.         // Кнопка RuTube
  110.         const btnRuTube = document.createElement("button");
  111.         btnRuTube.innerText = "🎥 Найти в RuTube";
  112.         btnRuTube.style.cssText = `
  113.             padding: 10px 16px;
  114.             background: #E63946;
  115.             color: white;
  116.             border: none;
  117.             border-radius: 8px;
  118.             cursor: pointer;
  119.             font-size: 14px;
  120.             font-weight: bold;
  121.             box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  122.             transition: all 0.2s ease;
  123.         `;
  124.         btnRuTube.onmouseover = () => {
  125.             btnRuTube.style.background = "#c1121f";
  126.             btnRuTube.style.transform = "translateY(-1px)";
  127.             btnRuTube.style.boxShadow = "0 4px 8px rgba(0,0,0,0.3)";
  128.         };
  129.         btnRuTube.onmouseout = () => {
  130.             btnRuTube.style.background = "#E63946";
  131.             btnRuTube.style.transform = "translateY(0)";
  132.             btnRuTube.style.boxShadow = "0 2px 5px rgba(0,0,0,0.2)";
  133.         };
  134.         btnRuTube.addEventListener("click", (e) => {
  135.             e.preventDefault();
  136.             const rutubeUrl = `https://rutube.ru/search/?query=${encodeURIComponent(title)}`;
  137.             window.open(rutubeUrl, "_blank", "noopener,noreferrer");
  138.         });
  139.  
  140.         // Кнопка flcksbr (только если есть filmId и это Кинопоиска)
  141.         if (filmId && window.location.hostname.includes("kinopoisk.ru")) {
  142.             const btnFlcksbr = document.createElement("button");
  143.             btnFlcksbr.innerText = "📺 Открыть в flcksbr";
  144.             btnFlcksbr.style.cssText = `
  145.                 padding: 10px 16px;
  146.                 background: #5A4FCF;
  147.                 color: white;
  148.                 border: none;
  149.                 border-radius: 8px;
  150.                 cursor: pointer;
  151.                 font-size: 14px;
  152.                 font-weight: bold;
  153.                 box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  154.                 transition: all 0.2s ease;
  155.             `;
  156.             btnFlcksbr.onmouseover = () => {
  157.                 btnFlcksbr.style.background = "#453bb0";
  158.                 btnFlcksbr.style.transform = "translateY(-1px)";
  159.                 btnFlcksbr.style.boxShadow = "0 4px 8px rgba(0,0,0,0.3)";
  160.             };
  161.             btnFlcksbr.onmouseout = () => {
  162.                 btnFlcksbr.style.background = "#5A4FCF";
  163.                 btnFlcksbr.style.transform = "translateY(0)";
  164.                 btnFlcksbr.style.boxShadow = "0 2px 5px rgba(0,0,0,0.2)";
  165.             };
  166.             btnFlcksbr.addEventListener("click", (e) => {
  167.                 e.preventDefault();
  168.                 const flcksbrUrl = `https://www.sspoisk.ru/film/${filmId}/`;
  169.                 window.open(flcksbrUrl, "_blank", "noopener,noreferrer");
  170.             });
  171.  
  172.             container.appendChild(btnFlcksbr);
  173.         }
  174.  
  175.         // Добавляем кнопки в контейнер
  176.         container.appendChild(btnVK);
  177.         container.appendChild(btnRuTube);
  178.  
  179.         // Вставляем рядом с заголовком
  180.         targetElement.parentNode.insertBefore(container, targetElement.nextSibling);
  181.     }
  182.  
  183.     // Запускаем после загрузки
  184.     if (document.readyState === "loading") {
  185.         document.addEventListener("DOMContentLoaded", addButton);
  186.     } else {
  187.         addButton();
  188.     }
  189.  
  190.     // Наблюдаем за изменениями DOM — для SPA
  191.     const observer = new MutationObserver(() => {
  192.         addButton();
  193.     });
  194.     observer.observe(document.body, { childList: true, subtree: true });
  195. })();
Advertisement
Add Comment
Please, Sign In to add comment