ptouch autosplit and makemkv-key-grabber

This commit is contained in:
2026-05-02 23:53:32 +02:00
parent a35e9b8cf3
commit fc057270b9
2 changed files with 103 additions and 0 deletions

29
almost_oneliners/makemkv-key.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/bash
# small script to extract the makemkv-beta-key from the forum as it changes once a month
# URL of the MakeMKV forum post
FORUM_URL="https://forum.makemkv.com/forum/viewtopic.php?f=5&t=1053"
# Fetch the page content
CONTENT=$(curl -sL "$FORUM_URL")
# 1. Extract the key (T- followed by 66 alphanumeric characters)
KEY=$(echo "$CONTENT" | grep -oP 'T-[a-zA-Z0-9]{66}')
# 2. Extract the line immediately following the key
# - sed 's/<[^>]*>/\n/g': Replaces all HTML tags with newlines to isolate text
# - grep -A 5 "$KEY": Gets 5 lines of context after the key
# - grep -v "$KEY": Removes the line containing the key itself
# - grep -m 1 "[[:alnum:]]": Grabs the very next line containing actual text
# - sed 's/&nbsp;/ /g': Cleans up non-breaking space entities
VALIDITY=$(echo "$CONTENT" | sed 's/<[^>]*>/\n/g' | grep -A 5 "$KEY" | grep -v "$KEY" | grep -m 1 "[[:alnum:]]" | sed 's/&nbsp;/ /g; s/^[[:space:]]*//; s/[[:space:]]*$//')
# Output
if [ -n "$KEY" ]; then
echo "$KEY"
echo "$VALIDITY"
else
echo "Error: Could not retrieve data from the forum."
exit 1
fi