c# - How to submit the browser type when download a web stream -
my code :
string result = new webclient().downloadstring("https://www.facebook.com/profile.php?id=123456789");
the result giving me supported browser. body class=\"unsupportedbrowser
what intend do: download source code facebook particular page.
problem encounter : stream facebook, facebook block me since access apps due not valid browser.
expectation : how can submit browser type chrome cheat facebook valid browser.
you can add headers webclient object. however, prefer go httpwebrequest/httpwebresponse method of scraping since believe gives more options.
headers.add("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); headers.add("accept-encoding", "gzip, deflate"); headers.add("accept-language", "en-us,en;q=0.5"); headers.add("cookie", "has_js=1"); headers.add("dnt", "1"); headers.add("host", host); headers.add("referer", url); headers.add("user-agent", "mozilla/5.0 (windows nt 6.1; wow64; rv:32.0) gecko/20100101 firefox/32.0");
Comments
Post a Comment