You are not logged in.
Hello, I am a designer, and well, I often query the following website to look for some images:
As you can see, there are some images. These images changes over the time.
Can be done a shellscript to query this website (only the main page) for example every hour and automatically download the new images?
It can be a easy work or a really hard task?
Greetings
Only deaths can see the end of battles.
Blog: http://djmartinez.co.cc -> The life of a Computer Engineer
Offline
Beware; no real useful advice follows.
If it can be done, and off the top of my head that depends a bit on how deviantart files its new addings, it's probably better done with Perl, Python or something like that than a shell script.
Shell scripts are the devils own work, and should be resorted to only for dirty-drunk-last-minute-hacks.
Offline
#!/bin/bash
wget -U 'SomeUserAgent/1.0' -O- 'http://www.deviantart.com/' 2> /dev/null |
grep -Po 'http://[^.]+\.deviantart.com/art/[^"]+-\d+' |
sed -r 's/.+-([0-9]+)/http:\/\/www.deviantart.com\/download\/\1\/xx/' |
wget -U 'SomeUserAgent/1.0' -i-
try this.
Offline
#!/bin/bash wget -U 'SomeUserAgent/1.0' -O- 'http://www.deviantart.com/' 2> /dev/null | grep -Po 'http://[^.]+\.deviantart.com/art/[^"]+-\d+' | sed -r 's/.+-([0-9]+)/http:\/\/www.deviantart.com\/download\/\1\/xx/' | wget -U 'SomeUserAgent/1.0' -i-
try this.
Works great! I wonder how nice this is to deviantart though..
Offline
Shell scripts are the devils own work, and should be resorted to only for dirty-drunk-last-minute-hacks.
I don't follow this logic - shell scripts are great. Using a shell script, elide got the images from the front page in 4 lines. Try doing that with perl or python.
Offline
I don't follow this logic - shell scripts are great. Using a shell script, elide got the images from the front page in 4 lines. Try doing that with perl or python.
Well, to be fair, with Perl, you could actually achieve the same in less then the example shell script provided here.
Last edited by sime (2007-12-18 21:39:27)
Offline
with Perl, you could actually achieve the same in less
show me the code (;
Last edited by elide (2007-12-18 22:14:05)
Offline
show me the code (;
Show me the moneeey!!1 This isn't a pissing contest, I just pointed out the incorrect fact.
Offline
elide wrote:show me the code (;
Show me the moneeey!!1
This isn't a pissing contest, I just pointed out the incorrect fact.
Ok so then backup your statement! In addition the bash method took maybe 5 minutes it seems if you want money for you solution it'd take much much longer!
"The only thing we have to fear is fear itself." - Franklin D. Roosevelt
Offline
By the way, I wrote a bash script to trim long lines of text file into lines 70 characters. It takes 100% CPU performance and outputs nearly a line per second. Is this just crappy scripting from me or bottleneck from bash?
#!/bin/bash
while read line
do
while [ -n "$line" ]
do
word=`echo "$line" | cut -d' ' -f1`
if [ -n "$newline ]
then
newline="$newline $word"
else
newline=$word
fi
if [ "$word" == "$line" ]
then
line=''
else
line=`echo "$line" | cut -d' ' -f1 --complement`
fi
len=`echo "$newline" | wc -m`
if [ $len -ge 70 ]
then
echo "$newline"
newline=''
fi
done
echo "$newline"
newline=''
done
Offline
In addition the bash method took maybe 5 minutes it seems if you want money for you solution it'd take much much longer!
It was a joke (Jerry Maguire)…
Offline
By the way, I wrote a bash script to trim long lines of text file into lines 70 characters. It takes 100% CPU performance and outputs nearly a line per second. Is this just crappy scripting from me or bottleneck from bash?
<code snipped>
Either way, it would probably be better to just use the fold command.
Offline