oalders/http-browserdetect

Add support for Brew and Teleca user agents

w2gi opened this issue · 6 comments

w2gi commented

We have over 8M user agents. We notice that any that are from Brew or Teleca devices aren't recognized. Can this be added? Here is a sample of the 2500+ agent strings we can provide.

Mozilla/5.0 (compatible; Teleca Q7; Brew 3.1.5; U; en) 480X800 LGE VX11000
Mozilla/4.1 (compatible; Teleca Q7; BMP 1.0.1; U; en) 240X400 LG-MN510
Mozilla/4.0 (compatible; Polaris 6.2; Brew 3.1.5; en)/240X320 Samsung sam-r631
Mozilla/5.0 (rv:1.3; BREW 3.1.5; en)/400x240 sam-r710 like Gecko/20080531 NetFront/3.5
Mozilla/4.1 (compatible; Teleca Q7; BMP 1.0.1; U; en) 240X400 LG-MN510 [UsableNet Lift Mobile]
Mozilla/4.0(compatible;Polaris 6.2;Brew 3.1.5;U;en)/400x240 Samsung SCH-U820
Opera/9.80 (BREW; Opera Mini/6.143/27.1382; U; id) Presto/2.8.119 Version/11.10
Mozilla/4.0 (compatible; MSIE 6.0; BREW 3.1.5; en )/800x480 Samsung SCH-U960
Mozilla/5.0 (compatible; Teleca Q7; Brew 3.1.5; U; en) 320X240 LGE VX9200
LG-LG511C/1.0[TF268435460911756375000000018052666154] Mozilla/5.0(compatible; Teleca Q7; BMP 1.0.1; U; en) 240X400 LGE LG-LG511C Profile/MIDP-2.1 Configuration/CLDC-1.1
NetFront/3.5.1(BREW 3.1.5; U; en-us; SAMSUNG; NetFront/3.1.5/AMB) Sprint M560 MMP/2.0 Profile/MIDP-2.1 Configuration/CLDC-1.1
Mozilla/4.0 (BREW 3.1.5; U; en-us; Sanyo; NetFront/3.5.1/AMB) Boost SCP3810
LG-LG511C/1.0[TF268435460902553047000000013212055040] Mozilla/5.0(compatible; Teleca Q7; BMP 1.0.1; U; en) 240X400 LGE LG-LG511C Profile/MIDP-2.1 Configuration/CLDC-1.1
LG-LG511C/1.0[TF268435460911753637000000013342355993] Mozilla/5.0(compatible; Teleca Q7; BMP 1.0.1; U; en) 240X400 LGE LG-LG511C Profile/MIDP-2.1 Configuration/CLDC-1.1
Opera/9.80 (BREW; Opera Mini/5.30/26.1474; U; en) Presto/2.8.119 240X320 Casio C751
LG-LG511C/1.0[TF268435460902551139000000014156938132] Mozilla/5.0(compatible; Teleca Q7; BMP 1.0.1; U; en) 240X400 LGE LG-LG511C Profile/MIDP-2.1 Configuration/CLDC-1.1
Opera/9.80 (BREW; Opera Mini/5.1.182/26.1474; U; en) Presto/2.8.119 400X240 Pantech CDM8992
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; Brew_Browser_6.0_SP1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; MS-RTC LM 8; MS-RTC EA 2; InfoPath.2; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Opera/9.80 (BREW; Opera Mini/5.1.182/26.1474; U; en) Presto/2.8.119 320X240 Pantech TXT8045
Opera/9.80 (BREW; Opera Mini/5.1.173/26.1474; U; en) Presto/2.8.119 240X400 LG VN270
Opera/9.80 (BREW; Opera Mini/6.0.0/27.2314; U; en) Presto/2.8.119 240X320 Casio C781
Mozilla/4.0 (BREW 3.1.5; U; en-us; Sanyo; NetFront/3.5.1/AMB) Sprint SCP-6760
LG-LG511C/1.0[TF268435460911741369000000012523751533] Mozilla/5.0(compatible; Teleca Q7; BMP 1.0.1; U; en) 240X400 LGE LG-LG511C Profile/MIDP-2.1 Configuration/CLDC-1.1
Opera/9.80 (BREW; Opera Mini/5.1.189/26.1474; U; en) Presto/2.8.119 240X400 LG VN271
Opera/9.80 (BREW; Opera Mini/5/27.1366; U; en) Presto/2.8.119 Version/11.10
Mozilla/4.0 (BREW 3.1.5; U; en-us; Sanyo; Polaris/6.0/AMB) Sprint SCP-2700

