Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
static Pixiv api_get(string api_str, string param)
string query = param;
byte[] queryDataBytes = Encoding.ASCII.GetBytes(query);
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("" + api_str + ".json" + query);
req.Method = "GET";
req.ContentType = "application/x-www-form-urlencoded";
req.Referer = "";
req.UserAgent = "PixivIOSApp/5.1.1";
req.Headers.Add("Authorization", "Bearer " + token);
req.CookieContainer = new CookieContainer();
req.CookieContainer.Add(new Uri(""), new Cookie("PHPSESSID", sessid));
WebResponse res = req.GetResponse();
Stream resStream = res.GetResponseStream();
StreamReader sr = new StreamReader(resStream, enc);
string json = sr.ReadToEnd();
Pixiv apires;
apires = JsonConvert.DeserializeObject<Pixiv>(json);
return apires;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment