<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Louis-Philippe Véronneau - script</title><link href="https://veronneau.org/" rel="alternate"></link><link href="https://veronneau.org/feeds/tags/script.atom.xml" rel="self"></link><id>https://veronneau.org/</id><updated>2018-02-17T00:00:00-05:00</updated><entry><title>Downloading all the Critical Role podcasts in one batch</title><link href="https://veronneau.org/downloading-all-the-critical-role-podcasts-in-one-batch.html" rel="alternate"></link><published>2018-02-17T00:00:00-05:00</published><updated>2018-02-17T00:00:00-05:00</updated><author><name>Louis-Philippe Véronneau</name></author><id>tag:veronneau.org,2018-02-17:/downloading-all-the-critical-role-podcasts-in-one-batch.html</id><summary type="html">&lt;p&gt;I've been watching &lt;a href="https://en.wikipedia.org/wiki/Critical_Role"&gt;Critical Role&lt;/a&gt;&lt;sup&gt;&lt;a href="#note1"&gt;1&lt;/a&gt;&lt;/sup&gt; for a
while now and since I've started my master's degree I haven't had much time to
sit down and watch the show on YouTube as I used to do.&lt;/p&gt;
&lt;p&gt;I thus started listening to the podcasts instead; that way, I can listen to …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I've been watching &lt;a href="https://en.wikipedia.org/wiki/Critical_Role"&gt;Critical Role&lt;/a&gt;&lt;sup&gt;&lt;a href="#note1"&gt;1&lt;/a&gt;&lt;/sup&gt; for a
while now and since I've started my master's degree I haven't had much time to
sit down and watch the show on YouTube as I used to do.&lt;/p&gt;
&lt;p&gt;I thus started listening to the podcasts instead; that way, I can listen to the
show while I'm doing other productive tasks. Pretty quickly, I grew tired of
manually downloading every episode each time I finished the last one. To make
things worst, the podcast is hosted on PodBean and they won't let you download
episodes on a mobile device without their app. Grrr.&lt;/p&gt;
&lt;p&gt;After the 10th time opening the terminal on my phone to download the podcast
using some &lt;code&gt;wget&lt;/code&gt; magic I decided enough was enough: I was going to write a
dumb script to download them all in one batch.&lt;/p&gt;
&lt;p&gt;I'm a little ashamed to say it took me more time than I had intended... The
PodBean website uses semi-randomized URLs, so I could not figure out a way to
guess the paths to the hosted audio files. I considered using &lt;code&gt;youtube-dl&lt;/code&gt; to
get the DASH version of the show on YouTube, but Google has been heavily
throttling DASH streams recently. Not cool Google.&lt;/p&gt;
&lt;p&gt;I then had the idea to use iTune's RSS feed to get the audio files. Surely they
would somehow be included there? Of course Apple doesn't give you a simple RSS
feed link on the iTunes podcast page, so I had to rummage around and eventually
found out this is the link you have to use:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;https://itunes.apple.com/lookup?id=1243705452&amp;amp;entity=podcast
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Surprise surprise, from the json file this links points to, I found out the main
Critical Role podcast page &lt;a href="http://criticalrolepodcast.geekandsundry.com/feed/"&gt;has a proper RSS feed&lt;/a&gt;. To my defense, the RSS
button on the main podcast page brings you to some PodBean crap page.&lt;/p&gt;
&lt;p&gt;Anyway, once you have the RSS feed, it's only a matter of using &lt;code&gt;grep&lt;/code&gt; and &lt;code&gt;sed&lt;/code&gt;
until you get what you want.&lt;/p&gt;
&lt;p&gt;Around 20 minutes later, I had downloaded all the episodes, for a total of 22Gb!
Victory dance!&lt;/p&gt;
&lt;video width="70%" style="margin-left:15%" autoplay loop&gt;
  &lt;source src="https://veronneau.org/media/blog/2018-02-17/victory-dance.mp4" type="video/mp4" /&gt;
  Video clip loop of the Critical Role doing a victory dance.
&lt;/video&gt;

&lt;h2&gt;Script&lt;/h2&gt;
&lt;p&gt;Here's the bash script I wrote. You will need &lt;code&gt;recode&lt;/code&gt; to run it, as the RSS
feed includes some HTML entities.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="c1"&gt;# Get the whole RSS feed&lt;/span&gt;
wget&lt;span class="w"&gt; &lt;/span&gt;-qO&lt;span class="w"&gt; &lt;/span&gt;/tmp/criticalrole.rss&lt;span class="w"&gt; &lt;/span&gt;http://criticalrolepodcast.geekandsundry.com/feed/

&lt;span class="c1"&gt;# Extract the URLS and the episode titles&lt;/span&gt;
&lt;span class="nv"&gt;mp3s&lt;/span&gt;&lt;span class="o"&gt;=(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;grep&lt;span class="w"&gt; &lt;/span&gt;-o&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;http.\+mp3&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;/tmp/criticalrole.rss&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;titles&lt;/span&gt;&lt;span class="o"&gt;=(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;tail&lt;span class="w"&gt; &lt;/span&gt;-n&lt;span class="w"&gt; &lt;/span&gt;+45&lt;span class="w"&gt; &lt;/span&gt;/tmp/criticalrole.rss&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;grep&lt;span class="w"&gt; &lt;/span&gt;-o&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&amp;lt;title&amp;gt;.\+&amp;lt;/title&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="w"&gt;           &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;sed&lt;span class="w"&gt; &lt;/span&gt;-r&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;s@&amp;lt;/?title&amp;gt;@@g; s@ @\\@g&amp;#39;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;recode&lt;span class="w"&gt; &lt;/span&gt;html..utf8&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Download all the episodes under their titles&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;i&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="p"&gt;!titles[*]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;do&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;wget&lt;span class="w"&gt; &lt;/span&gt;-qO&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;sed&lt;span class="w"&gt; &lt;/span&gt;-e&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;s@\\\@\\ @g&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;titles&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;.mp3&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;mp3s&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;hr&gt;
&lt;p style="font-size:95%;"&gt;&lt;a name="note1"&gt;1&lt;/a&gt; - For those of you not familiar
with Critical Role, it's web series where a group of voice actresses and actors
from LA play Dungeons &amp; Dragons. It's so good even people like me who never
played D&amp;D can enjoy it..&lt;/p&gt;</content><category term="blog"></category><category term="script"></category></entry></feed>