wgetは正しいサイズのファイルを検索しません(ファイルが破損しているか不完全ですか?)

wgetは正しいサイズのファイルを検索しません(ファイルが破損しているか不完全ですか?)

私は理解できません...

実際のダウンロードリンクはhttpリンクではなく、一部のJavascript操作のようです。

javascript:SendFileDownloadCall('PRODIMAGES.CIF.zip','PRODIMAGES.CIF.zip');

だから手動でダウンロードした後、ブラウザのダウンロード履歴に行き、直接リンクをコピーしました。 https://au.ingrammicro.com/_layouts/CommerceServer/IM/FileDownload.aspx?DisplayName=STD_FULL_FILEFEED.TXT&FileName=STDPRICE_FULL.TXT.zip

私のウェブサイトの資格情報と一緒にURLをwgetに入力しました。

wget -q --user=XXXX --password=XXXX "https://au.ingrammicro.com/_layouts/CommerceServer/IM/FileDownload.aspx?DisplayName=STD_FULL_FILEFEED.TXT&FileName=STDPRICE_FULL.TXT.zip" -o STDPRICE.zip

後で--userと--passwordを追加しても違いはありません。

[root@server datafiles]# wget "https://au.ingrammicro.com/_layouts/CommerceServer/IM/FileDownload.aspx?DisplayName=STD_FULL_FILEFEED.TXT&FileName=STDPRICE_FULL" -O STDPRICE.zip
--2019-09-15 19:53:29--  https://au.ingrammicro.com/_layouts/CommerceServer/IM/FileDownload.aspx?DisplayName=STD_FULL_FILEFEED.TXT&FileName=STDPRICE_FULL
Resolving au.ingrammicro.com (au.ingrammicro.com)... 104.98.45.15
Connecting to au.ingrammicro.com (au.ingrammicro.com)|104.98.45.15|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: /_layouts/CommerceServer/IM/Login.aspx?ReturnUrl=%2f_layouts%2fCommerceServer%2fIM%2fFileDownload.aspx%3fDisplayName%3dSTD_FULL_FILEFEED.TXT%26FileName%3dSTDPRICE_FULL [following]
--2019-09-15 19:53:29--  https://au.ingrammicro.com/_layouts/CommerceServer/IM/Login.aspx?ReturnUrl=%2f_layouts%2fCommerceServer%2fIM%2fFileDownload.aspx%3fDisplayName%3dSTD_FULL_FILEFEED.TXT%26FileName%3dSTDPRICE_FULL
Reusing existing connection to au.ingrammicro.com:443.
HTTP request sent, awaiting response... 200 OK
Length: 85341 (83K) [text/html]
Saving to: ‘STDPRICE.zip’

100%[===================================================================================================================================================================================================>] 85,341       405KB/s   in 0.2s

2019-09-15 19:53:30 (405 KB/s) - ‘STDPRICE.zip’ saved [85341/85341]

とにかく、Webサイトで手動でクリックしてダウンロードして取得できるものと同等のものを取得するのではなく、信じられないほど小さなファイルを取得します。

私の恐れを確認しながら解凍しようとすると、次のような結果が表示されます。

$ [root@server datafiles]# unzip STDPRICE.zip
Archive:  STDPRICE.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of STDPRICE.zip or
        STDPRICE.zip.zip, and cannot find STDPRICE.zip.ZIP, period.

ファイル確認:

$ [root@server datafiles]# file STDPRICE.zip
STDPRICE.zip: HTML document, UTF-8 Unicode text, with very long lines, with CRLF line terminators

それでは、wgetは実際にファイルとしてマークされたHTMLファイルをダウンロードしますか.txt.zip?誰かが私を実現できますか?

ベストアンサー1

ウェブサイトがログインページにリダイレクトされます。

HTTP request sent, awaiting response... 302 Moved Temporarily
Location: /_layouts/CommerceServer/IM/Login.aspx?ReturnUrl=%2f_layouts%2fCommerceServer%2fIM%2fFileDownload.aspx%3fDisplayName%3dSTD_FULL_FILEFEED.TXT%26FileName%3dSTDPRICE_FULL [following]
--2019-09-15 19:53:29--  https://au.ingrammicro.com/_layouts/CommerceServer/IM/Login.aspx?ReturnUrl=%2f_layouts%2fCommerceServer%2fIM%2fFileDownload.aspx%3fDisplayName%3dSTD_FULL_FILEFEED.TXT%26FileName%3dSTDPRICE_FULL

基本認証(wgetが送信する認証)として提供された資格情報を受け入れることなく、代わりにセッションCookieを使用できます。ログインしている場合は、ブラウザからクッキーを抽出して--load-cookieswget()を使用して送信できます。また、変更を試みることができる要求の他の側面(ユーザーエージェントなど)に焦点を当てることもできます。

代わりにカールが利用可能な場合は、チェッカー(Ctrl+Shift+I)を開き、[ネットワーク]タブに移動してファイルをダウンロードし、要求リストでダウンロード項目を右クリックし、[コピー]の上にマウスを置き、[cURLにコピー]を選択します。コマンドは次のとおりです。これでクリップボードにクッキーが含まれます。

おすすめ記事