98 lines
3.2 KiB
C#
98 lines
3.2 KiB
C#
using AllBase;
|
|
using CefSharp;
|
|
using CefSharp.WinForms;
|
|
using System;
|
|
using System.Drawing;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Work.Tips
|
|
{
|
|
public partial class TokenForm : Form
|
|
{
|
|
public ChromiumWebBrowser cefWebBrowser1xy = null;
|
|
//public BoundJs bound;
|
|
public TokenForm()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void TokenForm_Load(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
string url = "http://new.qixiaoke.com/htmlxx/GetAniContent.html";//Environment.CurrentDirectory + "\\htmlx\\GetAniContent.html";
|
|
//url = "https://www.jd.com/";
|
|
cefWebBrowser1xy = new ChromiumWebBrowser(url);//传入地址,实例化页面对象
|
|
//bound = new BoundJs(this.cefWebBrowser1xy);//实例化操作类,用于页面数据交互
|
|
//cefWebBrowser1xy.RegisterJsObject("boundx", bound);//注册绑定在页面的操作类
|
|
cefWebBrowser1xy.Dock = DockStyle.None;//指定页面停靠位置和方式
|
|
cefWebBrowser1xy.Size = new Size(1, 1);
|
|
panel2.Controls.Add(cefWebBrowser1xy);//向panel1控件里添加页面
|
|
cefWebBrowser1xy.Load(url);//加载页面
|
|
}
|
|
catch (Exception)
|
|
{
|
|
|
|
//throw;
|
|
}
|
|
|
|
}
|
|
|
|
public async Task<string> GetGokenx()
|
|
{
|
|
try
|
|
{
|
|
JavascriptResponse task = await cefWebBrowser1xy.GetBrowser().MainFrame.EvaluateScriptAsync("getContent()");
|
|
if (task.Success && !string.IsNullOrEmpty(task.Result.ToString()))
|
|
{
|
|
return task.Result.ToString();
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
|
|
//throw;
|
|
}
|
|
return "";
|
|
}
|
|
|
|
public string GetGoken()
|
|
{
|
|
try
|
|
{
|
|
var task = cefWebBrowser1xy.GetBrowser().MainFrame.EvaluateScriptAsync("getContent()");
|
|
|
|
if (task.Result.Result != null && !string.IsNullOrEmpty(task.Result.Result.ToString()))
|
|
{
|
|
return task.Result.Result.ToString();
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
|
|
//throw;
|
|
}
|
|
return "";
|
|
}
|
|
|
|
public async Task<string> GetAntiContent0ao_v3(string cookie, string userAgent, string referer)
|
|
{
|
|
return await Task.Run(() =>
|
|
{
|
|
int port = new Random().Next(9981, 9989);
|
|
string url = "http://220.167.100.16:" + port + "/getAntiContent?cookie=" + cookie;
|
|
string data = "&ua=" + userAgent + "&referrer=" + referer;
|
|
int time = BaseClass.ConvertDateTimeInt(BaseClass.GetServerTimeString());
|
|
string time1 = UserLogin.GetMd5(time + "W*%IvTrqSVRaEOyN17@J");
|
|
data += "&time=" + time + "&code=" + time1;
|
|
string html = GetHtml.GetUrlCodex(url + data);
|
|
return html;
|
|
});
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|