private static BearerToken Initialize(WebCache webClient) { var document = webClient.GetWebData <HtmlDocument>(API_TOKEN_URL); var searchBearer = ParseBearerIndexPage(document.DocumentNode.Descendants("head").Single(), "script", "'"); var videoBearer = ParseBearerIndexPage(document.DocumentNode.Descendants("body").Single(), "script", "\""); return(new BearerToken(searchBearer, videoBearer)); }
public static string ReadAsString(this WebCache webCache, string url, string postData = null, CookieContainer cookies = null, string referer = null, IWebProxy proxy = null, bool forceUTF8 = false, bool allowUnsafeHeader = false, string userAgent = null, Encoding encoding = null, NameValueCollection headers = null, bool cache = true) { var responseString = webCache.GetWebData(url, postData, cookies, referer, proxy, forceUTF8, allowUnsafeHeader, userAgent, encoding, headers, cache); return(responseString); }