• 查快递--快递100 抓包


    using Newtonsoft.Json;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading;
    using System.Windows.Forms;

    namespace ExpressCheck
    {
    public partial class Form1 : Form
    {
    private SynchronizationContext Context;
    public Form1()
    {
    InitializeComponent();
    Context = SynchronizationContext.Current;

    }

    private void button1_Click(object sender, EventArgs e)
    {
    new System.Threading.Thread(QueryExpress).Start(textBox1.Text);
    }

    private void QueryExpress(object obj)
    {
    try
    {
    HttpCodeLib.Wininet w = new HttpCodeLib.Wininet();
    string retCode = w.GetData(string.Format("http://www.kuaidi100.com/autonumber/auto?num={0}", obj));
    List<ExpressType> typeList = JsonConvert.DeserializeObject<List<ExpressType>>(retCode);
    ExpressInfo info;
    foreach (ExpressType item in typeList)
    {
    retCode = w.GetUtf8(string.Format("http://www.kuaidi100.com/query?type={0}&postid={1}", item.ComCode, obj));
    info = JsonConvert.DeserializeObject<ExpressInfo>(retCode);
    if (info != null && info.Status == "200")
    {
    OnLog("当前订单查询成功:");
    foreach (Datum tmp in info.Data)
    {
    OnLog("【" + tmp.Time + "】 " + tmp.Context);
    }
    break;
    }
    }
    }
    catch (Exception ex)
    {
    OnLog(ex.Message);
    }
    }

    private void OnLog(string log)
    {
    Context.Send(o =>
    {
    textBox2.Text += log + " ";
    }, null);
    }
    }

    public class ExpressType
    {
    [JsonProperty("comCode")]
    public string ComCode { get; set; }

    [JsonProperty("id")]
    public string Id { get; set; }

    [JsonProperty("noCount")]
    public int NoCount { get; set; }

    [JsonProperty("noPre")]
    public string NoPre { get; set; }

    [JsonProperty("startTime")]
    public string StartTime { get; set; }
    }

    public class ExpressInfo
    {
    [JsonProperty("nu")]
    public string Nu { get; set; }

    [JsonProperty("message")]
    public string Message { get; set; }

    [JsonProperty("ischeck")]
    public string Ischeck { get; set; }

    [JsonProperty("com")]
    public string Com { get; set; }

    [JsonProperty("updatetime")]
    public string Updatetime { get; set; }

    [JsonProperty("status")]
    public string Status { get; set; }

    [JsonProperty("condition")]
    public string Condition { get; set; }

    [JsonProperty("data")]
    public Datum[] Data { get; set; }

    [JsonProperty("state")]
    public string State { get; set; }
    }

    public class Datum
    {
    [JsonProperty("time")]
    public string Time { get; set; }

    [JsonProperty("context")]
    public string Context { get; set; }

    [JsonProperty("ftime")]
    public string Ftime { get; set; }
    }
    }

  • 相关阅读:
    “#ifdef __cplusplus extern "C" { #endif”的定义
    【原创】分布式之redis复习精讲
    python爬虫入门(六) Scrapy框架之原理介绍
    PYTHON面试
    14.Ubuntu基本命令
    python爬虫入门(五)Selenium模拟用户操作
    python爬虫入门(四)利用多线程爬虫
    python爬虫入门(三)XPATH和BeautifulSoup4
    python爬虫入门(一)urllib和urllib2
    7.Ajax
  • 原文地址:https://www.cnblogs.com/qizhuocai/p/6118547.html
Copyright © 2020-2023  润新知