Last active
December 20, 2016 12:03
-
-
Save gdemir/2c356028cab42e6ba8fb to your computer and use it in GitHub Desktop.
image download
This file contains hidden or 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 | |
echo "url? :" | |
read url | |
echo "isim? :" | |
read directory | |
wget $url | |
imagelinks=`cat index.html | grep -o '<img data-src="http[^"]*"' | sed 's/<img data-src="//;s/"$//'` | |
imagereplies=`cat index.html | grep -o 'data-cevap="[^"]*"' | sed 's/data-cevap="//;s/"$//'` | |
rm -rf index.html | |
#for imagelink in $imagelinks; do | |
#wget $imagelink; | |
#done | |
i=1 | |
for imagerelpy in $imagereplies; do | |
echo $i - $imagerelpy >> $directory.txt; | |
i=$((i+1)) | |
done |
This file contains hidden or 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/bash | |
echo -DOWNLOAD_URL "Download URL ?" | |
read DOWNLOAD_URL | |
echo $DOWNLOAD_URL | |
echo -BASE_URL "Base URL ?" | |
read BASE_URL | |
echo $BASE_URL | |
echo -DIR "Make DIR ?" | |
read DIR | |
mkdir $DIR | |
cd $DIR | |
OLDIFS=$IFS | |
IFS=$'\n' | |
a_tags=$(curl $DOWNLOAD_URL | grep -Po '(?s)<img.*src.*alt.*/>') | |
# for line in $a_tags; do | |
# printf "$line\n" | grep -Po '(?s)src.*alt.*"' | awk -F\" '{print "link: " $2"\ntitle: "$4}' | |
# printf "================================================================================\n" | |
# done | |
for line in $a_tags; do | |
read src <<< $(printf "$line\n" | grep -Po '(?s)src.*alt.*"' | awk -F\" '{ print $2 }') | |
read alt <<< $(printf "$line\n" | grep -Po '(?s)src.*alt.*"' | awk -F\" '{ print $4 }') | |
wget -O $alt.jpg $BASE_URL/$src | |
done | |
IFS=$OLDIFS |
This file contains hidden or 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/bash | |
echo -DOWNLOAD_URL "Download URL ?" | |
read DOWNLOAD_URL | |
#DOWNLOAD_URL=http://www.samm.com/tr/telekom/duvar-tipi-terminasyon-kutular.html | |
echo $DOWNLOAD_URL | |
echo -BASE_URL "Base URL ?" | |
read BASE_URL | |
#BASE_URL=http://www.samm.com/ | |
echo $BASE_URL | |
echo -DIR "Make DIR ?" | |
read DIR | |
mkdir $DIR | |
cd $DIR | |
imagelinks=($(curl $DOWNLOAD_URL | grep -o '<img src="http[^"]*"' | sed 's/<img src="//;s/"$//')) | |
image_max=${#imagelinks} | |
for i in $(seq 0 $image_max); | |
do | |
echo $imagelinks[$i] | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment