The Official Power User Tips, Tricks & Productivity Thread

Macallik86

Superstar
Supporter
Joined
Dec 4, 2016
Messages
6,571
Reputation
1,468
Daps
21,503
I just realised I'll have to redirect all my historical nitter links too. 😰 I think I'll be better off using Redirector. I hardly use any of the options in LibRedirect these days anyway lol


:handshake:
:whoa:

I fukked that up in retrospect. Redirector always comes to mind first, but (imo) is best for edge cases since logic is trickier and the editing rules take longer. Libredirect is probably a better one-stop shop for most things (I plugged my self-hosted web search - searXNG - through it for example).

Your post reminded me that libredirect is basically the same thing, and twstalker should work even tho I didn't find it on an instance list. After your comment, I doubled back and used Libredirect instead:

sxF96Cs.png
 

bnew

Veteran
Joined
Nov 1, 2015
Messages
57,174
Reputation
8,456
Daps
159,741
x.com URLs redirect to twitter.com so that's no issue, phew

There's an annoying popunder script that I had to block (https://twstalker.com/popunderufasssssk9.js) - I blocked it using uBO's logger though I guess I could have just added it to My Filters (it showed up under My Rules which I was not expecting)

And in Firefox - but not Edge - some of the videos have a 'Video playback aborted due to a network error' overlay, but still play, e.g. the first video in this tweet :pachaha: Hmm. I think disabling Tracking Protection fixed this.


I just realised I'll have to redirect all my historical nitter links too. 😰 I think I'll be better off using Redirector. I hardly use any of the options in LibRedirect these days anyway lol


:handshake:

(Unixfox was my favourite instance :mjcry:)

6VUf4pH.png


Code:
Description: nitter to twstalker
Example URL: https://nitter.unixfox.eu/PBS/status/1643689969888931840
Include pattern: https?://nitter\.[^\/]*(.*)
Redirect to: https://twstalker.com$1
Pattern type: Regular Expression
Pattern Description:
Example result: https://twstalker.com/PBS/status/1643689969888931840
Exclude pattern: https://nitter.[^\/]*/[\w_-]+/media
Process matches: No Processing
Apply to:
- Main window (address bar)
- HistoryState
 

Heimdall

Pro
Joined
Dec 13, 2019
Messages
424
Reputation
281
Daps
942
:whoa:

I fukked that up in retrospect. Redirector always comes to mind first, but (imo) is best for edge cases since logic is trickier and the editing rules take longer. Libredirect is probably a better one-stop shop for most things (I plugged my self-hosted web search - searXNG - through it for example).

Your post reminded me that libredirect is basically the same thing, and twstalker should work even tho I didn't find it on an instance list. After your comment, I doubled back and used Libredirect instead
😅 I had already switched to Redirector by the time you posted. I liked it, but it was doing something with the Reddit redirection I couldn't fix, so I switched back to LibRedirect :russ: - I think it also has SearXNG in there under Search.

Code:
Description: nitter to twstalker
Example URL: https://nitter.unixfox.eu/PBS/status/1643689969888931840
Include pattern: https?://nitter\.[^\/]*(.*)
Redirect to: https://twstalker.com$1
Pattern type: Regular Expression
Pattern Description:
Example result: https://twstalker.com/PBS/status/1643689969888931840
Exclude pattern: https://nitter.[^\/]*/[\w_-]+/media
Process matches: No Processing
Apply to:
- Main window (address bar)
- HistoryState
Thank you! That regex is 👌🏾

After switching back to LibRedirect I made a super basic userscript to do this which I have just updated to use essentially these include/exclude patterns, so I wouldn't need Redirector as a 3rd addon.

And now I see that we don't have access to /media via Twstalker... Damn :mjcry:

Incidentally. Would you consider storing your userscripts and bookmarklets somewhere, like GreasyFork or as gists? You must have so many now!
 

bnew

Veteran
Joined
Nov 1, 2015
Messages
57,174
Reputation
8,456
Daps
159,741
😅 I had already switched to Redirector by the time you posted. I liked it, but it was doing something with the Reddit redirection I couldn't fix, so I switched back to LibRedirect :russ: - I think it also has SearXNG in there under Search.


Thank you! That regex is 👌🏾

After switching back to LibRedirect I made a super basic userscript to do this which I have just updated to use essentially these include/exclude patterns, so I wouldn't need Redirector as a 3rd addon.

And now I see that we don't have access to /media via Twstalker... Damn :mjcry:

Incidentally. Would you consider storing your userscripts and bookmarklets somewhere, like GreasyFork or as gists? You must have so many now!

i need to make a github account to store them.. i checked a few months ago and github disabled anonymous gists. :francis:

might add another link to twstalker to open as users /media in nitter. :ld:
 
Last edited:

Heimdall

Pro
Joined
Dec 13, 2019
Messages
424
Reputation
281
Daps
942
I was looking for a way to hide some of the buttons under YouTube videos and the uBO filters I'd found weren't working. I then came across this addon, which I am trying out now. With it I've replaced Unhook, and a number of the tweaks I was using Enhancer for Youtube for. I imagine it will be a nightmare to keep up to date though.

The reviews felt a little too slick :patrice: but I thought I'd try it anyway.

Untrap for YouTube​

Say goodbye to YouTube related videos, shorts, comments, homepage recommendations, and the incessant barrage of distractions.

With over 200+ customization options, UnTrap empowers you to take control of your YouTube journey. It allows you to personalize your viewing environment according to your preferences and helps you improve YouTube experience.


294955.png
 

Heimdall

Pro
Joined
Dec 13, 2019
Messages
424
Reputation
281
Daps
942
And while I'm on the subject I'll mention this queue userscript. I prefer it to YouTube's native queue feature as it persists between tabs (and this has been around for longer.) You also get a little search box on the side to add things to the queue.

YouTube Play Next Queue​

When you are watching a video, you can add any suggestion to the queue by hovering over said video and clicking the thumbnail "Queue" overlay button.

Features​

  • Create a queue with videos that you want to play next (instead of the autoplay suggestion)
  • Add suggested videos to the queue
  • Search videos without interrupting the player (Script with only this feature)
  • Add searched videos to the queue
  • Remove videos from the queue
  • Decide which video in the queue you want to play next
  • Remove queue
  • Autoplay will be used when the queue is empty (When turned on)
  • Restore suggestion when queue is empty
  • Enable the miniplayer and you'll be able to add any video to the queue
 

Macallik86

Superstar
Supporter
Joined
Dec 4, 2016
Messages
6,571
Reputation
1,468
Daps
21,503
I've been contemplating self-hosting using my own credentials using some hacks I saw on GitHub but I also don't wanna give even a sniff of revenue to Musk :lupe:
Twstalker had random popups and not sure what they were doing w/ my data.

I dragged my feet a month but on the bright side, someone came up w/ a guide to self-host nitter:

Instructions are detailed, which I like, but a little convoluted in places. Took me about an hour of troubleshooting to get it working, then had to disable the proxy option in nitter to get videos to play. Since libredirect yanked nitter from their options, I had to double back to good ole redirector and edit my old twstalker redirect:

nNrQRpH.png


Testing w/ random TLR thread w/ a tweet :
5fl2ovM.png


@bnew if you know how to use redirector for embedded tweets, lemme know
 

bnew

Veteran
Joined
Nov 1, 2015
Messages
57,174
Reputation
8,456
Daps
159,741
Twstalker had random popups and not sure what they were doing w/ my data.

I dragged my feet a month but on the bright side, someone came up w/ a guide to self-host nitter:

Instructions are detailed, which I like, but a little convoluted in places. Took me about an hour of troubleshooting to get it working, then had to disable the proxy option in nitter to get videos to play. Since libredirect yanked nitter from their options, I had to double back to good ole redirector and edit my old twstalker redirect:

nNrQRpH.png


Testing w/ random TLR thread w/ a tweet :
5fl2ovM.png


@bnew if you know how to use redirector for embedded tweets, lemme know


I don't think I've ever tried redirecting embedded tweets,do you want to do that because NSFW tweets don't show up?
 

Macallik86

Superstar
Supporter
Joined
Dec 4, 2016
Messages
6,571
Reputation
1,468
Daps
21,503
I don't think I've ever tried redirecting embedded tweets,do you want to do that because NSFW tweets don't show up?
No embedded tweets show up on the coli for me so I have to click the links to see tweets:
0PygXB9.png

If they show up automatically for you, it could be my adblocker perhaps :jbhmm:
 

bnew

Veteran
Joined
Nov 1, 2015
Messages
57,174
Reputation
8,456
Daps
159,741
No embedded tweets show up on the coli for me so I have to click the links to see tweets:
0PygXB9.png

If they show up automatically for you, it could be my adblocker perhaps :jbhmm:

yeah check your adblock settings because even with twitter cookies blocked, the tweet shows up for me.

mCrlmNV.png


I suggest using regex for your nitter instance.

https?://(?:www.)?twitter.com/(.*?)(?:\?|&).*

jc9Trrx.png
 

Macallik86

Superstar
Supporter
Joined
Dec 4, 2016
Messages
6,571
Reputation
1,468
Daps
21,503
Randomly stumbled across this one:
discu.eu

It searches across various discussion forums (reddit, lobsters, hacker news, mastodon, twitter) and gives links to the discussions happening. Good for engaging w/ others or just getting additional perspective after reading an article. It also searches for links w/i an article to see if anyone else is discussing those articles as well.

L1UWWOj.png



There's room for improvement as it can be finicky w/ the search functionality, but the occasions where it does work well are pretty nice
 

bnew

Veteran
Joined
Nov 1, 2015
Messages
57,174
Reputation
8,456
Daps
159,741

Simple + Fast + Free:

Automation for Everyone


app_lede.png


TinyTask is a minimalist PC automation app you can use to record and repeat actions. As the name implies, it's unbelievably small (only 36KB!), ultra compact, and 100% portable.

No scripting is necessary - just press record, then play!

nbDNcjF.png
 

bnew

Veteran
Joined
Nov 1, 2015
Messages
57,174
Reputation
8,456
Daps
159,741
just created a bookmarklet that will extract tiktok.com embed urls on thecoli, convert to proper url format and archive them on tik.fail website so that if tiktok video later gets deleted it might be recoverable.
Code:
javascript: (function() {
    var tiktokUrls = [];
    var spans = document.querySelectorAll('span[data-s9e-mediaembed-iframe]');
    for (var i = 0; i < spans.length; i++) {
        var span = spans[i];
        var data = JSON.parse(span.getAttribute('data-s9e-mediaembed-iframe'));
        if (data[5].indexOf('\/\/www.tiktok.com\/embed\/') === 0) {
            var url = 'https:' + data[5];
            if (tiktokUrls.indexOf(url) === -1) {
                tiktokUrls.push(url);
            }
        }
    }
    for (var i = 0; i < tiktokUrls.length; i++) {
        window.open('https://tik.fail/?url=' + tiktokUrls[i]);
    }
})();


or

javascript: (function() { var tiktokUrls = []; var spans = document.querySelectorAll('span[data-s9e-mediaembed-iframe]'); for (var i = 0; i < spans.length; i++) { var span = spans[i]; var data = JSON.parse(span.getAttribute('data-s9e-mediaembed-iframe')); if (data[5].indexOf('\/\/www.tiktok.com\/embed\/') === 0) { var url = 'https:' + data[5]; if (tiktokUrls.indexOf(url) === -1) { tiktokUrls.push(url); } } } for (var i = 0; i < tiktokUrls.length; i++) { window.open('https://tik.fail/?url=' + tiktokUrls[i]); }})();

it took me about 6-8 minutes and 2 attempts using bing chat which also uses gpt-4


This updated version of the bookmarklet uses the indexOf method to check if a TikTok URL is already in the tiktokUrls array before adding it. This ensures that there are no duplicate TikTok URLs in the array, so only unique TikTok URLs will be opened in new tabs.

You can use this updated bookmarklet in the same way as the previous one: by creating a new bookmark and pasting the above code into the URL field. Then, when you’re on a page with TikTok URLs, you can click the bookmark to run the bookmarklet and open the unique TikTok URLs in new tabs.

you have to allow popups on thecoli.com so that it'll archive more than one url.
PHexNl7.png


my 1st prompt was.


write a bookmarketlet that extracts www.tiktok.com urls from the html source page and looks similar to this "\/\/"\/\/www.tiktok.com\/embed\/7189755478090566917" and convert to a the properly formatted url "https://www.tiktok.com/embed/7189755478090566917" . the tiktok url ID will always be unique digits such as "7189755478090566917" is in the example url i provided. the bookmarklet must should use javascript:void(window.open('https://tik.fail/?url=' + document.location.href));
so that it inserts found tiktok urls like javascript:void(window.open('https://tik.fail/?url=https://www.tiktok.com/embed/7189755478090566917' + document.location.href));

source page examples are below


<span data-s9e-mediaembed="tiktok" style="width:340px"><span style="padding-bottom:205.882353%"><span data-s9e-mediaembed-iframe='["allowfullscreen","","scrolling","no","src","\/\/www.tiktok.com\/embed\/7189755478090566917"]'></span></span></span><br />
<span data-s9e-mediaembed="tiktok" style="width:340px"><span style="padding-bottom:205.882353%"><span data-s9e-mediaembed-iframe='["allowfullscreen","","scrolling","no","src","\/\/www.tiktok.com\/embed\/7242633306418728219"]'></span></span></span><br />
<span data-s9e-mediaembed="tiktok" style="width:340px"><span style="padding-bottom:205.882353%"><span data-s9e-mediaembed-iframe='["allowfullscreen","","scrolling","no","src","\/\/www.tiktok.com\/embed\/7265074208890228001"]'></span></span></span><br />
<br />
<span data-s9e-mediaembed="tiktok" style="width:340px"><span style="padding-bottom:205.882353%"><span data-s9e-mediaembed-iframe='["allowfullscreen","","scrolling","no","src","\/\/www.tiktok.com\/embed\/7257913645940739355"]'></span></span></span><br />
<br />


and then i just asked it to remove duplicate urls to avoid links that posters Quote.

edit:

more AI help
Prompt: write easy instructions to add a bookmarklet to the browser toolbar.

Sure! Here are the easy instructions to add a bookmarklet to your browser toolbar:

  1. Open your web browser and go to the Bookmarks menu. In most browsers, this can be found by clicking on the Menu button (usually represented by three horizontal lines or dots) in the top-right corner of the window, and then selecting Bookmarks from the drop-down menu.
  2. In the Bookmarks menu, select Bookmark Manager or Show All Bookmarks. This will open a new tab or window with your bookmarks.
  3. In the Bookmark Manager, click on the Organize or Add New Bookmark button, and then select Add Page or New Bookmark from the drop-down menu.
  4. In the New Bookmark dialog box, enter a name for your bookmarklet in the Name field, and paste the bookmarklet code into the URL field.
  5. Click on the Save or Add button to save your new bookmarklet.
  6. Your new bookmarklet should now appear in your bookmarks. To add it to your browser toolbar, simply drag and drop it from the Bookmark Manager onto your toolbar.
That’s it! You can now use your bookmarklet by clicking on it in your browser toolbar whenever you want to run it.


I updated it.

updated with claude-3-haiku

Code:
javascript:(function(){
    console.log('Bookmarklet started');
    var tiktokUrls = [];
    var currentUrl = window.location.href;
    if (currentUrl.indexOf('https://www.tiktok.com/@') === 0 && currentUrl.indexOf('/video/') > -1) {
        console.log('Found TikTok video URL in the address bar:', currentUrl);
        tiktokUrls.push(currentUrl);
        var tiktokId = currentUrl.split('/').pop();
        var embedUrl = "https://tik.fail/?url=https://www.tiktok.com/embed/" + tiktokId;
        console.log('Opening TikTok embed URL:', embedUrl);
        window.open(embedUrl);
    } else {
        var spans = document.querySelectorAll('span[data-s9e-mediaembed-iframe]');
        console.log('Found', spans.length, 'span elements with data-s9e-mediaembed-iframe attribute');
        for(var i=0; i<spans.length; i++){
            var span = spans[i];
            var data = JSON.parse(span.getAttribute('data-s9e-mediaembed-iframe'));
            if(data[5].indexOf('//www.tiktok.com/embed/') === 0){
                var url = 'https://www.tiktok.com/embed/' + data[5].split('/').pop();
                console.log('Found TikTok embed URL from span element:', url);
                if(tiktokUrls.indexOf(url) === -1){
                    tiktokUrls.push(url);
                    var urlToOpen = "https://tik.fail/?url=" + url;
                    console.log('Opening URL:', urlToOpen);
                    window.open(urlToOpen);
                }
            }
        }
        var iframes = document.querySelectorAll('iframe[src]');
        console.log('Found', iframes.length, 'iframe elements with src attribute');
        for(var i=0; i<iframes.length; i++){
            var iframe = iframes[i];
            var url = iframe.getAttribute('src');
            if(url.indexOf('//www.tiktok.com/embed/') === 0){
                url = 'https:' + url;
                console.log('Found TikTok embed URL from iframe element:', url);
                if(tiktokUrls.indexOf(url) === -1){
                    tiktokUrls.push(url);
                    var urlToOpen = "https://tik.fail/?url=" + url;
                    console.log('Opening URL:', urlToOpen);
                    window.open(urlToOpen);
                }
            }
        }
        var links = document.querySelectorAll('a[href]');
        console.log('Found', links.length, 'link elements with href attribute');
        for(var i=0; i<links.length; i++){
            var link = links[i];
            var url = link.getAttribute('href');
            if(url.indexOf('https://www.tiktok.com/@') === 0 && url.indexOf('/video/') > -1){
                console.log('Found TikTok video URL from link element:', url);
                if(tiktokUrls.indexOf(url) === -1){
                    tiktokUrls.push(url);
                    var tiktokId = url.split('/').pop();
                    var embedUrl = "https://tik.fail/?url=https://www.tiktok.com/embed/" + tiktokId;
                    console.log('Opening TikTok embed URL:', embedUrl);
                    window.open(embedUrl);
                }
            } else if(url.indexOf('https://www.tiktok.com/embed/') === 0){
                console.log('Found TikTok embed URL from link element:', url);
                if(tiktokUrls.indexOf(url) === -1){
                    tiktokUrls.push(url);
                    var urlToOpen = "https://tik.fail/?url=" + url;
                    console.log('Opening URL:', urlToOpen);
                    window.open(urlToOpen);
                }
            }
        }
    }
    console.log('Extracted TikTok URLs:', tiktokUrls);
    for(var i=0; i<tiktokUrls.length; i++){
        var url = tiktokUrls[i];
        var urlRegex = /^(http|https):\/\/([w]{3}\.)?(www\.)?(tiktok\.com)\/@([\w\-\.]+)\/video\/(\d+)$|^https:\/\/www\.tiktok\.com\/embed\/(\d+)$/;
        if(urlRegex.test(url)){
            var urlToOpen = "https://tik.fail/?url=" + url;
            console.log('Opening URL:', urlToOpen);
            window.open(urlToOpen);
        } else {
            console.log("Invalid URL:", url);
        }
    }
    console.log('Bookmarklet finished');

})();


AI Generated:

**Change Log:**

1. **Added check for current URL**: The bookmarklet now checks if the current URL is a TikTok video URL (starts with `TikTok - Make Your Day` and contains `/video/`). If so, it extracts the TikTok ID from the URL and constructs the TikTok embed URL with the `"https://tik.fail/?url=https://www.tiktok.com/embed/" + tiktokId` format, then opens it in a new tab.

2. **Improved URL extraction and handling**: The bookmarklet now handles TikTok embed URLs found in `span` elements, `iframe` elements, and links. It constructs the `tik.fail` URL with the format `"https://tik.fail/?url=" + url` for these URLs, and opens them in new tabs.

3. **Removed URL encoding**: The bookmarklet now directly appends the TikTok URLs to the `https://tik.fail/?url="` prefix, instead of using `encodeURIComponent()`. This ensures that the URLs loaded in the `tik.fail` website do not have any encoded characters.

4. **Improved logging**: The bookmarklet now provides more detailed logging to the console, including the number of elements found, the extracted TikTok URLs, and the URLs being opened in the `tik.fail` website.

**Summary:**

The final bookmarklet code is designed to work on webpages that contain TikTok video and embed URLs. It can detect TikTok URLs in the current page's address bar, as well as in `span` elements, `iframe` elements, and links. The bookmarklet then opens the detected TikTok URLs in new tabs, with the URLs wrapped in the `"https://tik.fail/?url="` format. This allows the `tik.fail` website to handle the TikTok content without any encoded characters in the URLs.

The bookmarklet provides detailed logging to the console, making it easier to debug and understand its behavior. Overall, the final code is more robust and user-friendly compared to the original version provided.
 
Top