Skip to content

Instantly share code, notes, and snippets.

@Strubbl
Last active April 5, 2022 09:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Strubbl/730ff4ac7fd5ff07968610d3a1f76d9d to your computer and use it in GitHub Desktop.
Save Strubbl/730ff4ac7fd5ff07968610d3a1f76d9d to your computer and use it in GitHub Desktop.
#!/bin/bash
set -eu
lang="en es ja cz fr pt pl de it ko zh tr cn"
if ! cmd=$(command -v curl)
then
echo "please install curl"
exit 1
fi
if (( $# == 0 ))
then
feed="https://weeklyosm.eu/feed"
article_id=$(curl -Ls "$feed" | grep "<link>https://weeklyosm.eu/archives/" | head -n 1 | cut -d "<" -f 2 | grep -o '[^/]*$')
else
article_id=$1
fi
echo "checking for weekly https://weeklyosm.eu/archives/$article_id"
for i in $lang
do
article_url="https://weeklyosm.eu/$i/archives/$article_id"
sourcecode=$(curl -Ls "$article_url")
echo "$sourcecode" | grep "og:image" | grep "favicon" > /dev/random && echo "wrong share image for language $i in $article_url"
no_of_leadpics=$(echo "$sourcecode" | grep 'alt="lead picture"' | wc -l)
if [ $no_of_leadpics -ge 2 ]
then
echo "more than one lead picture ($no_of_leadpics) found for language $i in $article_url"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment