Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[gelöst] Wie Dateien anhand der Extension herunterladen?
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) Diskussionsforum
View previous topic :: View next topic  
Author Message
3PO
Veteran
Veteran


Joined: 26 Nov 2006
Posts: 1110
Location: Schwabenländle

PostPosted: Sat Jan 23, 2010 2:50 pm    Post subject: [gelöst] Wie Dateien anhand der Extension herunterladen? Reply with quote

Hallo Zusammen,

ich möchte via Bashscript mehrere Dateien anhand der Dateierweiterung herunterladen.

Beispiel:

Lade alle *.jpg Dateien von www.foo.com/pics/

Ich habe aber leider noch keinen Ansatz gefunden, wie ich das mit wget oder curl realisieren kann.

Hat jemand eine Idee, wie man das machen könnte?


Last edited by 3PO on Sun Jan 24, 2010 3:18 pm; edited 1 time in total
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3943
Location: Hamburg

PostPosted: Sat Jan 23, 2010 3:11 pm    Post subject: Reply with quote

z.B.:
Code:
 wget --no-glob ftp://www.cacr.math.uwaterloo.ca/hac/about/*.pdf
Back to top
View user's profile Send private message
3PO
Veteran
Veteran


Joined: 26 Nov 2006
Posts: 1110
Location: Schwabenländle

PostPosted: Sat Jan 23, 2010 3:19 pm    Post subject: Reply with quote

wget --no-glob....,

scheint nur für ftp zu gehen, nicht für http. :cry:
Back to top
View user's profile Send private message
zworK
Guru
Guru


Joined: 07 May 2004
Posts: 308

PostPosted: Sat Jan 23, 2010 4:00 pm    Post subject: Reply with quote

Ungetestet:
Code:
wget -A '*.jpg' http://www.foo.com/pics/

Code:
       -A acclist --accept acclist
       -R rejlist --reject rejlist
           Specify comma-separated lists of file name suffixes or patterns to accept or
           reject. Note that if any of the wildcard characters, *, ?, [ or ], appear in an
           element of acclist or rejlist, it will be treated as a pattern, rather than a
           suffix.
Back to top
View user's profile Send private message
3PO
Veteran
Veteran


Joined: 26 Nov 2006
Posts: 1110
Location: Schwabenländle

PostPosted: Sat Jan 23, 2010 4:06 pm    Post subject: Reply with quote

zworK wrote:
Ungetestet:
Code:
wget -A '*.jpg' http://www.foo.com/pics/


Geht leider auch nicht. :(
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6780

PostPosted: Sat Jan 23, 2010 5:04 pm    Post subject: Re: [bash] Wie Dateien anhand der Extension herunterladen? Reply with quote

3PO wrote:
Lade alle *.jpg Dateien von www.foo.com/pics/

Im http-Protokoll kann das nicht gehen, weil es i.a. keine Möglichkeit gibt, zu erkennen, was in diesem Directory liegt.
Back to top
View user's profile Send private message
3PO
Veteran
Veteran


Joined: 26 Nov 2006
Posts: 1110
Location: Schwabenländle

PostPosted: Sat Jan 23, 2010 5:07 pm    Post subject: Reply with quote

Schade ... :(
Back to top
View user's profile Send private message
l3u
Advocate
Advocate


Joined: 26 Jan 2005
Posts: 2616
Location: Konradsreuth (Germany)

PostPosted: Sat Jan 23, 2010 5:22 pm    Post subject: Reply with quote

Es sei denn, man hat ein directory listing, parst das dann und holt sich danach die Dateien.
Back to top
View user's profile Send private message
3PO
Veteran
Veteran


Joined: 26 Nov 2006
Posts: 1110
Location: Schwabenländle

PostPosted: Sat Jan 23, 2010 5:33 pm    Post subject: Reply with quote

l3u wrote:
Es sei denn, man hat ein directory listing, parst das dann und holt sich danach die Dateien.


Aha, und wie macht man das?
Back to top
View user's profile Send private message
ScytheMan
l33t
l33t


Joined: 30 Nov 2005
Posts: 605

PostPosted: Sat Jan 23, 2010 10:08 pm    Post subject: Reply with quote

http://raa.ruby-lang.org/project/webfetcher/

schau dir mal das an, evtl. könnte das deinen ansprüchen genügen.
Back to top
View user's profile Send private message
l3u
Advocate
Advocate


Joined: 26 Jan 2005
Posts: 2616
Location: Konradsreuth (Germany)

PostPosted: Sun Jan 24, 2010 10:33 am    Post subject: Reply with quote

3PO wrote:
Aha, und wie macht man das?

Beispiel http://l3u.de/pub/, das ist ein directory listing, das lighttpd ausspuckt. Man könnte da jetzt folgendermaßen vorgehen:
Code:
lynx -dump -listonly http://l3u.de/pub/ | awk '/\d+/ {print $2}'

Dann hat man alle Links auf alle Dateien. Wenn man z. B. nur alle .jpg-Dateien haben will:
Code:
lynx -dump -listonly http://l3u.de/pub/ | awk '/\d+.+\.jpg$/ {print $2}'

Die ganze Liste dann noch runterladen:
Code:
lynx -dump -listonly http://l3u.de/pub/ | awk '/\d+.+\.jpg$/ {print $2}' | while read datei; do wget "$datei"; done
Back to top
View user's profile Send private message
3PO
Veteran
Veteran


Joined: 26 Nov 2006
Posts: 1110
Location: Schwabenländle

PostPosted: Sun Jan 24, 2010 2:28 pm    Post subject: Reply with quote

[Gelöst]

Nach langem googeln habe ich nun die Lösung gefunden. ;)

--> http://wiki.ubuntuusers.de/wget

Damit geht es:

Code:
wget -r -A jpg --level 1 -np -p --user-agent="Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9b5) Gecko/2008050509 Firefox/3.0b5" http://www.foo.com/pics/


Thx an Alle.
Back to top
View user's profile Send private message
tazinblack
Veteran
Veteran


Joined: 23 Jan 2005
Posts: 1146
Location: Baden / Germany

PostPosted: Mon Jan 25, 2010 6:40 am    Post subject: Reply with quote

3PO wrote:
[Gelöst]

Nach langem googeln habe ich nun die Lösung gefunden. ;)

