I'm creating a fairly elaborate API and part of what it does is make requests and scrapes etc. I need a list of User Agents to be used by the API. For example someone may hit my API and with a request to scrape http://website.com with the latest FireFox agent, or IE 6, or a default agent.
My question is, does anyone know of an API where I can retrieve a large list of User Agents and periodically update my list? I'm not finding any good options.
Please and thank you
Have you considered using web scraping? Here is some simple scraping code in C# that gets a list 9388 user agents from this website: http://www.useragentstring.com/pages/Browserlist/
WebClient web = new WebClient();
string url = "http://www.useragentstring.com/pages/Browserlist/";
HtmlWeb webget = new HtmlWeb();
HtmlAgilityPack.HtmlDocument currentHTML = webget.Load(url);
var nodesIE = currentHTML.DocumentNode.SelectNodes(@"//li//a");
List<string> userAgentList = new List<string>();
foreach (var node in nodesIE)
{ userAgentList.Add(node.InnerHtml); }
You need htmlagilitypack to run the code (or you can make your own regex on the text)