0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Windows / Linux】ギガファイル便を cURL でダウンロードする方法

0
Last updated at Posted at 2026-01-08

GUI を使わず、Linuxサーバーからのダウンロードなど、CUI 環境やスクリプトからギガファイル便のファイルを取得したい場面は意外と多くあります。
しかし、ギガファイル便は、ダウンロードにCookieを利用しているため、単純にダウンロードURLへ cURL するだけでは取得できません。
なのでこの記事ではCookieを保存してそれを使ってダウンロードする方法を解説します。

*当然ですが、相手サーバー様に負荷を掛けないように・節度を守って利用しましょう。

検証環境

  • Windows 10 / 11
    • curl 8.16.0 (Windows)(Windows標準搭載の curl.exe
  • Linux (Ubuntu 22.04.5 LTS)
    • curl 7.81.0 (x86_64-pc-linux-gnu)

① Cookie を保存する

まず、ダウンロードページのURLにアクセスし、Cookie を保存します。

curl -c cookies.txt <https://xx.gigafile.nu/xxxx ダウンロードページのURL>

オプション説明

  • -c cookies.txt
    → サーバーから受け取った Cookie をファイルに保存

② ファイルの直リンクURLを取得する

ブラウザで一度ダウンロードを開始し、
開発者ツール(Network タブ) から実際のファイルURLを確認します。

例:
(URLはダミーです。)
image.png

image.png

※直リンクは直接ファイルをダウンロードする場合は
download.php に、zipにまとめたファイルをダウンロードする場合は dl_zip.php になります。

③ cURL でダウンロードする

保存した Cookie を使ってファイルをダウンロードします。

curl -b cookies.txt https://xx.gigafile.nu/download.php?file=xxxx -o C:\aaa\bbb\example.jpg

オプション説明

  • -b cookies.txt
    → 保存した Cookie を送信してアクセス
  • -o C:\aaa\bbb\example.jpg
    → 保存するファイル名・保存先を指定

④ ZIP形式(「まとめるファイル」の場合)

ギガファイル便で 「まとめる(ZIP)」 を選択した場合、
URL は dl_zip.php になります。

curl -b cookies.txt https://xx.gigafile.nu/dl_zip.php?file=xxxx -o C:\aaa\bbb\example.zip

まとめ

  • ギガファイル便のダウンロードには Cookie が必須
  • 一度ブラウザでダウンロード操作を行う必要がある
  • Cookie を保存 → 直リンク取得 → cURL でダウンロード

image.png
コマンドラインからダウンロードできるのは便利ですね。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?