此项目相当于全自动点击代替人工而已,代码很简单,请勿商业以及违法乱纪,没必要,这么几个仔不值得哈,每次看见群里面代乐跑与墙上发布代理签到签退就觉得,嗯,,,嗯,包括签到签退人工也可以拿到,自己分析一下网址即可,但是这样属于违法乱纪了,不公平了,处分警告,科技一定要用在合理合规的地方。希望大家嗯,,,嗯,写博客元的原因就是人少,分享一下大学过程与经历,确实素质活动很虚。
首先,得先获取所有活动
找到url打接口就行了
如上
下一步就是获取活动详情id
根据id进入详情
点击申请
根据以上即可代替人工进行抢活动,没办法,僧多肉少,而且嗯。。。你懂的这个东西没办法
部分代码,自己设置自动任务即可,C#已经绝版,能学会这个也算帮助学校重新教.net了。当然python更简单
请勿违法乱纪还有挣钱。
using Quartz; using CQIE.AutoInformation.Models; using Microsoft.Extensions.Options; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System.Text.RegularExpressions; using System.Net; using System.Text; using System; using System.Net.Http.Headers; using Microsoft.Extensions.Logging; using System.Reflection.Metadata; namespace CQIE.AutoInformation.PublicUtility { public class EveryTimeJob : IJob { public static string userCookie { get; set; } = "token"; private readonly _DbContext Db; public List<Activity> CQIEActivity = new List<Activity>(); private HttpClient client = new HttpClient(); private static HttpClient client_two = new HttpClient(); private static HttpClient client_three = new HttpClient(); private void register() { //设置请求一 client.DefaultRequestHeaders.Add("Host", "xs.cqie.edu.cn"); client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0"); client.DefaultRequestHeaders.Add("Accept", "text/html, */*; q=0.01"); //client.DefaultRequestHeaders.Add("Accept-Encoding", "gzip, deflate"); client.DefaultRequestHeaders.Add("Accept-Language", "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"); client.DefaultRequestHeaders.Add("X-Requested-With", "XMLHttpRequest"); client.DefaultRequestHeaders.Add("Referer", "http://xs.cqie.edu.cn/xg/backstageNoNav.jsp?loadMainPage=spring:allhdzyz/FromQXHDMHView"); client.DefaultRequestHeaders.Add("Cookie", "JSESSIONID=" + userCookie); // 设置期望的响应内容编码为 UTF-8 client.DefaultRequestHeaders.AcceptCharset.Add(new StringWithQualityHeaderValue("utf-8")); // 设置请求二 client_two.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Edg/124.0.0.0"); client_two.DefaultRequestHeaders.Add("Host", "xs.cqie.edu.cn"); client_two.DefaultRequestHeaders.Add("Accept", "text/html, */*; q=0.01"); client_two.DefaultRequestHeaders.Add("Accept-Language", "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"); //client_two.DefaultRequestHeaders.Add("Content-Length", "39"); client_two.DefaultRequestHeaders.Add("X-Requested-With", "XMLHttpRequest"); //client_two.DefaultRequestHeaders.Add("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); client_two.DefaultRequestHeaders.Add("Referer", "http://xs.cqie.edu.cn/xg/backstageNoNav.jsp?loadMainPage=spring:allhdzyz/FromQXHDMHView"); client_two.DefaultRequestHeaders.Add("Cookie", "JSESSIONID=" + userCookie); client_two.DefaultRequestHeaders.AcceptCharset.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("utf-8")); //以下是请求三的配置 // 设置请求头 client_three.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Edg/124.0.0.0"); client_three.DefaultRequestHeaders.Add("Host", "xs.cqie.edu.cn"); client_three.DefaultRequestHeaders.Add("Accept", "text/html, */*; q=0.01"); client_three.DefaultRequestHeaders.Add("Accept-Language", "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"); //client_two.DefaultRequestHeaders.Add("Content-Length", "39"); client_three.DefaultRequestHeaders.Add("X-Requested-With", "XMLHttpRequest"); //client_two.DefaultRequestHeaders.Add("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); client_three.DefaultRequestHeaders.Add("Referer", "http://xs.cqie.edu.cn/xg/backstageNoNav.jsp?loadMainPage=spring:allhdzyz/FromQXHDMHView"); client_three.DefaultRequestHeaders.Add("Cookie", "JSESSIONID=" + userCookie); client_three.DefaultRequestHeaders.AcceptCharset.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("utf-8")); } /// <summary> /// 获取活动列表并解析 /// </summary> /// <param name="content"></param> /// <returns></returns> private void ParseActivitiesFromContent(string content) { var data = JsonConvert.DeserializeObject<List<Dictionary<string, string>>>(content); foreach (var item in data) { if (item.ContainsKey("ID") && item.ContainsKey("HDMC")) { CQIEActivity.Add(new Activity { ActivityId = item["ID"], Title = item["HDMC"] }); } } // 这里是解析 content 的逻辑,将官网的活动信息转换为 Activity 对象并返回 // 示例:假设 content 是 JSON 格式的数据,这里使用 Newtonsoft.Json 进行解析 //List<Activity> activities = JsonConvert.DeserializeObject<List<Activity>>(content); return; } static string GetEventDataFromContent(string content) { int startIndex = content.IndexOf("{\"curPage\""); int endIndex = content.LastIndexOf("};") + 1; return content.Substring(startIndex, endIndex - startIndex); } /// <summary> /// 时实任务 /// </summary> /// <param name="context"></param> /// <returns></returns> public async Task Execute(IJobExecutionContext context) { Console.WriteLine("Start"); ///获取本地已有所有活动 ///获取官网所有活动 ///接口标识 ///FromQXHDMHViewMH register(); HttpResponseMessage response_FromQXHDMHViewMH = client.GetAsync("http://xs.cqie.edu.cn/xg/allhdzyz/FromQXHDMHView?random=0.3754639699368876&random=0.6461839166109049").Result; if (response_FromQXHDMHViewMH.IsSuccessStatusCode) { string content_FromQXHDMHViewMH = response_FromQXHDMHViewMH.Content.ReadAsStringAsync().Result; //获取id与名称测试 // 定义正则表达式模式以匹配 "ID" 和 "HDMC" string pattern = "\"ID\":\"(.*?)\""; // 匹配内容 MatchCollection matches = Regex.Matches(content_FromQXHDMHViewMH, pattern); // 提取并打印匹配的值 foreach (Match match in matches) { string id = match.Groups[1].Value; Console.WriteLine($"ID: {id}"); CQIEActivity.Add(new Activity { ActivityId = id }); } // 与本地数据比较 foreach (var cqieActivity in CQIEActivity) { Console.WriteLine("Details"); // 构造要发送的表单数据 var formData = new FormUrlEncodedContent(new[] { new KeyValuePair<string, string>("random", "0.047401211488626194"), new KeyValuePair<string, string>("random", "0.3603302999289233"), new KeyValuePair<string, string>("dataId", cqieActivity.ActivityId), }); // 发起 POST 请求并获取返回的数据 HttpResponseMessage FromHDSQView = await client_two.PostAsync("http://xs.cqie.edu.cn/xg/allhdzyz/FromHDSQView?random=0.047401211488626194&random=0.3603302999289233", formData); if (FromHDSQView.IsSuccessStatusCode) { string content_FromHDSQViewMH = FromHDSQView.Content.ReadAsStringAsync().Result; Regex regex = new Regex(@"var token = '(.*?)';"); // 使用正则表达式匹配 token Match match = regex.Match(content_FromHDSQViewMH); // 如果找到匹配项,则输出 token if (match.Success) { string token = match.Groups[1].Value; Console.WriteLine("提取到的 token 是: " + token); // 构造要发送的表单数据 var formData_three = new FormUrlEncodedContent(new[] { new KeyValuePair<string, string>("hdid",cqieActivity.ActivityId ), new KeyValuePair<string, string>("token", token), }); // 发起 POST 请求并获取返回的数据 HttpResponseMessage FromHDSQView_three = await client_three.PostAsync("http://xs.cqie.edu.cn/xg/szjyhdzyz/insertSQ", formData_three); if (FromHDSQView_three.IsSuccessStatusCode) { string result = await FromHDSQView_three.Content.ReadAsStringAsync(); Console.WriteLine(result); } else { Console.WriteLine("Token not found."); } } else { // Console.WriteLine("Failed to retrieve content. Status code: " + response_FromHDSQViewMH.StatusCode); } } } //return Task.CompletedTask; } else { Console.WriteLine("此轮结束"); } //清空所有header client.DefaultRequestHeaders.Clear(); client_two.DefaultRequestHeaders.Clear(); client_three.DefaultRequestHeaders.Clear(); } } }
标签:校园,three,two,Add,client,DefaultRequestHeaders,自动化,new,官网 From: https://www.cnblogs.com/yu011117/p/18245509