My dream (and something I may build given the time) is a large set of curated, regularly updated scripts using headless browser automation (e.g. playwright) to provide popular website services (e.g. FB, Twitter, etc) as a local API I could build a portal UI against. No separate server doing this, just desktop client side headless browser automation.
However you don't have to be there while it runs. Have the automation scrape content you care about into a database on a regularly basis, and then your viewing of it takes however long a few SQL queries take.
I just tried this last week and wrote this tiny Userscript that redirect Youtube videos to their .mp4 source file, so nothing is actually loaded except the video itself. No ads, no "watch next!", no related movies, no comments.
This has the disadvantage that you're stuck on 720p, not to mention a bunch of functionality missing (eg. subtitles, being able to use the "copy video url at current time" functionality). A better solution would be simply to adblock the elements you don't like.
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.
There's still plenty of good content on Youtube. It's just that, like most other social networks, the content enjoyed by the majority of people is pretty much garbage.
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.
Letting people choose their own video sample picture definitely has lead to a huge increase in videos with highly sexualized cover photos. Some topics are more prone to it than others. I've definitely noticed a huge increase in the number of videos with scantily clad women as the cover photo. Sometimes even on videos that have much tamer actual 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.
I noticed that I started getting woodworking videos featuring hot women that clearly didn't actually know what they were doing. They were just following someone else's instructions.
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.
To be fair, I wasn't logged in. But it's pretty soul destroying whenever I see the home page. It's a bunch of people "reacting" to things (meaning that they have their mouths wide open in the thumbnail), or worse ("I bought everything at X store"). Just excruciating. That's before you get to the fact that like 80% of front page stuff is compilation videos (i.e. content stolen from users on other sites).
I recently looked for content like "how to run an ethernet cable in the garden" and everything was what I was expecting to see. Real instructions, no clickbait garbage.
I've been using userscripts for 10+ years for my own use cases: a site has an annoying nag screen (many banks do)? Close it immediately. The CRM we use for some reason won't preserve my session? Fill in the last thing it was entered + autosubmit that form + check the session every 15 minutes in the background. Is there a form I need to fill in with almost the same data every time? Based on a template, I can copy and paste the data in the form, it will be filled with the correct fields.
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].
Browser extensions seem at least an order of magnitude more complicated (at least as an outsider, I've never worked with them). It's like if you ask a friend to help you hammer a nail and they're like "Oh, cool, lemme fire up this robot I built to just nail in all the nails for us! Ah wait, I have to plug it in. Screw it, I'll just use my hammer."
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.
They're really not actually. To turn your userscript into an extension, you just save the code to a single file on disk in a new folder, then create a manifest.json file with like a dozen lines, and load the folder as a development extension.
Spent about two minutes on the website and could not find out what "userscript support for browsers" means. Literally could not figure out, what this thing does – and I have a degree in CS. Maybe it's just me who's not in the know, but I think that's something a documentation/website should always deliver: a high level description for out-of-domain people explaining what a piece of software does.
How far down the stack does that requirement go, though? Anybody who knows what a userscript is will know why they need a userscript manager and anybody who doesn't won't need one.
The homepages for Firefox and Chrome don't explain what a browser does, nor what the WWW is, or a webpage, etc, etc
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.
That's not what I'm trying to say. Obviously I can google this. I still think documentation should say within a couple of words what a piece of software does – without having a lot of domain knowledge.
Genuine question, where do I find out more information about where to go to learn how to write userscripts? Im able to write bookmarklets for simple stuff but I've never been able to find a good comprehensive guide about where to start with these. Im not a webdev and my JavaScript is basic at best.
It's very very similar to writing on-page JavaScript. Your script basically just gets injected into the page by the extension. So it's all the standard webdev stuff you'd want to learn: JavaScript, the DOM apis and CSS.
Yep, these days 99% of the userscripts I write use no special permissions or APIs provided by the userscript manager, it's just pure JS injected into the page. The rare exception is when I need to do a GM.xmlHttpRequest for cross origin.
Start writing code in the browser console. It's a Javascript REPL with full access to the DOM for the site and the browser API. Once you put together a few lines that do something useful, paste them into a new userscript for the page and clean it up a little.
I'm a novice at Javascript but I managed to write a couple users ropes because I had specific goals. Then I spent a lot of time googling things and mostly finding things on stack exchange that seemed like they would work.
A lot of times the code I found would use jquery but I didn't want to include that for my simple script so I would try to find an pure js way.
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).
> "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 use Violentmonkey - I can't remember why, but I probably installed it due to the Firefox issues years ago and carried on using it. No complaints here.
Is Chrome's native userscript support completely dead, then? I remember there was a time when you could install stuff right off of Userscripts.org, without an extension...
Last time I used Chromium as my main browser a couple of years ago it was still possible (by dragging the .user.js to the extensions tab, not directly from the web anymore) but the userscript would be automatically disabled each time I opened the browser. While that's not completely dead it's mostly useless, I don't know the current situation.
I switched from greasemonkey to tampermonkey because the webextension version of greasemonkey wasn't compatible with some of my scripts anymore, but tampermonkey was.
Lately, whenever I've been wanting to make some changes to a site, I've been writing browser extensions instead of userscripts. It's only a little bit clunkier to get started, but the interface is a lot more supported and documented and has a ton more features. It's also much easier to use with source control, code editors, unit tests (well probably, haven't tried that yet), and other development tools. Plus if it ends up being really useful, you can publish it to the extension store for others to use easily as well.
My JS is terrible, and I find it’s really hard to make even simple tweaks to complex JS built pages. I really miss platypus (a wysiwig editor that generated user scripts from edits). I’ve searched and searched but there seems to me no functional equivalent today.
I’d love an easy way to run a regex on some particular part of a page.
I love Violentmonkey. I use it to make the user names on HN larger so they are more prominent when I'm reading posts, as I don't agree with HN's design to deprioritize post authorship.
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.
There's a userscript manager built into your browser: it's called "extensions".
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.
They're not so much harder to write. I spent may be an hour to figure it out. You need simple manifest.json where you'll enumerate stylesheets, scripts and URL filter rules and where to inject them. Of course you don't need all of those things, if you're OK with uBlock, don't add URL filter rules. And then you need to write a little bit of code to insert custom JavaScript on the page, because by default it's executed on extension behalf and can't just access any page DOM.
The only time I had to hack on a webextension I had to reload it on every change, and do it all again every time I restarted my browser. And I only felt comfortable to hack on this extension because I forked it and wanted to add something on top. As a user who wants to dev for myself, it was a bit too heavy.
I've been using Tampermonkey in Safari 14 on my M1 based MacBook with no problems. All the scripts I use with Violentmonkey in Chrome on my desktop work here. Tampermonkey from the App Store[0] does cost a couple of bucks though.