zoukankan      html  css  js  c++  java
  • 网页数据抓取

     

    方法一:
    WebBrowser1.Silent := True;
    WebBrowser1.Navigate(URL);
    repeat
      Application.ProcessMessages;
    until WebBrowser1.ReadyState = READYSTATE_COMPLETE;
    WebBrowser1.Navigate(
            'javascript:document.getElementById("detailFormid").submit();');
    repeat
      Application.ProcessMessages;
    until WebBrowser1.ReadyState = READYSTATE_COMPLETE;
    memo1.clear;
    Memo1.Text:= WebBrowser1.OleObject.Document.documentElement.innerHtml;

    方法二:
      URL := 'http://fedex.com/Tracking';
      IdHTTP := TIdHTTP.Create(Application);
      IdHttp.Request.UserAgent := 'Mozilla/3.0';
      IdHttp.HandleRedirects := True;
      IdHTTP.ReadTimeout := cTimeOut;
      Params := TStringList.Create;
    Params.Add('tracknumbers=' + TrackId);
          Params.Add('cntry_code=us');
    Html := IdHTTP.Post(URL, Params);

    返回HTML格式文本表格说明
       表格标题栏定义
       <table border="0" cellpadding="0" cellspacing="0" class="dataTable">
        <tr>
               <th>Location</th>
               <th>Date</th>
               <th>Local Time</th>
               <th class="full">Activity</th>
                 </tr>
       表格内的一行记录定义
              <tr class="odd">
                 <td class="nowrap">                            
                      Botany,            
                    Australia                            
                 </td>            
         <td class="nowrap">           
                08/01/2011           
               </td>             
                 <td class="nowrap">             
                   11:57 A.M.             
         </td>             
                 <td>Delivered         
                 </td>
              </tr>

  • 相关阅读:
    haoop 断电后导致block文件损坏
    笔记本上小固态硬盘的使用
    centos 7安装部署docker
    用msbuild构建应用
    清风注解-Swift程序设计语言:Point11~15
    清风注解-Swift程序设计语言:Point6~10
    清风注解-Swift程序设计语言
    享骑电单车投诉
    yaf不输出致命错误(Fatal error)的原因(之一)
    如何面试 PHP 工程师?
  • 原文地址:https://www.cnblogs.com/hnxxcxg/p/2940594.html
Copyright © 2011-2022 走看看