- 积分
- 22
- 最后登录
- 2014-8-5
- 精华
- 0
- 阅读权限
- 10
- 主题
- 35
- UID
- 4073694
- 帖子
- 54
- PB币
- 150
- 威望
- 0
- 贡献
- 0
- 技术
- 7
- 活跃
- 32
- UID
- 4073694
- 帖子
- 54
- PB币
- 150
- 贡献
- 0
- 技术
- 7
- 活跃
- 32
|
发表于 2013-11-7 16:45:53
IP属地广东
|显示全部楼层
小米手机是不是很难抢到手,哈哈,有了此神器,我已经抢到了部红米,个人不敢独享,献给抢不到小伙伴们!!!
神器地址:
pan.baidu.com/share/link?shareid=1832577800&uk=2318625782
请勿使用多线程下载工具下载论坛附件!
实现方法如下(懂的可以看看):
hdcontrol({
"stime": 100066662069666032,
"status": {
"allow": true,
"miphone": {
"hdstart": true,
"hdstop": false,
"hdurl":"?_a=20131022_phone_zxxxxa0c0e3e&_op=choose",
"duration": null,
"pmstart": false
},
"mibox": {
"hdstart": true,
"hdstop": false,
"hdurl":"?_a=20131022_box_aeb5xxxxxxb&_op=choose",
"duration": null,
"pmstart": false
}
}
})
说明:(抢购前1-2个钟才开放此链接,正式开始时才返回真实地址)
allow 为true 标识为有权限购买 false 标识为没有权限购买
可用正则 也可以用json
"(allow|hdstart|hdurl)":("(.+?)"|(.+?))(,)
"allow":(?<allow>.+?,)
"hdstart":(?<hdstart>.+?,)
"hdurl":(?<hdurl>"(.+?)",)
json实体类:
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using xiaomi.xiaomiEntityJsonTypes;
namespace xiaomi.xiaomiEntityJsonTypes
{
public class Miphone
{
[JsonProperty("hdstart")]
public bool Hdstart;
[JsonProperty("hdstop")]
public bool Hdstop;
[JsonProperty("hdurl")]
public string Hdurl;
[JsonProperty("duration")]
public object Duration;
[JsonProperty("pmstart")]
public bool Pmstart;
}
public class Mibox
{
[JsonProperty("hdstart")]
public bool Hdstart;
[JsonProperty("hdstop")]
public bool Hdstop;
[JsonProperty("hdurl")]
public string Hdurl;
[JsonProperty("duration")]
public object Duration;
[JsonProperty("pmstart")]
public bool Pmstart;
}
public class Mitv
{
[JsonProperty("hdstart")]
public bool Hdstart;
[JsonProperty("hdstop")]
public bool Hdstop;
[JsonProperty("hdurl")]
public string Hdurl;
[JsonProperty("duration")]
public object Duration;
[JsonProperty("pmstart")]
public bool Pmstart;
}
public class Status
{
[JsonProperty("allow")]
public bool Allow;
[JsonProperty("miphone")]
public Miphone Miphone;
[JsonProperty("mibox")]
public Mibox Mibox;
[JsonProperty("mitv")]
public Mitv Mitv;
}
}
namespace xiaomi
{
public class xiaomiEntity
{
[JsonProperty("stime")]
public int Stime;
[JsonProperty("status")]
public Status Status;
}
}
实现:
using System;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Timers;
using Newtonsoft.Json;
using System.Text.RegularExpressions;
using System.Configuration;
namespace xiaomi
{
public partial class Form1 : Form
{
private static System.Timers.Timer _queuetimer;
private static string cookies = string.Empty; //公有Cookie
private static string codeCookie = string.Empty;
public Form1()
{
InitializeComponent();
txtUserName.Text =ConfigurationManager.AppSettings["userName"].ToString();
txtPwd.Text =ConfigurationManager.AppSettings["userPwd"].ToString();
}
private void btnStart_Click(object sender, EventArgs e)
{
if (checkBox1.Checked)
{
int t =Convert.ToInt32(txtMilliseconds.Text);
TimerStart(t);
}
else
{
QiangGou();
}
btnStart.Enabled = false;
btnStop.Enabled = true;
}
private void btnStop_Click(object sender, EventArgs e)
{
TimerStop();
btnStart.Enabled = true;
btnStop.Enabled = false;
}
public void TimerStart(int Interval)
{
if (_queuetimer == null)
{
_queuetimer = newSystem.Timers.Timer();
}
else
{
_queuetimer.Close();_queuetimer = new System.Timers.Timer();
}
_queuetimer.Interval = Interval;
_queuetimer.Elapsed += (sender, e)=> _queuetimer_Elapsed(sender, e);
_queuetimer.AutoReset = true;
_queuetimer.Enabled = true;
}
public void TimerStop()
{
if (_queuetimer != null)
{
_queuetimer.Enabled = false;
_queuetimer.Stop();
_queuetimer.Close();
}
}
void _queuetimer_Elapsed(object sender, ElapsedEventArgs e)
{
Parallel.Invoke(CreateTaskArray(10,QiangGou));
}
/// <summary>
/// 创建多个任务
/// </summary>
/// <param name="taskCount"></param>
/// <returns></returns>
private static Action[] CreateTaskArray(int taskCount, Action Dequeue)
{
var actions = newAction[taskCount];
for (int i = 0; i < taskCount;i++)
{
actions = Dequeue;
}
return actions;
}
public void QiangGou()
{
//AppendText(cookies);//打印
HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL ="http://tc.hd.xiaomi.com/hdget?callback=hdcontrol",
UserAgent = "Mozilla/5.0(Linux; U; Android 4.0.4; zh-cn; MI-ONE C1 Build/IMM76D) UC AppleWebKit/534.31(KHTML, like Gecko) Mobile Safari/534.31",
Host ="tc.hd.xiaomi.com",
Cookie = cookies
};
HttpResult result =http.GetHtml(item);
string strJson = result.Html;
if(strJson.Contains("hdcontrol"))
{
strJson =strJson.Replace("hdcontrol(", "").Replace(")","");
xiaomiEntity xm =JsonConvert.DeserializeObject<xiaomiEntity>(strJson);
bool allow = xm.Status.Allow;
string Hdurl =xm.Status.Miphone.Hdurl;
if(!string.IsNullOrEmpty(Hdurl))
{
string url ="http://t.hd.xiaomi.com/s/" + xm.Status.Miphone.Hdurl +"&_m=1";
if (allow)
{
lblAllow.Invoke(newAction(delegate() { lblAllow.Text = allow.ToString(); }));
txtUrl.Invoke(newAction(delegate() { txtUrl.Text = url; }));
TimerStop();
}
else
{
bool allowchecked =false;
ckbAllow.Invoke(newAction(delegate() { allowchecked = ckbAllow.Checked; }));
if (allowchecked == true)
{
txtUrl.Invoke(newAction(delegate() { txtUrl.Text = url; }));
}
}
}
}
}
private void btnLogin_Click(object sender, EventArgs e)
{
string username = txtUserName.Text;
string password = txtPwd.Text;
HttpItem itemSign = newHttpItem() //获取_sign
{
URL ="https://account.xiaomi.com/pass/serviceLogin",
};
HttpHelper helperSign = newHttpHelper();
HttpResult resultSign =helperSign.GetHtml(itemSign);
// <inputtype="hidden" name="_sign" value="KKkRzxzZoDC+gLdeyOszxzV0Xg=">
string _sign =System.Uri.EscapeDataString(Regex.Match(resultSign.Html,"name=\"_sign\"value=\"(.+?)\"").Groups[1].Value);
cookies = resultSign.Cookie;
HttpItem itemLogin = newHttpItem() //登陆Post
{
URL ="https://account.xiaomi.com/pass/serviceLoginAuth2",
Method = "POST",
Cookie = cookies,
Referer ="https://account.xiaomi.com/pass/serviceLogin",
ContentType ="application/x-www-form-urlencoded",
Postdata ="passToken=&user=" + username + "&pwd=" + password+"&callback=https%3A%2F%2Faccount.xiaomi.com&sid=passport&qs=%253Fsid%253Dpassport&hidden=&_sign=KKkRvCpZoDC%2BgLdeyOsdMhwV0Xg%3D&auto=true"
};
HttpHelper helperLogin = newHttpHelper();
HttpResult resultLogin =helperLogin.GetHtml(itemLogin);
if(resultLogin.Html.Contains("小米帐户 - 登录"))
{
AppendText(username + "登陆失败\n");
return;
}
AppendText(username + "登陆成功");
cookies += ";" +resultLogin.Cookie;
// AppendText(cookies);
}
private void btnCopy_Click(object sender, EventArgs e)
{
if(!string.IsNullOrEmpty(txtUrl.Text))
{
Clipboard.SetDataObject(txtUrl.Text, true);
}
}
protected void AppendText(string info)
{
txtInfo.Invoke((MethodInvoker)delegate
{
txtInfo.AppendText(info +Environment.NewLine);
txtInfo.SelectionStart =txtInfo.Text.Length;
txtInfo.ScrollToCaret();
});
}
}
}
|
|