通过淘口令获取Url链接

话不多说上代码

举例


淘口令:6.0f/u枝这行 a:/🗝ONQ1c92vrNB🗝回_淘窇【男士韩版格子休闲西服春秋季新款潮流夜场小西装英伦上衣帅气外套】

 private void button7_Click(object sender, EventArgs e)
        {          
            ///一次输入多个以换行结束
            string[] strs = textBox4.Text.ToString().Replace("\r\n", "+").Split('+');
            if (strs.Count() > 0)
            {
                string symbol = "\\₰|\\/|\\//|\\¥|\\(|\\)|\\《|\\¥|\\€|\\$|\\₤|\\₳|\\¢|\\¤|\\฿|\\฿|\\₵|\\₡|\\₫|\\₲|\\₭|\\£|\\₥|\\₦|\\₱|\\〒|\\₮|\\₩|\\₴|\\₪|\\៛|\\﷼|\\₢|ℳ|\\₯|\\₠|\\₣|\\₧|ƒ|🗝|😺";
                string str = "(" + symbol + ")([a-zA-Z0-9]{11})(" + symbol + ")";//目前淘口令是11位 + 2个符号
                string strTextBox5 = "";
                for (int i = 0; i < strs.Count(); i++)
                {
                    try
                    {
                        Regex reg = new Regex(str);
                        Match m = reg.Match(strs[i], 0);
                        string s = m.Value;
                        if (s == "")
                        {
                            string str2 = "(" + symbol + ")([a-zA-Z0-9]{12})(" + symbol + ")";
                            Regex reg2 = new Regex(str2);
                            Match m2 = reg2.Match(strs[i], 0);
                            if (m2.Value == "")
                            {
                                if (strs[i].IndexOf("Http:") > 0)
                                {
                                    strTextBox5 += strs[i].Substring(strs[i].IndexOf("Http:") + 8, 12) + "\r\n";
                                }
                            }
                            else
                            {
                                if (m2.Value.IndexOf("/T") >= 0)
                                    strTextBox5 += m2.Value.Replace("/T", "") + "\r\n";
                                else
                                    strTextBox5 += m2.Value + "\r\n";
                            }
                        }
                        else
                        {
                            if (s.IndexOf("/T") >= 0)
                                strTextBox5 += s.Replace("/T", "") + "\r\n";
                            else
                                strTextBox5 += s + "\r\n";
                        }
                    }
                    catch (Exception ex)
                    {
                        strTextBox5 += strs[i].ToString() + "\r\n";
                    }
                }
                textBox5.Text = strTextBox5;
            }

        }

下面是 解析出来的淘口令转url

 

 private void button8_Click(object sender, EventArgs e)
        {
            string isSuccess = "";
            //多个淘口令以换行结束
            string[] strs = textBox5.Text.ToString().Replace("\r\n", "+").Split('+');
            if (strs.Count() > 0)
            {
                for (int i = 0; i < strs.Count(); i++)
                {
                    if (strs[i] == "")
                    {
                        break;
                    }
                    string postData = "{\"apikey\":\"你的apikey\",\"tkl\": \"" + strs[i] + "\"}";
                    string posturl = "https://api.taokouling.com/tkl/tkljm";
                    Stream outstream = null;
                    Stream instream = null;
                    StreamReader sr = null;
                    HttpWebResponse response = null;
                    HttpWebRequest request = null;
                    Encoding encoding = Encoding.UTF8;
                    byte[] data = encoding.GetBytes(postData);
                    try
                    {
                        request = WebRequest.Create(posturl) as HttpWebRequest;
                        CookieContainer cookieContainer = new CookieContainer();
                        request.CookieContainer = cookieContainer;
                        request.AllowAutoRedirect = true;
                        request.Method = "POST";
                        request.ContentType = "application/json";//x-www-form-urlencoded";
                        request.ContentLength = data.Length;
                        outstream = request.GetRequestStream();
                        outstream.Write(data, 0, data.Length);
                        outstream.Close();
                        response = request.GetResponse() as HttpWebResponse;
                        instream = response.GetResponseStream();
                        sr = new StreamReader(instream, encoding);
                        string content = sr.ReadToEnd();
                        JObject job = JObject.Parse(content);
                        string s = job["url"].ToString();
                        if (job["ret"].ToString() == "调用成功")
                        {
                            isSuccess += "淘口令url地址:" + job["url"].ToString() + " \r\n\r\n淘口令标题:" + job["content"].ToString() + " \r\n\r\n淘口令剩余时间:" + job["validDate"].ToString();
                        }
                    }
                    catch (Exception ex)
                    {
                        string err = ex.Message;
                    }

                    isSuccess += "\r\n----------------------------------------------------\r\n\r\n";

                }
                textBox6.Text = isSuccess;
            }

        }

 

  • 5
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值