TLDRs newsletters are TLDR so I wrote a converter that gets all the important links

Tuesday, October 6th, 2026 at 4:52 pm

Much like a lot of other people, I subscribe to quite a few of the newsletters of TLDR. As I re-use the things I found there in own publications, I did find the newsletters – ironically – not quite succinct enough to go through them quickly. I wanted to skip sponsored sections and other cruft, so, of course I wrote a PHP script to help me with that. Here it is and you can find it on GitHub.

$URLS = file_get_contents('tldrs.txt');
$out = '';
foreach (array_filter(explode("n", $URLS)) as $url) {
  echo $url . "n";
  $html = file_get_contents($url);
  $dom = new DOMDocument();
  libxml_use_internal_errors(true);
  $dom->loadHTML($html);
  libxml_clear_errors();
  $xpath = new DOMXPath($dom);
  $links = $xpath->query('//a');
  foreach($links as $link) {
    $content = $link->nodeValue;
    if (strstr($content,'minute read') || 
        strstr($content,'GitHub Repo')) {
        $text = trim(
            preg_replace(
                "/ (d+ minute read)|(GitHub Repo)/", 
                "",$link->nodeValue)
            );
        $details = trim($link -> parentNode -> lastChild -> previousSibling -> nodeValue);
        $link = $link->getAttribute('href');
        if (strpos($link, 'links.tldrnewsletter.com') !== 0) {
          $link = exec('curl -Ls -o /dev/null -w %{url_effective} ' . escapeshellarg($link));
        }
        $out .= trim($text)." " . $link . "n" . $details . "nn";
    }
  }
}
file_put_contents('tldrs.txt', $URLS . "n" . $out);

The script takes a text file called “tldrs.txt” and loads the URLs on each of its lines. For example:

https://a.tldrnewsletter.com/web-version?ep=1&lc=12287b12- … - e5efd26c4f4e75cf27afe12c4c75
https://a.tldrnewsletter.com/web-version?ep=1&lc=072c9ebe- … -9db13cdb50873af64859a8d24
https://a.tldrnewsletter.com/web-version?ep=1&lc=122aee56- … -691dd212ee59c658
https://a.tldrnewsletter.com/web-version?ep=1&lc=122aee56-- … -37387a97f21526

It loads the URLs one by one, and checks which links contain either minutes read or GitHub Repo. It then loads these and extracts their URL, headline and description and adds the results to the tldrs.txt file.

Following redirects

Some of the links in the newsletters are hidden behind a redirect of links.tldrnewsletter.com. As I wanted the real URLs, I am using cURL to get the correct ones.

You can do this with the following command:

curl -Ls -o /dev/null -w %{url_effective} https://link-to-unfold

Pretty sure noone but me needs this, but here we are.