nsinister / videothumb2mpv Goto Github PK
View Code? Open in Web Editor NEWOpen videos in external player (mpv) by simply clicking on a thumbnail when browsing services like YouTube or Vimeo.
License: MIT License
Open videos in external player (mpv) by simply clicking on a thumbnail when browsing services like YouTube or Vimeo.
License: MIT License
Sorry if this isn't exactly the place to put it. I insinctively press the thumbnails to check new videos, and I wanted to know if . I tried editing the script by myself, but it's much better made than what i'm used to and there is no "WHEN #THIS-ID-IS-PRESSED" part that I can edit (i.e I'm to dumb to understand the script)
If there is a way to change the script so I can use the title instead? How should I go into doing that? I'm not looking for the script to accommodate me, telling me what to edit would be more than enough.
Thanks in advance, and thank you so much for the script. I used to have to pull up windows terminal for it, and man did that got tiresome quickly.
Edit 1: Well I'm dumb, re-reading I found that line 24 has the element in question that's used to trigger the "send to mpv" function. Still have no luck replacing it tho, tried ".ytd-compact-video-renderer.style-scope.metadata" but "ytd-thumbnail" just has it's own element name, unlike the "details" part of the thumbnail which is just a div (or I just don't know how to find a workaround). Any help is appreciated.
Edit 2: Ok is 1 in the morning and I've oficially spent too much on this. For anyone's future reference, the JS path that should be changed in line 24 should be "#dismissible > div > div.metadata.style-scope.ytd-compact-video-renderer > a"
, right here:
I'm closing the issue so I don't look more stupid than I look.
You can use this option in mpv.conf to make it so that the cookies are available to the mpv. This way you can watch private videos or mark them as watched. You would also need yt-dlp for this because this option is exclusive to it.
script-opts=ytdl_hook-ytdl_path=/usr/bin/yt-dlp
ytdl-raw-options=cookies-from-browser=firefox,mark-watched=
You can also use umpv script to launch mpv in mpv-url-handler.sh. This way videos will be added to a queue instead of starting a new window every time.
https://github.com/mpv-player/mpv/blob/master/TOOLS/umpv
let newval = "mpv://" + (site.needsFullUrl ? site.url : "") + hrefval;
// Wait for the search form to be loaded
var searchForm = document.getElementById("search-form");
if (searchForm) {
// Add an event listener to the search form
searchForm.addEventListener("submit", function() {
// Reload the page when the search form is submitted
location.reload();
});
}
// Reload the page whenever the URL in the address bar changes
window.addEventListener("popstate", function() {
location.reload();
});
brew install yt-dlp
pip install yt-dlp
You should change @updateURL and @downloadurl in userscript.js to a public URL because the current one points to the one only you have access to.
You should change it to this:
// @updateURL https://raw.githubusercontent.com/nsinister/videothumb2mpv/master/userscript.js
// @downloadURL https://raw.githubusercontent.com/nsinister/videothumb2mpv/master/userscript.js
Automatic updating is currently not possible because of incorrect URL.
Here's the pull request to the fix: #2
PS. Great script
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.