我试图使用WebClient在pinterest帐户中设置自动图像。
我想重新创建这个http请求: (请求行)POST /upload-image/?img=Desert.jpg HTTP / 1.1 主持人 www.pinterest.com
User-Agent Mozilla / 5.0(Windows NT 6.1; WOW64; rv:39.0)Gecko / 20100101 Firefox / 39.0
接受 text / html,application / xhtml + xml,application / xml; q = 0.9, / ; q = 0.8
接受语言 it-IT,它; q = 0.8,en-US; q = 0.5,en; q = 0.3
接受编码 gzip,deflate
X-Requested-With XMLHttpRequest
X-File-Name Desert.jpg
缓存控制无缓存
X-CSRFToken RqwJCawJyAGYIZfzob51qxrEGj4GJcSA
Referer https://www.pinterest.com
内容长度 846128
内容类型 multipart / form-data;边界= --------------------------- 5431268530037
曲奇 _pinterest_cm = TWc9PSY1YlkwcmtVRGlNRzRQZXpiZXJseVl6TnFHYnEvZlhpNDZPcExCQnhKN3UvdUUveWI0c3p4bWJKUmhoZy9YRG9sS3dNZTZFSFNhN2V3VWhJM1JkbUlxbC92VjhHUGFldlRTVVJTNlA1L1M0SDE5QXhLcHVWS2ZrSUh3NTN2ODA0WSZ5dnpJQkVRUmx5TVJGTEdmQm5EVmRGQXNqbDQ9; csrftoken = RqwJCawJyAGYIZfzob51qxrEGj4GJcSA; _pinterest_sess = “TWc9PSYvRm93OFNxbGkxWTJ5bzVoZUFudHJVVDI4bndmL2I5SFVIQjZkVk1KWFJ3WDBmNndOWFR0QnBPazltZFRmcnJpcGU5akhQZS8vcEZWTzM5ODJWNVdKS2syekwwc1p1TVVNeEt3Z3NYa1lsMVFXcFpXYUdkRlE1RElQYTBYeXhyQkFkYVFmSHZnVkRyYWhYcURDYzhhWEpuR2dvekE1SlB6cXp4akNNdzJ6QysrR2MzRGNyRXJKczRuRHZDTm1uQkdLMUJrUnF6UjdZakhDUGNVRnQ4T1ZoQUFIQWJSU1VNUHNjUHV5VjlZbk1INU1FMFNhdGJiVFZRdUNDWFNlMGJvcDBFeXk4a3cxT25ROHpSOXFzcTZ6NFBHekFjNkFNQUtnaktQNGQ1VkhnNDdlSXNQTGhmTzhDWm5UaDNoZzdqbEFHQWQ1RjJXWVo5bjNXVkVUWnVUWXNiL1JLTFdqNDBvMWllT0VyRDRNN1lXN0diQmlWRjdGdWF5UGUzYkNLYlMvamJUSVFwcFZoVVVUL2ROVkFIQUNYODQxR3R5eDFrQ0VpTGhmaGZ1Y2VOdGt6aUdLQmtCTkRYdkpkVGhmLzMvMnVOWHAwQVdZWEs2alE4eTUwd3E1SlJPRWFDc3VKTXByb2tISm8rcldRQT0mejAwN0hvdlRhbU8zYmNJT0lsSm9PSldheGpJPQ ==”; sessionFunnelEventLogged = 1; __utma = 229774877.448600758.1436737610.1436739423.1436745191.3; __utmz = 229774877.1436737610.1.1.utmcsr =(直接)| utmccn =(直接)| utmcmd =(无); c_dpr = 1; __utmc = 229774877; _b = “ARLbRMvYKUdKiaBWDA2Oxko87z7iIN4MuGnJALvZK8vehgzT11AKeoa13PH4l9VjVMU =”; _pinterest_pfob =禁用; __utmb = 229774877.3.9.1436745219732; __utmt = 1
连接保持活力
Pragma no-cache
我试过这段代码,但我无法获得Content-Length和Content-Type。
Dim wc As New WebClient
wc.UseDefaultCredentials = True
wc.Credentials = New NetworkCredential("pippomio@yahoo.com", "88Y71nR3764")
wc.Headers.Add("Host", "www.pinterest.com")
wc.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5")
wc.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
wc.Headers.Add("Accept-Language", "it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3")
wc.Headers.Add("Accept-Encoding", "gzip, deflate")
wc.Headers.Add("X-Requested-With", "XMLHttpRequest")
wc.Headers.Add("X-Requested-With", "XMLHttpRequest")
wc.Headers.Add("X-File-Name", "Hydrangeas.jpg")
wc.Headers.Add("Cache-Control", "no-cache")
wc.Headers.Add("X-CSRFToken", token)
wc.Headers.Add("Referer", "https://www.pinterest.com")
wc.Headers.Add("Connection", "keep-alive")
wc.Headers.Add("Pragma", "no - cache")
Dim Response As Byte() = wc.UploadFile("https://www.pinterest.com/upload-image/?img=Hydrangeas.jpg", "POST", "Hydrangeas.jpg")
我可以在vb net中执行此请求吗? 感谢
答案 0 :(得分:0)
首先,我建议您查看this和this教程,了解如何以正确的方式发送/接收HTTP请求。
其次,您不应该在程序中重新执行任何Web浏览器操作,因为它通常不是一个好习惯,因为前端架构应该随时进行意外更改。取而代之的是,您应该检查Pinterest API,尤其是可以帮助您实现计划的Users API。通常API接口不是随机变化的主题,它们比重放前端操作更可靠,更稳定,具有更多的负载能力。
(Pinterest API似乎只能在Firefox上工作,如果你在右边有一个空白区域,有一个很大的"无"文本,那么从Firefox浏览链接 - 似乎可以处理页面)