Last active
February 21, 2026 05:12
-
-
Save xdegeneratex/5705f5f68fb1be3470e8f807adb33a70 to your computer and use it in GitHub Desktop.
Coomer Video Viewer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Coomer Video Viewer | |
| // @namespace https://github.com/xdegeneratex | |
| // @version 2025-06-30 | |
| // @description View Coomer video in the browser. | |
| // @author https://github.com/xdegeneratex | |
| // @match https://coomer.su/*/user/*/post/* | |
| // @icon https://www.google.com/s2/favicons?sz=64&domain=coomer.su | |
| // @grant none | |
| // ==/UserScript== | |
| (async () => { | |
| 'use strict'; | |
| let attempts = 0; | |
| let targetNode = document.querySelector('.post__attachment-link'); | |
| while (!targetNode && attempts < 5) { | |
| await new Promise((resolve) => setTimeout(() => resolve(true), 1000)); | |
| targetNode = document.querySelector('.post__attachment-link'); | |
| attempts++; | |
| } | |
| if (!targetNode) { | |
| console.error("[Coomer Video Viewer]: No Attacment Found. Quitting..."); | |
| return; | |
| } | |
| [...document.querySelectorAll('.post__attachment-link')].forEach(link => { | |
| const linkText = link.textContent; | |
| if (!linkText) { | |
| return false; | |
| } | |
| const ext = linkText.split('.').pop(); | |
| if (!/^(mp4|m4v|mov|mpeg|wmv|webm|mkv)$/.test(ext)) { | |
| return false; | |
| } | |
| const viewInBrowserLink = link.cloneNode(true); | |
| viewInBrowserLink.target = "_blank"; | |
| viewInBrowserLink.href = link.href.replace(/\?.*/, ''); | |
| viewInBrowserLink.textContent = '▶ Play In Browser'; | |
| viewInBrowserLink.style.marginLeft = '10px'; | |
| link.insertAdjacentElement('afterend', viewInBrowserLink); | |
| viewInBrowserLink.addEventListener('click', e => { | |
| e.preventDefault(); | |
| const videoUrl = viewInBrowserLink.href; | |
| const videoWindow = window.open('', '_blank'); | |
| videoWindow.document.write(` | |
| <html><head><title>Video Player</title></head> | |
| <body style="margin:0; background-color: #000;"> | |
| <video src="${videoUrl}" controls autoplay style="width:100vw; height:100vh;"></video> | |
| </body></html> | |
| `); | |
| videoWindow.document.close(); | |
| }); | |
| }); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment