View previous topic :: View next topic |
Author |
Message |
3PO Veteran


Joined: 26 Nov 2006 Posts: 1110 Location: Schwabenländle
|
Posted: Sat Jan 23, 2010 2:50 pm Post subject: [gelöst] Wie Dateien anhand der Extension herunterladen? |
|
|
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 |
|
 |
toralf Developer


Joined: 01 Feb 2004 Posts: 3943 Location: Hamburg
|
Posted: Sat Jan 23, 2010 3:11 pm Post subject: |
|
|
z.B.: Code: | wget --no-glob ftp://www.cacr.math.uwaterloo.ca/hac/about/*.pdf |
|
|
Back to top |
|
 |
3PO Veteran


Joined: 26 Nov 2006 Posts: 1110 Location: Schwabenländle
|
Posted: Sat Jan 23, 2010 3:19 pm Post subject: |
|
|
wget --no-glob....,
scheint nur für ftp zu gehen, nicht für http.  |
|
Back to top |
|
 |
zworK Guru

Joined: 07 May 2004 Posts: 308
|
Posted: Sat Jan 23, 2010 4:00 pm Post subject: |
|
|
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 |
|
 |
3PO Veteran


Joined: 26 Nov 2006 Posts: 1110 Location: Schwabenländle
|
Posted: Sat Jan 23, 2010 4:06 pm Post subject: |
|
|
zworK wrote: | Ungetestet: Code: | wget -A '*.jpg' http://www.foo.com/pics/ | |
Geht leider auch nicht.  |
|
Back to top |
|
 |
mv Watchman


Joined: 20 Apr 2005 Posts: 6780
|
Posted: Sat Jan 23, 2010 5:04 pm Post subject: Re: [bash] Wie Dateien anhand der Extension herunterladen? |
|
|
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 |
|
 |
3PO Veteran


Joined: 26 Nov 2006 Posts: 1110 Location: Schwabenländle
|
Posted: Sat Jan 23, 2010 5:07 pm Post subject: |
|
|
Schade ...  |
|
Back to top |
|
 |
l3u Advocate


Joined: 26 Jan 2005 Posts: 2616 Location: Konradsreuth (Germany)
|
Posted: Sat Jan 23, 2010 5:22 pm Post subject: |
|
|
Es sei denn, man hat ein directory listing, parst das dann und holt sich danach die Dateien. |
|
Back to top |
|
 |
3PO Veteran


Joined: 26 Nov 2006 Posts: 1110 Location: Schwabenländle
|
Posted: Sat Jan 23, 2010 5:33 pm Post subject: |
|
|
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 |
|
 |
ScytheMan l33t


Joined: 30 Nov 2005 Posts: 605
|
|
Back to top |
|
 |
l3u Advocate


Joined: 26 Jan 2005 Posts: 2616 Location: Konradsreuth (Germany)
|
Posted: Sun Jan 24, 2010 10:33 am Post subject: |
|
|
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 |
|
 |
3PO Veteran


Joined: 26 Nov 2006 Posts: 1110 Location: Schwabenländle
|
Posted: Sun Jan 24, 2010 2:28 pm Post subject: |
|
|
[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 |
|
 |
tazinblack Veteran


Joined: 23 Jan 2005 Posts: 1146 Location: Baden / Germany
|
Posted: Mon Jan 25, 2010 6:40 am Post subject: |
|
|
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 |
|
 |
ScytheMan l33t


Joined: 30 Nov 2005 Posts: 605
|
Posted: Mon Jan 25, 2010 11:07 am Post subject: |
|
|
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 |
|
 |
tazinblack Veteran


Joined: 23 Jan 2005 Posts: 1146 Location: Baden / Germany
|
Posted: Mon Jan 25, 2010 3:02 pm Post subject: |
|
|
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 |
|
 |
Josef.95 Advocate

Joined: 03 Sep 2007 Posts: 4702 Location: Germany
|
Posted: Mon Jan 25, 2010 3:24 pm Post subject: |
|
|
++
erinnert mich ein wenig an die alten "Spion & Spion" Karikaturen...  |
|
Back to top |
|
 |
|