您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Convert Facebook reel links to watch links
// ==UserScript== // @name Facebook Reel to Watch Link Converter // @namespace http://tampermonkey.net/ // @version 0.3 // @description Convert Facebook reel links to watch links // @author w4t3r1ily // @match *://*/* // @include * // @grant none // @icon https://cdn.iconscout.com/icon/free/png-512/free-instagram-reel-6807451-5582462.png? // ==/UserScript== (function() { 'use strict'; // Function to create the new watch link element with an arrow sign function createWatchLink(videoId) { const watchLink = document.createElement('a'); watchLink.href = `https://www.facebook.com/watch/?v=${videoId}`; // Construct the watch URL using the video ID watchLink.textContent = `⇒ https://www.facebook.com/watch/?v=${videoId}`; // Set the text content of the link with an arrow sign return watchLink; // Return the newly created link element } // Get all anchor elements on the page const links = document.querySelectorAll('a'); // Iterate over each link links.forEach(link => { // Match the URL against the specific Facebook reel pattern and extract the video ID const match = link.href.match(/https:\/\/www\.facebook\.com\/reel\/(\d+)/); if (match) { const videoId = match[1]; // Extract the video ID from the matched pattern const watchLink = createWatchLink(videoId); // Create a watch link using the extracted video ID // Create a line break element const lineBreak = document.createElement('br'); // Insert the line break and then the new link below the original link link.insertAdjacentElement('afterend', lineBreak); // Insert the line break after the original link lineBreak.insertAdjacentElement('afterend', watchLink); // Insert the new watch link after the line break } }); })();