Created
November 15, 2014 16:44
-
-
Save shizeeg/f29a8c216b0e6bcfc77b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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