Created
April 8, 2016 21:59
-
-
Save loretoparisi/b4c1865c8414aa457ad1e344bb280212 to your computer and use it in GitHub Desktop.
User-Agent Fetcher - http://ua.theafh.net/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Fetch user agents by class from http://ua.theafh.net/ */ | |
function UserAgents () { | |
var COL_UA=1; | |
var COL_CLASS=3; | |
this.list=[]; | |
this.Class=''; | |
this.parse = function(Class) { | |
this.list=[]; | |
var self=this; | |
this.Class=Class; | |
UserAgentsDesktopList=[] | |
$('tr').each(function(index,item) { | |
var td=$(this).find('td'); | |
var uac=$( td[COL_CLASS] ).text(); | |
var ua = $( td[COL_UA] ).text() | |
var regex = new RegExp(Class); | |
if( regex.test(uac) ) { self.list.push(ua); } | |
}) | |
} | |
this.download = function() { | |
if(this.list.length==0) return; | |
var pp = document.createElement('a'); | |
pp.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(JSON.stringify( this.list ))); | |
pp.setAttribute('download', "useragents_" + this.Class + ".txt"); | |
pp.click(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So from the console it's possible to query
mobile
user agents:and for
desktop
user agents:or both
mobile
anddesktop
:you can get
bot
user agents:As soon you parse a class type, you can grab them to file:
This will download a file named
useragents_classtype.txt
locally.