summaryrefslogtreecommitdiff
path: root/mac/.local/bin/decodetitle
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-08-23 13:36:06 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-08-23 13:36:06 +0900
commit6baef1437fcf40b1d51c5255af78ab297d361d2c (patch)
treec3c257e026ec3fb32b787839f81d8af0c2e6c7ce /mac/.local/bin/decodetitle
parent07d294425a98ee5d1e22d03e2b24ae2c76e487c0 (diff)
updates
Diffstat (limited to 'mac/.local/bin/decodetitle')
-rwxr-xr-xmac/.local/bin/decodetitle17
1 files changed, 17 insertions, 0 deletions
diff --git a/mac/.local/bin/decodetitle b/mac/.local/bin/decodetitle
new file mode 100755
index 0000000..e7a553c
--- /dev/null
+++ b/mac/.local/bin/decodetitle
@@ -0,0 +1,17 @@
+#!/usr/bin/env python3
+
+import html
+import sys
+import xml.etree.ElementTree as ET
+
+text_input = sys.stdin.read()
+root = ET.fromstring(text_input)
+
+# RSS 2.0: <channel><item><title>
+for item in root.findall(".//item"):
+ title = item.find("title")
+ if title is not None and title.text:
+ title.text = html.unescape(title.text)
+
+# re-serialize
+sys.stdout.buffer.write(ET.tostring(root, encoding="utf-8", xml_declaration=True))