Skip to content

Instantly share code, notes, and snippets.

@shizeeg
Created November 15, 2014 16:44
Show Gist options
  • Save shizeeg/f29a8c216b0e6bcfc77b to your computer and use it in GitHub Desktop.
Save shizeeg/f29a8c216b0e6bcfc77b to your computer and use it in GitHub Desktop.
#!/bin/sh
CONV='enconv -L ru -x utf8 '
# GET='curl -s --range=1-1024
#GET='wget -q -O - '
GET='elinks -source -force-html '
for arg in ${@}; do
if grep -q "http" <<<"${arg}" ;then
LINK="${arg}"
fi
done
# ${GET} "${LINK}" | cut -c1-512 | pcregrep -M '<title>.*(\n|.)*</title>' | tr -d '\n' | sed 's|<title>||g;s|</title>||g'
BUFFER=$(${GET} "${LINK}" | cut -c1-2048)
START=$(grep '<title>' -Ebo <<<${BUFFER} | cut -d: -f1)
END=$(grep "</title>" -Ebo <<<${BUFFER} | cut -d: -f1 )
START=$(($START+8))
cut -c$START-$END <<<${BUFFER} | $CONV
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment