カールを使用してファイル拡張子のないURLから画像をダウンロードする

カールを使用してファイル拡張子のないURLから画像をダウンロードする

画像をダウンロードしたいです。

https://lorempixel.com/1280/320/nature/1/

そしてcurl

curl https://www.python.org/static/apple-touch-icon-144x144-precomposed.png > image.png 働く 美しい! (からhttps://stackoverflow.com/questions/32330737/ubuntu-using-curl-to-download-an-image)

問題は、またはhttps://lorempixel.com/1280/320/nature/1/同じファイル拡張子がないことです。.jpg.png

努力する:

  1. curl https://lorempixel.com/1280/320/nature/1 > test.jpg

    テスト.jpg

  2. curl -O https://lorempixel.com/1280/320/nature/1/

    ...リモートファイル名に長さはありません! ...

  3. curl -O https://lorempixel.com/1280/320/nature/1/ > test.jpg

    ...リモートファイル名に長さはありません! ...

(詳細な)試みcurl -Ovと他の試みは成功しませんでした。

可能ですかcurl

ベストアンサー1

$ curl -o x.jpg  https://lorempixel.com/1280/320/nature/1/ 
$ file x.jpg
x.jpg: JPEG image data, JFIF standard 1.01, resolution (DPI), density 96x96, segment length 16, comment: "CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 70", baseline, precision 8, 1280x320, frames 3

おすすめ記事