Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Найти фильм в ВК, RuTube или flcksbr — ФИНАЛЬНАЯ ВЕРСИЯ 2025
- // @namespace http://tampermonkey.net/
- // @version 1.6
- // @description Добавляет кнопки поиска фильма в ВК, RuTube и открытия на flcksbr через sspoisk.ru. Использует актуальные селекторы и прямые URL.
- // @author @shittykitty_
- // @match *://www.kinopoisk.ru/film/*
- // @match *://www.imdb.com/title/*
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- function addButton() {
- let title = "";
- let targetElement = null;
- let filmId = null;
- // Извлекаем ID фильма из URL (только для Кинопоиска)
- if (window.location.hostname.includes("kinopoisk.ru")) {
- const match = window.location.pathname.match(/\/film\/(\d+)\//);
- if (match) {
- filmId = match[1];
- }
- const selectors = [
- 'span[data-tid="75209b22"]', // АКТУАЛЬНЫЙ 2025
- '.film-header__title',
- '.film-page__title',
- 'h1[itemprop="name"]',
- 'h1',
- 'span[itemprop="name"]'
- ];
- for (let sel of selectors) {
- const el = document.querySelector(sel);
- if (el && el.innerText.trim().length > 0) {
- title = el.innerText.trim();
- targetElement = el;
- break;
- }
- }
- }
- // Для IMDb
- if (window.location.hostname.includes("imdb.com")) {
- const selectors = [
- 'h1[data-testid="hero__pageTitle"]',
- '.hero__primary-text',
- 'h1[itemprop="name"]',
- 'h1'
- ];
- for (let sel of selectors) {
- const el = document.querySelector(sel);
- if (el && el.innerText.trim().length > 0) {
- title = el.innerText.trim();
- targetElement = el;
- break;
- }
- }
- }
- if (!title || !targetElement) return;
- // Проверяем, не добавлены ли уже кнопки
- if (targetElement.parentNode.querySelector('.film-search-btns')) return;
- // Контейнер для кнопок
- const container = document.createElement("div");
- container.className = "film-search-btns";
- container.style.cssText = `
- display: flex;
- gap: 8px;
- margin: 12px 0 12px 16px;
- flex-wrap: wrap;
- `;
- // Кнопка ВК
- const btnVK = document.createElement("button");
- btnVK.innerText = "🔍 Найти в ВК";
- btnVK.style.cssText = `
- padding: 10px 16px;
- background: #4C75A3;
- color: white;
- border: none;
- border-radius: 8px;
- cursor: pointer;
- font-size: 14px;
- font-weight: bold;
- box-shadow: 0 2px 5px rgba(0,0,0,0.2);
- transition: all 0.2s ease;
- `;
- btnVK.onmouseover = () => {
- btnVK.style.background = "#3a5a7f";
- btnVK.style.transform = "translateY(-1px)";
- btnVK.style.boxShadow = "0 4px 8px rgba(0,0,0,0.3)";
- };
- btnVK.onmouseout = () => {
- btnVK.style.background = "#4C75A3";
- btnVK.style.transform = "translateY(0)";
- btnVK.style.boxShadow = "0 2px 5px rgba(0,0,0,0.2)";
- };
- btnVK.addEventListener("click", (e) => {
- e.preventDefault();
- const vkUrl = `https://vk.com/search/video?q=${encodeURIComponent(title)}`;
- window.open(vkUrl, "_blank", "noopener,noreferrer");
- });
- // Кнопка RuTube
- const btnRuTube = document.createElement("button");
- btnRuTube.innerText = "🎥 Найти в RuTube";
- btnRuTube.style.cssText = `
- padding: 10px 16px;
- background: #E63946;
- color: white;
- border: none;
- border-radius: 8px;
- cursor: pointer;
- font-size: 14px;
- font-weight: bold;
- box-shadow: 0 2px 5px rgba(0,0,0,0.2);
- transition: all 0.2s ease;
- `;
- btnRuTube.onmouseover = () => {
- btnRuTube.style.background = "#c1121f";
- btnRuTube.style.transform = "translateY(-1px)";
- btnRuTube.style.boxShadow = "0 4px 8px rgba(0,0,0,0.3)";
- };
- btnRuTube.onmouseout = () => {
- btnRuTube.style.background = "#E63946";
- btnRuTube.style.transform = "translateY(0)";
- btnRuTube.style.boxShadow = "0 2px 5px rgba(0,0,0,0.2)";
- };
- btnRuTube.addEventListener("click", (e) => {
- e.preventDefault();
- const rutubeUrl = `https://rutube.ru/search/?query=${encodeURIComponent(title)}`;
- window.open(rutubeUrl, "_blank", "noopener,noreferrer");
- });
- // Кнопка flcksbr (только если есть filmId и это Кинопоиска)
- if (filmId && window.location.hostname.includes("kinopoisk.ru")) {
- const btnFlcksbr = document.createElement("button");
- btnFlcksbr.innerText = "📺 Открыть в flcksbr";
- btnFlcksbr.style.cssText = `
- padding: 10px 16px;
- background: #5A4FCF;
- color: white;
- border: none;
- border-radius: 8px;
- cursor: pointer;
- font-size: 14px;
- font-weight: bold;
- box-shadow: 0 2px 5px rgba(0,0,0,0.2);
- transition: all 0.2s ease;
- `;
- btnFlcksbr.onmouseover = () => {
- btnFlcksbr.style.background = "#453bb0";
- btnFlcksbr.style.transform = "translateY(-1px)";
- btnFlcksbr.style.boxShadow = "0 4px 8px rgba(0,0,0,0.3)";
- };
- btnFlcksbr.onmouseout = () => {
- btnFlcksbr.style.background = "#5A4FCF";
- btnFlcksbr.style.transform = "translateY(0)";
- btnFlcksbr.style.boxShadow = "0 2px 5px rgba(0,0,0,0.2)";
- };
- btnFlcksbr.addEventListener("click", (e) => {
- e.preventDefault();
- const flcksbrUrl = `https://www.sspoisk.ru/film/${filmId}/`;
- window.open(flcksbrUrl, "_blank", "noopener,noreferrer");
- });
- container.appendChild(btnFlcksbr);
- }
- // Добавляем кнопки в контейнер
- container.appendChild(btnVK);
- container.appendChild(btnRuTube);
- // Вставляем рядом с заголовком
- targetElement.parentNode.insertBefore(container, targetElement.nextSibling);
- }
- // Запускаем после загрузки
- if (document.readyState === "loading") {
- document.addEventListener("DOMContentLoaded", addButton);
- } else {
- addButton();
- }
- // Наблюдаем за изменениями DOM — для SPA
- const observer = new MutationObserver(() => {
- addButton();
- });
- observer.observe(document.body, { childList: true, subtree: true });
- })();
Advertisement
Add Comment
Please, Sign In to add comment