Skip to content

Instantly share code, notes, and snippets.

@leakedby
Created April 9, 2019 08:06
Show Gist options
  • Save leakedby/db74e493dba87ba430ec81b67f4fdf02 to your computer and use it in GitHub Desktop.
Save leakedby/db74e493dba87ba430ec81b67f4fdf02 to your computer and use it in GitHub Desktop.
using Leaf.xNet;
public static Bitmap XNetDownload(string url)
{
try
{
var request = new HttpRequest();
request.UserAgentRandomize();
var response = request.Get(url);
if (response.IsOK)
{
var mem = response.ToMemoryStream();
var image = new Bitmap(mem);
return image;
}
return null;
}
catch (Exception)
{
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment