Has anyone used the Random Dog Method?

The latest Random Dog …

Screenshot 2025-09-18 14.40.18

And a Random TiddlyWiki …

https://toyko-travel.tiddlyhost.com/

A Random Dog …

A Random TiddlyWiki …

https://neotw-empty.tiddlyhost.com/

A Random Dog …

download

A Random TiddlyWiki …

https://mat1.tiddlyhost.com/

The Random Dog size report issue has been fixed by @EricShulman and @tw-FRed .
This is how the result looks now …

Screenshot 2025-09-21 17.09.51

TT

Random Dog …

Random TiddlyWiki …

Random Dog …

Random-dog

Random Tiddlywiki …

Hardcore electronic music and radio … Club EBM Electronic

Random dog …

Random Tiddlywiki …

Detailed recipes wiki: Kim’s Recipes

Random Dog …

Random Tiddlywiki …

The Forth programming language.

Random Dog …

Random Tiddlywiki …

尹卂倉頡規則正述

1 Like

Random Dog …

Random Tiddlywiki …

Online access to Radio via Музыкальные радиостанции (= Music Radio Stations)

I made a wiki with the sole purpose of redirecting to a random tiddlyhost hosted wiki: https://random.tiddlyhost.com/

This is the source code:

<!DOCTYPE html>
<html>
  <head>
    <script async>
    (async () => {
      console.log("🚀 Starting redirect script...");
      
      try {
        const tiddlyhostUrl = `https://tiddlyhost.com/explore?k=tw&s=r&cache_buster=${Date.now()}`;
        const proxyUrl = `https://api.allorigins.win/raw?url=${encodeURIComponent(tiddlyhostUrl)}`;
        
        console.log("Fetching wiki list from:", proxyUrl);
        const response = await fetch(proxyUrl);

        if (!response.body) {
          throw new Error("Response body is not readable.");
        }

        const reader = response.body.getReader();
        const decoder = new TextDecoder();
        let buffer = '';

        console.log("Streaming response to find link...");

        while (true) {
          const { done, value } = await reader.read();

          if (done) {
            console.warn("‼️ Stream finished before a link was found. The website's HTML structure may have changed again.");
            break;
          }

          buffer += decoder.decode(value, { stream: true });
          
          // We search for the start of an anchor tag with a 'target' attribute.
          const linkIndex = buffer.indexOf('<a target=');

          if (linkIndex !== -1) {
            // We found the link, now grab the href from that point forward
            const relevantHtml = buffer.substring(linkIndex);
            const hrefMatch = relevantHtml.match(/href=(["'])(.*?)\1/);
            
            if (hrefMatch && hrefMatch[2]) {
              const randomWikiUrl = hrefMatch[2];
              
              console.log(`✅ Link found: ${randomWikiUrl}`);
              await reader.cancel();
              console.log("Stream cancelled. Redirecting now...");
              
              window.location.href = randomWikiUrl;
              return; // Stop the script
            }
          }
        }
      } catch (error) {
        console.error("❌ An error occurred:", error);
      }
    })();
    </script>
    <meta name="application-name" content="TiddlyWiki">
    <meta name="tiddlywiki-version" content="5.3.8">
  </head>
  <body class="tc-body">
      <h1>Loading...</h1>
      <p>Please wait while we redirect you to a random TiddlyWiki.</p>
      <p>If you are not redirected automatically, please try reloading the page.</p>
    <div id="storeArea" style="display: none">
</div>
  </body>
</html>

Thank you!

Unfortunately I keep getting this on using the address …

TT


p.s. Random Dog ...

I tried to make the redirect faster by using streaming to avoid waiting for the whole html page to be downloaded but it seems like it’s less reliable … I reverted to a simpler fetching and a bit slower method which should work as long as the free proxy I’m using keep working :slight_smile:

ezgif-45720f2da8822f

Brilliant!

It is working now!

How could I use this in my own TW? (I don’t want to burden yours every day)


@telumire Random Tiddlywikis via https://random.tiddlyhost.com/

https://estebanrodriguez.tiddlyhost.com/

https://erastour.tiddlyhost.com/

https://ballenluis.tiddlyhost.com/

Today: 25-10-06

SUMMARY OF PROGRESS on useful Random Fetches

Random Dog …
Thanks to https://random.dog/.
See also @jeremyruston’s implementation of it in … Random Dogs

Random TiddlyWiki
Thanks to @telumire via https://random.tiddlyhost.com/


https://piramidesdetucume160802.tiddlyhost.com/

TT

You can use this wikitext:

\procedure store-response()
  <$action-setfield $tiddler="$:/temp/response" status=<<status>> data=<<data>>/>
\end

\function tiddlyhost.url()
  [[https://tiddlyhost.com/explore?k=tw&s=r&cache_buster=]addsuffix<now TIMESTAMP>]
\end

\function fetch.url()
[<tiddlyhost.url>encodeuricomponent[]addprefix[https://api.allorigins.win/raw?url=]]
\end

\procedure fetch()
  <$action-sendmessage
    $message="tm-http-request"
    url=<<fetch.url>>
    bind-status="$:/temp/response/status"
    oncompletion=<<store-response>>
  />
\end

\function tiddlyhost.link()
[{$:/temp/response!!data}split[.tiddlyhost.com]nth[2]split[href="]last[]addsuffix[.tiddlyhost.com]]
\end

<$button actions=<<fetch>> >Fetch Random Wiki</$button>
Status: {{$:/temp/response/status}}

<a href=<<tiddlyhost.link>> ><<tiddlyhost.link>></a>

demo

It works well, quickly, giving an address.
Perfectly.

But clicking the link replaces my wiki with the link.

Can it be changed to always open the link in new frame?

TT

To always open the link in new tab or window, use:
<a href=<<tiddlyhost.link>> target=_blank><<tiddlyhost.link>></a>

-e

1 Like

Here’s an improved version, that will also display the thumbnail of the wiki and the description, on wiki load.

Create a tiddler with the tag “$:/tags/StartupAction/PostRender”

\procedure store-response()
  <$action-setfield $tiddler="$:/temp/response" status=<<status>> data=<<data>>/>
\end

\function tiddlyhost.url()
  [[https://tiddlyhost.com/explore?k=tw&s=r&cache_buster=]addsuffix<now TIMESTAMP>]
\end

\function fetch.url()
[<tiddlyhost.url>encodeuricomponent[]addprefix[https://api.allorigins.win/raw?url=]]
\end

\procedure fetch()
  <$action-sendmessage
    $message="tm-http-request"
    url=<<fetch.url>>
    bind-status="$:/temp/response/status"
    oncompletion=<<store-response>>
  />
\end

\function tiddlyhost.link()
[{$:/temp/response!!data}split[.tiddlyhost.com]nth[2]split[href="]last[]addsuffix[.tiddlyhost.com]]
\end

\function tiddlyhost.thumbnail()
[{$:/temp/response!!data}split[class="thumbnail-large" src="]nth[2]split[" />]first[]]
\end

\function tiddlyhost.title()
[<tiddlyhost.link>split[/]last[]split[.]first[]]
\end

\function tiddlyhost.description()
[{$:/temp/response!!data}split[class='description']nth[2]split[</span>]first[]split[>]last[]]
\end

<<fetch>>

Then display the result like this:

\import [[$:/macros/getRandomWiki]]

<%if [{$:/temp/response/status}match[pending]] %>
Loading..
<%elseif [{$:/temp/response/status}match[complete]] %>
<a target="_blank" style="text-decoration:none;color:inherit;" href=<<tiddlyhost.link>> >
<$image source=<<tiddlyhost.thumbnail>> />

<h2><<tiddlyhost.title>></h2>

</a>
<$list filter="[<tiddlyhost.description>]">
{{!!title}}
</$list>
<%endif%>

demo: Best of — Discover tiddlyhost wiki

Great! Thanks for all the work you did to help complete this thread!

I hope anyone interested in other people’s wikis (TWitchers) will install & use your tool!

Appropriately, today, your Random Wiki, now in my sidebar, showed one of your (@telumire’s) wikis …

https://steamdeckguide.tiddlyhost.com/#Welcome:Welcome

1 Like