V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  xxhjkl  ›  全部回复第 38 页 / 共 50 页
回复总数  992
1 ... 34  35  36  37  38  39  40  41  42  43 ... 50  
占楼
2016-05-14 22:04:17 +08:00
回复了 xxhjkl 创建的主题 分享创造 分享一个优酷提速脚本,请教 c#实现问题。
上面的是测试账号是不是登录成功的。不是会员号 所以没有加速效果的
2016-05-14 22:03:16 +08:00
回复了 xxhjkl 创建的主题 分享创造 分享一个优酷提速脚本,请教 c#实现问题。
···
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Net;
using System.IO;
using System.IO.Compression;
using System.Text.RegularExpressions;

namespace HttpWebRequestDemo
{
class Program
{
private static readonly string DefaultUserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)";

private static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
{
return true; //总是接受
}

public static HttpWebResponse CreatePostHttpResponse(string url, IDictionary<string, string> parameters, Encoding charset)
{
HttpWebRequest request = null;
//HTTPSQ 请求
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
request = WebRequest.Create(url) as HttpWebRequest;
request.ProtocolVersion = HttpVersion.Version10;
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.UserAgent = DefaultUserAgent;
//如果需要 POST 数据
if (!(parameters == null || parameters.Count == 0))
{
StringBuilder buffer = new StringBuilder();
int i = 0;
foreach (string key in parameters.Keys)
{
if (i > 0)
{
buffer.AppendFormat("&{0}={1}", key, parameters[key]);
}
else
{
buffer.AppendFormat("{0}={1}", key, parameters[key]);
}
i++;
}
byte[] data = charset.GetBytes(buffer.ToString());
using (Stream stream = request.GetRequestStream())
{
stream.Write(data, 0, data.Length);
}
}
return request.GetResponse() as HttpWebResponse;
}

static void Main(string[] args)
{
string url = "https://login.youku.com/user/login_submit";
string userName = "[email protected]";
string password = "82925272";
long epoch = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000;
string callback = "userNamelogincallback_" + epoch.ToString();
Encoding encoding = Encoding.GetEncoding("utf-8");

IDictionary<string, string> parameters = new Dictionary<string, string>();
parameters.Add("passport", userName);
parameters.Add("password", password);
parameters.Add("captcha", "");
parameters.Add("remember", "1");
parameters.Add("callback", callback);
parameters.Add("from", "http://login.youku.com/@@@@");
parameters.Add("wintype", "page");
HttpWebResponse response = Program.CreatePostHttpResponse(url, parameters, encoding);
//打印返回值
Stream stream = response.GetResponseStream(); //获取响应的字符串流
StreamReader sr = new StreamReader(stream); //创建一个 stream 读取流
string html = sr.ReadToEnd(); //从头读到尾,放到字符串 html
string cookieString = response.Headers["Set-Cookie"];
Console.WriteLine(html);
Console.WriteLine(cookieString);
}
}
}
···

@bdbai
@takwai
@loading
2016-05-14 12:12:30 +08:00
回复了 xxhjkl 创建的主题 分享创造 分享一个优酷提速脚本,请教 c#实现问题。
@loading 你等我晚上发包出来。 http://ww3.sinaimg.cn/bmiddle/62e721e4gw1et02cue46kj200k00k3y9.jpg 昨晚搞到很迟也搞不好 c#
2016-05-14 12:06:18 +08:00
回复了 xxhjkl 创建的主题 分享创造 分享一个优酷提速脚本,请教 c#实现问题。
@loading 抓包对比过了。我等下把包发上来。 post 出去的和官方的登录包都一样的, c#版的死活登不上
2016-05-14 12:00:10 +08:00
回复了 xxhjkl 创建的主题 分享创造 分享一个优酷提速脚本,请教 c#实现问题。
@bdbai 我对比过 python 发的包和我 c#发的包 post 出去的都一样的,应该就是 cookie 没处理好了 据说 python 是自己会处理 cookie 的。
2016-05-14 09:13:17 +08:00
回复了 xxhjkl 创建的主题 分享创造 分享一个优酷提速脚本,请教 c#实现问题。
沙发我来占,验证码没考虑到。目测有时候登录需要验证码的
这个应该是不能保存配置了 换个固件就好了
2016-03-28 15:14:16 +08:00
回复了 DearTanker 创建的主题 问与答 你们的印象笔记「中国版」还好吗?
我路由器上有 SS 所以一直都正常
2016-03-19 22:33:32 +08:00
回复了 sxypfqq 创建的主题 淘宝 淘宝消息都发不出去了。。
阿里旺旺都直接登陆不上啊,还是 9 点多高峰期的时候,简直坑
2016-02-23 09:11:19 +08:00
回复了 SolLo 创建的主题 分享发现 蚂蚁花呗可以手动提额了
提到 10400 了 多谢 LZ
2016-01-31 14:10:21 +08:00
回复了 ahillgian 创建的主题 问与答 375m 是真的无损音乐吗
1 、看频谱。
2 、现在 ape 基本都淘汰了,都 flac 和 WAV 了
2016-01-29 16:29:34 +08:00
回复了 gangsta 创建的主题 分享发现 UC 浏览器 App Strore 下架
safari 很够用啊
1 ... 34  35  36  37  38  39  40  41  42  43 ... 50  
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   2714 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 45ms · UTC 14:56 · PVG 22:56 · LAX 06:56 · JFK 09:56
♥ Do have faith in what you're doing.