agents 0.0.2 → 0.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,37 +0,0 @@
1
- var fs = require('fs'),
2
- xml2js = require('xml2js');
3
- //a bunch of random user agents and browsers
4
-
5
- var agents = (function(){
6
- var c = {};
7
- c.agents = [];
8
-
9
- c.setStrings = function(){
10
- var parser = new xml2js.Parser();
11
- fs.readFile(__dirname + '/allagents.xml', function(err, data) {
12
- parser.parseString(data, function (err, result) {
13
- for (var i in result['user-agents']['user-agent']) {
14
- c.agents.push(result['user-agents']['user-agent'][i]['String'][0])
15
- }
16
- });
17
- });
18
- }
19
-
20
- c.randomAgentString = function(){
21
- //fetches a random UserAgent String
22
- var randomIndex = Math.floor(Math.random()*c.agents.length);
23
- return c.agents[randomIndex];
24
- }
25
-
26
- c.google = function(){
27
- //returns google's agent string
28
- return 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)'
29
- }
30
-
31
- return c;
32
-
33
- })();
34
-
35
- agents.setStrings();
36
-
37
- module.exports = agents;