-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
I only use this for nhentai.net so idk if this change would break things for other sites, but I kept having issues with bad outputs for the TITLE due to nhentai adding extra stuff in the <title>.*</title> field. I also had issue with some titles being too long with both the japanese and english titles included so this change makes it so that IF there is an english title, it only prints the english title, otherwise it prints the japanese title.
I simply replaced the folowing 2 lines
TITLE=$(echo "$html" | grep -o '<title>.*</title>' | sed 's/<title>//g' | sed 's/<\/title>//g' | sed 's/\///g')
echo "Title :- $(echo "$html" | grep -o '<title>.*</title>' | sed 's/<title>//g' | sed 's/<\/title>//g')"
with these
TITLE=$(echo "$html" | grep -o '<meta itemprop="name" content="[^"]*"' | sed -E 's/.*content="([^"]*)".*/\1/' | awk -F'|' '{if (NF>1) print $2; else print $1}')
echo "Title :- $(echo "$html" | grep -o '<meta itemprop="name" content="[^"]*"' | sed -E 's/.*content="([^"]*)".*/\1/' | awk -F'|' '{if (NF>1) print $2; else print $1}')"
I hope this helps anyone else who had the same issues I did.
Metadata
Metadata
Assignees
Labels
No labels