Comments (6)
A javascript bookmarklet would accomplish this. However, it would be session based and would require the user to manually activate it. You could publish the bookmarklet as a link on your github readme page. Users could then right click the link and bookmark the code to save it to their toolbar. Anytime they wanted to activate it they could simply click the bookmark on their toolbar. It would be cross-browser compatible so you wouldn't need a separate chrome and firefox extension. Since it's session based the code would automatically stop once they closed the tab or browser or navigated to a different url. You'd have to implement a global variable and set an interval to constantly check for new links since youtube content can change without reloading the page. Firefox users would have to add one new pref to about:config in order to show protocol handler popup.
overview
- test domain of page loaded in focused tab. if not youtube.com then exit.
- set global variable to keep track of total video/playlist links
- create an array of all links on page
- loop through array and compare each url to a regex pattern to determine which links point to video/playlist.
- if match is found then prepend href with a new 'freetube:' protocol, stop propagation of click event and update total.
- set interval of 3 seconds and call the same function at each interval to count total video links. compare current total to global variable total. if number is different then process urls again to add freetube protocol.
Example:
Go to about:config in firefox.
Type network.protocol into filter box.
Right click and create new boolean pref using name below.
network.protocol-handler.expose.freetube
Set pref to false.
Go to a youtube video page (https://www.youtube.com/watch?v=VPI9E-wNK8s)
Paste the code below into your address bar.
You'll have to retype javascript: at the beginning of url. Firefox automatically removes it when you paste a javascript url.
Press enter to apply the url changes.
Click any video url and you should see a protocol handler popup.
Choose location of freetube and check the 'remember my choice' box.
Tested on linux using ff 60.0.2
javascript: var aTags = document.documentElement.getElementsByTagName('a'); for (let i = 0; i < aTags.length; ++i) { if (aTags[i].href.search(/\?v=[\w\-]{11}/) > -1 && aTags[i].href.substr(0,9) != 'freetube:') { aTags[i].setAttribute('onclick', 'event.stopPropagation();'); aTags[i].setAttribute('href', 'freetube:' + aTags[i].href); } } alert(aTags.length + ' links processed');
from freetube.
This is something that I've been wanting to do. I have a general idea on how to do it but it's going to take a little bit of research on my part to get this working. The functionality will most likely have to come from a Chrome/Firefox extension to work.
from freetube.
Is it possible to handle them on a system level, at least on Windows or Linux?
from freetube.
Not that I'm aware of. You can make specific links in a browser accomplish this without a browser extension, but you would still need something to convert YouTube links to these redirect links. I understand that it's not the most ideal, but a browser extension is the most practical solution to this.
from freetube.
@keijukainen you might be interested in taking a look at freetube-redirect. It's not as robust as your solution but it should be a much more user friendly solution. I would love to have your help towards improving it if you are willing to do so.
Setting up the freetube:
protocol is actually done automatically if you install the .deb or .exe of FreeTube. This might work for other installations but I haven't been able to test them out. This should make it much easier as a user to get this up and running.
Let's continue this conversation over at the freetube-redirect repository.
from freetube.
@keijukainen you might be interested in taking a look at freetube-redirect. It's not as robust as your solution but it should be a much more user friendly solution. I would love to have your help towards improving it if you are willing to do so.
Setting up the
freetube:
protocol is actually done automatically if you install the .deb or .exe of FreeTube. This might work for other installations but I haven't been able to test them out. This should make it much easier as a user to get this up and running.Let's continue this conversation over at the freetube-redirect repository.
I installed freetube from .deb and see no 'freetube protocol' option
from freetube.
Related Issues (20)
- [Bug]: search in playlist doesn't work for channel names HOT 3
- [Feature Request]: Allow a user to choose the sorting order of playlists items HOT 1
- [Bug]: Picture-in-Picture leave black box after closing HOT 1
- [Feature Request]: View playlists as a grid instead of as a list HOT 1
- [Feature Request]: Pin a playlist to the sidebar HOT 3
- [Feature Request]: Ability to arrange playlists reverse-chronologically, or restore the grid view HOT 1
- [Feature Request]: Hide only fully-watched videos HOT 1
- [Bug]: Please have installer and other files signed by publisher on Windows HOT 1
- [Feature Request]: Quick-Move-To-Other-Playlist option in the video menu HOT 2
- [Bug]: Deprecation warning HOT 1
- [Feature Request]: Sort videos within playlist HOT 4
- [Feature Request]: Parental Control Read/Play only playlist mode
- [Feature Request]: Drag and drop videos in edit mode
- [Feature Request]: Display playlist as a grid instead of a really tall linear list HOT 1
- [Bug]: v0.20.0 Beta (.deb for Ubuntu 20.04) near to unresponsive app with two or more windows HOT 3
- [Bug]: When using Invidious API only up to 200 videos are loaded in channel's playlist. HOT 3
- [Bug]: 'Download Video' doesn't work HOT 1
- [Feature Request]: Per-Playlist Autoplay Settings?
- [Bug]: Stutters when playing audio on a hidden workspace HOT 2
- [Feature Request]: Reconcile search U.X. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from freetube.