Violentmonkey – An open source userscript manager
violentmonkey.github.io
violentmonkey.github.io
- https://github.com/zedeus/nitter for twitter
- https://sr.ht/~cadence/bibliogram/ for instagram
- https://github.com/iv-org/invidious for youtube
There are likely others.
The problem with the automation solution you mentioned is that, it'll be just as slow because of the JS it will need to run.
// ==UserScript==
// @name youtube-redirect
// @match https://www.youtube.com/watch*
// @run-at document-start
// @version 1.0
// ==/UserScript==
window.stop();
GM.fetch("https://alltubedownload.net/json?url="+document.location).then(x=> window.location=JSON.parse(x).url); youtube-dl -F apeZO6C0ZeA
and if you ignore the entries that are video or audio only, there's only a 640x360 stream and a 1280x720 stream. This video is actually available in 2160p, so you definitely are getting a lesser quality experience if you just redirect to the MP4.The reason for this is that Youtube uses DASH[1] to switch to the best usable audio and video automatically. In this case the top video bitrate is about 18 Mbps!
Incidentally, Youtube has really gone into the sewer. I spent about 5 minutes scrolling down the page to find a video I wasn't too embarrassed to use as an example for this comment.
[1] https://en.wikipedia.org/wiki/Dynamic_Adaptive_Streaming_ove...
To get good content, rather than popular, you have to search for it. Or have a history of watching good content, so the system can recommend more.
Even so, I still ignore the vast majority of Youtube's suggestions.
But again, there's also plenty of good content.
I do agree that there's good content on YouTube, but if I watch any garbage at all, the recommendation engine will only recommend that. I wonder if someone has a script that will reset my YouTube history every day. Might be interesting for the algorithm to have a fresh take on me every day to show me what I'm into that day.
Some of the followed those instructions fairly convincingly, but at least 1 was so bad and I instantly saw through the ruse.
To be fair, I've also seen some with pretty women that did know what they were doing.
Then, those videos stopped appearing in my feed. I doubt they aren't being made, but I was surprised the algorithm stopped offering them.
Disclaimer: I am the author of the script
Userscripts are a nice in between a bookmarklet and a full featured extension, since the latter one can't be autoreloaded, and for every change you must click a button to get applied into your browser (at least that was the last experience I had with them).
Two weeks ago I rebuilt my hacky built system (gulp-based) into webpack. If you are trying to build something, I highly recommend webpack-userscript[1].
They are much harder to test while making changes.
It's not funny because it's wrong, it's just funny because it feels like one of these things is not like the other.
I don't agree with your statement that "anybody who doesn't [know what a userscript is] won't need one". If it was explained better there might definitely be people who could use this and become interested in this, without knowing its name before.
This might be the first time some people hears about userscripts. It is certainly possible to have been an internet user for many years without hearing about them. Does not mean they would not be useful to a subset of such persons.
Also [1].
> Contribution
> You are absolutely welcome to contribute code to GitHub.
> You are welcome to help with this website too. Documents, improvements, articles about Violentmonkey, etc.
Greasemonkey is the original Firefox extension, the development slowed down/stopped when Firefox changed how extensions work, it was restarted later. It's kind of heavyweight but very compatible with most scripts because it's the original.
Tampermonkey started as Chrome's alternative to Greasemonkey (because the latter was only for Firefox). I don't recommend it, see this[1]
Violentmonkey started as an Opera extension (back when Opera was using the Presto engine and wasn't compatible with Chrome extensions). It's more lightweight in terms of resource usage than Greasemonkey and doesn't contain analytics code. It was later ported to Firefox and Chrome.
If you need compatibility with old scripts your best choice is Greasemonkey. If you need it for modern scripts or to write your own Violentmonkey is fine. Avoid Tampermonkey, they are not to be trusted (proprietary license and analytics).
[1] https://www.reddit.com/r/firefox/comments/6hs59w/tampermonke...
> "There is no "they" in Tampermonkey. It's just me, a developer from Germany [...] I don't have the resources that large companies do have for testing. I have a regular job (40-hour workweek) and besides this I also spent some time with my wife and my daughter. And finally, and this is the most important one, there are too many unknowns. There are forks of almost every browser, each with slight differences and every new browser version can break things. [...] TL; DR: The Tampermonkey developer needs some data to become aware of bugs happening in the wild. You can disable it. All data is anonymized to the developer. No browsing data is collected."
I’d love an easy way to run a regex on some particular part of a page.
.hnuser {font-size: 20px;}Being able to run normal JavaScript also makes it pretty easy to find and replace arbitrary elements - I use it for my personal Hacker News theme.
I could be mistaken but, the comment of the person to whom I was replying suggests they only need "username font size change" functionality. If that is all that is needed, then Stylus from a UI standpoint is far easier to manage.
But if in addition to merely changing font size, you're also going to be replacing elements, obviously Stylus can't do that.
@-moz-document domain("news.ycombinator.com") {
.hnuser { font-size: 20px }
}
You'll have to restart Firefox for it to come into effect.No, I'm serious. Yes, extensions come with extra complexity, but that's because they have things like permissions, so that you don't have to trust Joe Developer as much.
Aaand that's where I (figuratively) stopped reading. If I can do something with a user script, I have no incentive for doing it with a full blown extension.
I'd even say that the fact extensions are so much harder to write than user scripts is a complete failure from browser vendors. I get that extensions CAN be complex, but they shouldn't HAVE TO be for simple use cases. User scripts are a proof of that.
Here's example of my manifest.json:
{
"manifest_version": 2,
"name": "My Web",
"version": "1.0",
"icons": {
"16": "icon_16.png",
"32": "icon_32.png",
"48": "icon_48.png",
"128": "icon_128.png"
},
"permissions": ["declarativeNetRequest"],
"content_scripts": [{
"matches": ["https://www.pornhub.com/*"],
"run_at": "document_start",
"js": ["pornhub.js"]
}, {
"matches": ["https://www.youtube.com/*"],
"run_at": "document_start",
"css": ["youtube.css"],
"js": ["youtube.js"]
}],
"web_accessible_resources": ["pornhub_script.js", "youtube_script.js"],
"declarative_net_request": {
"rule_resources": [{
"id": "rules",
"enabled": true,
"path": "rules.json"
}]
}
}
I think, everything there is pretty obvious.Here's my youtube.css:
.video-ads {
display: none;
}
Here's my pornhub.js which just injects pornhub_script.js: (() => {
"use strict";
var script = document.createElement('script');
script.src = chrome.runtime.getURL('pornhub_script.js');
script.onload = function() {
this.remove();
};
document.documentElement.appendChild(script);
})();
And here's my pornhub_script.js which disabled stopping video when I'm switching tabs: (() => {
"use strict";
const originalDocumentAddEventListener = document.addEventListener;
document.addEventListener = function (type) {
if (type !== "visibilitychange") {
return originalDocumentAddEventListener.apply(this, arguments);
}
};
})();
And some of my rules.json: [{
"id": 1,
"priority": 1,
"action": {"type": "block"},
"condition": {
"urlFilter": "/pagead/"
}
},
{
"id": 101,
"priority": 1,
"action": {"type": "block"},
"condition": {
"urlFilter": "||doubleclick.net/"
}
},
...
You can just copy this structure and it should work in Chrome (open chrome://extensions/ and click "Load unpacked").On the plus side: you're not giving up any control over your user scripts to addon authors.
[0]https://apps.apple.com/us/app/tampermonkey/id1482490089?mt=1...