Skip to content

Instantly share code, notes, and snippets.

@Ditti4
Created May 17, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ditti4/429b8fcd512c6b64a244 to your computer and use it in GitHub Desktop.
Save Ditti4/429b8fcd512c6b64a244 to your computer and use it in GitHub Desktop.
DeviantArt download code
BetterWebClient pageClient = new BetterWebClient();
_cookieContainer = new CookieContainer();
_deviantPageString = pageClient.DownloadString(_url);
_cookieContainer.SetCookies(new Uri(_url), pageClient.GetCookies());
Regex downloadLinkRegex = new Regex(@"""(http://www\.deviantart\.com/download/\d*/.*)""");
string downloadUrl = downloadLinkRegex.Match(_deviantPageString).Groups[1].Value.Replace("&", "&");
BetterWebClient downloadClient = new BetterWebClient(_cookieContainer, _url);
downloadClient.DownloadFile(downloadUrl, Path.Combine("Downloads", _filename));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment