You are not logged in.

#1 2018-07-03 21:52:52

agent114
Member
Registered: 2017-10-26
Posts: 27

firefox and running a script when a URL matches a string

I have been looking for a way of launching youtube videos in mpv when clicked in firefox, I haven't found anything that can do this. does anyone know if there is an extension or a setting that can run mpv or just a bash script when a url matches a string such as "https://www.youtube.com/watch?v="

Offline

#2 2018-07-04 08:18:48

mpan
Member
Registered: 2012-08-01
Posts: 1,208
Website

Re: firefox and running a script when a URL matches a string

GreaseMonkey + a localhost HTTP server with/in your favourite server-side language.

A GreaseMonkey script, triggering on YouTube address, sends to the server a POST request containing the URL. The server receives the request and launches mpv or a Bash script with the received data. Ensure authentication of the requests! A long, random token should suffice for this simple scenario.


Sometimes I seem a bit harsh — don’t get offended too easily!

Offline

Board footer

Powered by FluxBB