You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

14 lines
349 B

#!/bin/sh -e
INPUT_URL=$(echo "$1" | awk 'match($0, /(https:\/\/[a-z]+\.delfi\.ee\/artikkel\/[0-9]+)/) {print substr($0, RSTART, RLENGTH)}')
if [ "$INPUT_URL" = "" ]; then
echo "Kahtlane url, nigga"
exit;
fi;
DATE_NOW=$(date -u +%Y%m%d)
YEAR_NOW=$(date -u +%Y)
SECRET_CODE=$((DATE_NOW * YEAR_NOW))
echo "$INPUT_URL?preview=$SECRET_CODE"