--> http://wiki.ubuntuusers.de/wget

Damit geht es:

Code:
wget -r -A jpg --level 1 -np -p --user-agent="Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9b5) Gecko/2008050509 Firefox/3.0b5" http://www.foo.com/pics/


Thx an Alle.


Nur mal aus Interesse : Ist dieser ganze Rattenschwanz mit --user-agent, etc. erforderlich für die Funktion?
_________________
Gruß / Regards
tazinblack
_______________________________________________________
what's the point in being grown up if you can't be childish sometimes
Back to top
View user's profile Send private message
ScytheMan
l33t
l33t


Joined: 30 Nov 2005
Posts: 605

PostPosted: Mon Jan 25, 2010 11:07 am    Post subject: Reply with quote

tazinblack wrote:
3PO wrote:
[Gelöst]

Nach langem googeln habe ich nun die Lösung gefunden. ;)

--> http://wiki.ubuntuusers.de/wget

Damit geht es:

Code:
wget -r -A jpg --level 1 -np -p --user-agent="Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9b5) Gecko/2008050509 Firefox/3.0b5" http://www.foo.com/pics/


Thx an Alle.


Nur mal aus Interesse : Ist dieser ganze Rattenschwanz mit --user-agent, etc. erforderlich für die Funktion?


Notwendig nicht. Aber sinnvoll:
"Außerdem gibt wget vor, als Mozilla unterwegs zu sein (--user-agent), da viele Seiten wget blockieren." quote von der ubuntuusers seite.
Back to top
View user's profile Send private message
tazinblack
Veteran
Veteran


Joined: 23 Jan 2005
Posts: 1146
Location: Baden / Germany

PostPosted: Mon Jan 25, 2010 3:02 pm    Post subject: Reply with quote

ScytheMan wrote:
tazinblack wrote:
3PO wrote:
[Gelöst]

Nach langem googeln habe ich nun die Lösung gefunden. ;)

--> http://wiki.ubuntuusers.de/wget

Damit geht es:

Code:
wget -r -A jpg --level 1 -np -p --user-agent="Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9b5) Gecko/2008050509 Firefox/3.0b5" http://www.foo.com/pics/


Thx an Alle.


Nur mal aus Interesse : Ist dieser ganze Rattenschwanz mit --user-agent, etc. erforderlich für die Funktion?


Notwendig nicht. Aber sinnvoll:
"Außerdem gibt wget vor, als Mozilla unterwegs zu sein (--user-agent), da viele Seiten wget blockieren." quote von der ubuntuusers seite.


Coole Sache!
_________________
Gruß / Regards
tazinblack
_______________________________________________________
what's the point in being grown up if you can't be childish sometimes
Back to top
View user's profile Send private message
Josef.95
Advocate
Advocate


Joined: 03 Sep 2007
Posts: 4702
Location: Germany

PostPosted: Mon Jan 25, 2010 3:24 pm    Post subject: Reply with quote

Quote:
Coole Sache!
++
erinnert mich ein wenig an die alten "Spion & Spion" Karikaturen... :lol:
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) Diskussionsforum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum