The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Email Subscription

    Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 716 other subscribers

Some threadreaderapp URLs

Posted by jpluimers on 2023/09/14

For my link archive so I can better automate archiving Tweet threads using bookmarklets written in JavaScript:

The base will likely be this:

javascript:void(open(`https://archive.is/?run=1&url=${encodeURIComponent(document.location)}`))

which for now I have modified into this:

javascript:void(open(`https://threadreaderapp.com/search?q=${document.location}`))

It works perfectly fine without URL encoding and demonstrates the JavaScript backtick feature for template literals for which you can find documentation at [WayBack/Archive] Template literals – JavaScript | MDN.

This is the POST request:

curl 'https://threadreaderapp.com/thread/1499996661535367169/refreshx' \
  -X 'POST' \
  -H 'authority: threadreaderapp.com' \
  -H 'content-length: 0' \
  -H 'cache-control: max-age=0' \
  -H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="98", "Google Chrome";v="98"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "Windows"' \
  -H 'upgrade-insecure-requests: 1' \
  -H 'origin: https://threadreaderapp.com' \
  -H 'content-type: application/x-www-form-urlencoded' \
  -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36' \
  -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
  -H 'sec-fetch-site: same-origin' \
  -H 'sec-fetch-mode: navigate' \
  -H 'sec-fetch-user: ?1' \
  -H 'sec-fetch-dest: document' \
  -H 'referer: https://threadreaderapp.com/thread/1499996661535367169.html' \
  -H 'accept-language: en-GB,en-US;q=0.9,en-NL;q=0.8,en;q=0.7,nl-NL;q=0.6,nl;q=0.5,de-DE;q=0.4,de;q=0.3' \
  -H 'cookie: _rtra_session=4Mr19O3RfkgqJCRycBs51Z1wsA33vXE5k3EncY2xNauAkLBOVld5ntwIjBUW%2Fe6cNgrElF9Zb8eDGf3SsxDugwT4hQiy5drgpHvDGNBlTSGZNXX8D7zcGwhUK4FNzKg4XPh1Dm6ilUhFO6S2%2FZVkGVvIs0%2FiCyBkM5h9Ug2aI6Mtbc%2FW%2BLpMoqGwtQsMXybFKOATvyOfgQNcnB1kX9zamuEBs2g6UK5%2BSwVGTf14%2BkTCfuSK5tpZTMFFXHGOe72BedsXnb2fZNETSo8yDDDkHzW6pWtB--NLxL3K4kq98aFlay--o%2FLfFASb%2Fd%2FpjR2qmKKN7g%3D%3D' \
  -H 'dnt: 1' \
  -H 'sec-gpc: 1' \
  --compressed ;

Related blog posts:

Later I did a search which came up with almost the same solution; this is how I got there:

  1. [Wayback/Archive] bookmarklet threadreaderapp – Google Search
  2. [Wayback/Archive] Thread reader app browser bookmark (no backticks; encodes the URL):
    javascript:q=location.href;void(t=open('https://threadreaderapp.com/search?q='+encodeURIComponent(q)));
  3. [Wayback/Archive] Unroll tweetstorm bookmarklet – Technical Notes
    javascript:window.location.href = 'https://threadreaderapp.com/search?q='+encodeURI(window.location.href)
  4. [Wayback/Archive] Bookmarklet Creator with Script Includer – Peter Coles which besides prepending with javascript:, also performs URL-encoding on the JavaScript code in the Bookmarklet and wraps that code in a self executing anonymous function plus call like mentioned at [Wayback/Archive] Phrappe.com | ice-chilled, instant web tips
    (function () {
      //code
    })();
  5. [Wayback/Archive] mrcoles/bookmarklet: A server-side bookmarklet compiler with greasemonkey userscript-like metadata options and the power of babel and uglify
  6. [Wayback/Archive] bookmarklet – npm

The last two were not really relevant when writing this but look promising for a future blog post.

–jeroen

Leave a Comment

 

Discover more from The Wiert Corner - irregular stream of stuff

Subscribe now to keep reading and get access to the full archive.

Continue reading