Thanks for this. I'm happy to add support for new useragents, but since I don't have the bandwidth to do the myself, the best way to do this is via pull request. If you're feeling up to it, I'm happy to provide guidance on how to get this merged.

w2gi commented

Hi Olaf,

If you could give me some pointers to get something merged back in,
we'll take on the task. I actually had made a significant amount of
changes back in the 1.39 version but so much has changed since then so
we'll see how I can get some of that included.

Best regards,

Jon Scarbrough
VP Technology
Where2GetIt.com

On 08/18/2015 01:48 PM, Olaf Alders wrote:

Thanks for this. I'm happy to add support for new useragents, but
since I don't have the bandwidth to do the myself, the best way to do
this is via pull request. If you're feeling up to it, I'm happy to
provide guidance on how to get this merged.


Reply to this email directly or view it on GitHub
#111 (comment).

Hi Jon,

Great! (BTW, thanks for helping out in the past.) The best thing I can do (I think) is to point you to some examples of good pull requests.

https://github.com/oalders/http-browserdetect/pull/110/files
https://github.com/oalders/http-browserdetect/pull/99/files

Basically, the internals are fairly simple (if a bit weird). The key is adding the correct cases to t/useragents.json so that we have some future proofing.

Let me know if there's any other info I can help you out with.

All the best,

Olaf

I can take a look at implementing this. What's the desired return value for these user agents? Easiest is if you show a test case showing exactly what they should look like.

w2gi commented

Brew is its own OS. So, in examples like

Mozilla/5.0 (compatible; Teleca Q7; Brew 3.1.5; U; en) 480X800 LGE VX11000

Brew 3.1.5 is the OS.

We've recently seen UAs like

Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; Brew_Browser_6.0_SP1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; MS-RTC EA 2; MS-RTC LM 8; InfoPath.3; MS-RTC LM 8)

so it appears that there is a Brew browser as well.

I believe Teleca is a browser, http://wapreview.com/448/

I just made a pull request that seems like it addresses this. Teleca is apparently an old branding for what's now called Obigo. That thing with Brew Browser I'm leaving as MSIE; that's clearly a desktop machine running a branded version of MSIE, and unless someone feels strongly otherwise I don't see a good reason to confuse the issue by introducing an alternate meaning of 'brew' into what we return.

All the UA strings you provided are now in the test suite, but a quick sample:

   "Mozilla/4.0 (BREW 3.1.5; U; en-us; Sanyo; Polaris/6.0/AMB) Sprint SCP-2700" : {
      "browser" : "polaris",
      "browser_major" : "6",
      "browser_minor" : ".0",
      "browser_string" : "Polaris",
      "country" : "US",
      "device" : "wap",
      "device_string" : "WAP capable phone",
      "language" : "EN",
      "match" : [
         "device",
         "brew",
         "wap",
         "mobile",
         "polaris"
      ],
      "os" : "brew",
      "os_beta" : ".5",
      "os_major" : "3",
      "os_minor" : ".1",
      "os_string" : "Brew"
   },
   "LG-LG511C/1.0[TF268435460911753637000000013342355993] Mozilla/5.0(compatible; Teleca Q7; BMP 1.0.1; U; en) 240X400 LGE LG-LG511C Profile/MIDP-2.\
1 Configuration/CLDC-1.1" : {
      "browser" : "obigo",
      "browser_major" : "7",
      "browser_minor" : ".0",
      "browser_string" : "Teleca",
      "device" : "wap",
      "device_string" : "LGE LG-LG511C",
      "language" : "EN",
      "match" : [
         "device",
         "brew",
         "wap",
         "mobile",
         "obigo"
      ],
      "os" : "brew",
      "os_beta" : ".1",
      "os_major" : "1",
      "os_minor" : ".0",
      "os_string" : "Brew MP"
   },