【问题标题】:How can I get download file from this site using wget or curl?如何使用 wget 或 curl 从该站点获取下载文件?
【发布时间】:2014-03-05 00:15:52
【问题描述】:

我想使用 wget 或 curl 从http://eng.krx.co.kr/por_eng/m2/m2_1/m2_1_3/JHPENG02001_03.jsp?isu_cd=A005930(韩国证券交易所)获取 excel 文件。

本站的form标签如下图。

<div class="board">

<h3 class="item"></h3>
<!--

 search 

-->
<div class="search">
    <form id="exKrx" onsubmit="return doSearch();" method="post" action="/por_eng/corelogic/process/m2/m2_1/m2_1_3/hpeng02001_03_01.xhtml?data-only=true" name="exKrx">
        <fieldset>
            <legend class="dpn"></legend>
            <table summary="searching by conditions"></table>
            <!--

             body_head_btn 

            -->
            <div class="body_head_btn">
                <input class="image" type="image" onclick="doSearch(); return false;" alt="search" src="http://inc.krx.co.kr/image/eng/cm/btn/bt1ask.gif"></input>
                <a title="Download" onclick="doExcel(); return false;" href="button.jsp">
                    <img alt="Download" src="http://inc.krx.co.kr/image/eng/cm/btn/bt1download.gif"></img>
                </a>
            </div>
            <div class="infomenu"></div>
            <!--

             //body_head_btn 

            -->
        </fieldset>
    </form>
</div>

我尝试了类似的方法,但失败了。

wget -o ~/download/test.xls --post-data="se_key=TSIM5w+jLsm9LGMF0U4q1Q==" http://eng.krx.co.kr/por_kor/corelogic/process/m2/m2_1/m2_1_4/hpkor02001_04.xhtml?data-only=true

我该如何解决这个问题??

【问题讨论】:

  • 如果相同,请在问题中使用eng.krx.co.kr,并列出您要下载的数据,以便其他人也可以尝试。我找不到您提到的确切 html 页面。
  • 检查.. 在 chrome 浏览器 eng.krx.co.kr/por_eng/m2/m2_1/m2_1_3/… 和控制台中:grid.excelDownLoad("/por_eng");

标签: curl wget


【解决方案1】:

wget中的url请求错误,下载按钮,触发doExcel()函数,最终调用文件http://inc.krx.co.kr/common/inc/jslib/cjux.js中的excelDownLoad()

它将从下面的当前url保存表格中的数据,并导出为ex​​cel文件

http://eng.krx.co.kr/por_eng/m2/m2_1/m2_1_3/JHPENG02001_03.jsp?isu_cd=A005930

好像不能直接下载excel文件。

如果我是你,我会使用脚本通过http://eng.krx.co.kr/por_eng/m2/m2_1/m2_1_3/JHPENG02001_03.jsp?isu_cd=A005930下载数据并自己构建excel文件

请参阅Record http form posts via a browser 了解如何在 chrome 中检查发布请求

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-04-21
    • 2015-02-20
    • 2015-10-04
    • 1970-01-01
    • 1970-01-01
    • 2021-11-30
    • 2011-05-04
    • 1970-01-01
    相关资源
    最近更新 更多