images: remove the save_xkcd.py script
- ID
b23dbfb- date
2026-03-27 14:31:58+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
bf5f785- message
images: remove the save_xkcd.py script- changed files
3 files, 1 addition, 57 deletions
Changed files
config.fish (6702) → config.fish (6653)
diff --git a/config.fish b/config.fish
index 9a09f45..ff78ae8 100644
--- a/config.fish
+++ b/config.fish
@@ -187,7 +187,6 @@ __create_python_script_alias images/kn_cover_image.py
__create_python_script_alias images/images_only_pdf.py
__create_python_script_alias images/pdfthumb.py
__create_python_script_alias images/reborder.py
-__create_python_script_alias images/save_xkcd.py
__create_python_script_alias images/squarify.py
__create_python_script_alias images/srgbify.py
__create_python_script_alias images/tint_image.py
images/README.md (11300) → images/README.md (10850)
diff --git a/images/README.md b/images/README.md
index b5b589b..541a019 100644
--- a/images/README.md
+++ b/images/README.md
@@ -130,12 +130,6 @@ scripts = [
"""
},
{
- "usage": "save_xkcd.py [COMIC_NUMBER]",
- "description": """
- saves a single comic from <a href="https://xkcd.com/">xkcd</a>, plus some metadata.
- """
- },
- {
"usage": "squarify.py [PATH]",
"description": """
crop an image to a central square
@@ -306,15 +300,6 @@ cog_helpers.create_description_table(folder_name=folder_name, scripts=scripts)
</dd>
<dt>
- <a href="https://github.com/alexwlchan/scripts/blob/main/images/save_xkcd.py">
- <code>save_xkcd.py [COMIC_NUMBER]</code>
- </a>
- </dt>
- <dd>
- saves a single comic from <a href="https://xkcd.com/">xkcd</a>, plus some metadata.
- </dd>
-
- <dt>
<a href="https://github.com/alexwlchan/scripts/blob/main/images/squarify.py">
<code>squarify.py [PATH]</code>
</a>
@@ -352,4 +337,4 @@ cog_helpers.create_description_table(folder_name=folder_name, scripts=scripts)
I don’t use this script very often, but I checked it in because I thought it was a neat trick I didn’t want to forget.
</dd>
</dl>
-<!-- [[[end]]] (sum: cpy5ak7yAz) -->
+<!-- [[[end]]] (sum: 6PJa9TAkgu) -->
images/save_xkcd.py (1119) → images/save_xkcd.py (0)
diff --git a/images/save_xkcd.py b/images/save_xkcd.py
deleted file mode 100755
index 61cad61..0000000
--- a/images/save_xkcd.py
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/env python3
-"""
-Downloads and saves a single xkcd comic, plus a bit of metadata.
-
-I'm not using this to create a complete archive of xkcd (of which I'm sure
-many already exist) but to create a mini-library of my personal favourites.
-"""
-
-import json
-import os
-from pathlib import Path
-import sys
-from urllib.request import urlretrieve
-
-import httpx
-
-BACKUP_ROOT = Path("/Volumes/Media (Sapphire)/backups/xkcd")
-
-
-if __name__ == "__main__":
- try:
- xkcd_number = int(sys.argv[1])
- except (IndexError, ValueError):
- sys.exit(f"Usage: {__file__} <XKCD_NUMBER>")
-
- resp = httpx.get(f"https://xkcd.com/{xkcd_number}/info.0.json")
-
- img_url = resp.json()["img"]
- filename = os.path.basename(img_url)
- name = os.path.splitext(filename)[0]
-
- try:
- with open(BACKUP_ROOT / f"{xkcd_number}-{name}.json", "x") as outfile:
- outfile.write(json.dumps(resp.json(), indent=2, sort_keys=True))
- except FileExistsError:
- pass
-
- out_path = BACKUP_ROOT / f"{xkcd_number}-{filename}"
- if not out_path.exists():
- urlretrieve(resp.json()["img"], out_path)