browscap.csv vs browscap.xml

108 views
Skip to first unread message

Omer van der Horst Jansen

unread,
Dec 24, 2015, 11:27:54 AM12/24/15
to browscap
I've been using the browscap.xml file to identify the browsers that are being used to visit our sites. Lately I'm having trouble matching a lot of browsers and I think it's because not all of the patterns are included in the XML file.

For example, I'm trying to match this user agent:

Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1

According to the user agent lookup on the website, this matches this browser name pattern:

mozilla/5.0*(iphone*cpu iphone os 9?1* like mac os x*)*applewebkit/*(*khtml, like gecko*)*version/9.0*safari/*


This pattern exists in browscap.csv (line 112601 in version 6011). But the same pattern doesn't exist in the equivalent browscap.xml file so my code fails to find a matching pattern.

The CSV file has 137403 entries (wc -l browscap.csv, minus header line) and the XML file has 51122 entries (grep -c \<browscapitem browscap.xml).

Is this a bug? Or am I misunderstanding how the XML file should be used, and should I start using the CSV file instead? I'm using Go (golang) so the INI file isn't as easy to work with.

Thanks & happy holidays,

Omer


James Titcumb

unread,
Dec 28, 2015, 6:55:17 AM12/28/15
to browscap on behalf of Omer van der Horst Jansen
I believe we have started removing some entries from the XML file as it was growing extremely large (the XML tags add a huge amount of overhead).

If the files available from browscap.org aren't sufficient, you can always run the build script from https://github.com/browscap/browscap and configure the generated XML to include the full list of definitions.

Hope that helps

Thanks
James



--
You received this message because you are subscribed to the Google Groups "browscap" group.
To unsubscribe from this group and stop receiving emails from it, send an email to browscap+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/browscap/56be186e-a00f-448a-9e23-93cba737434e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

James Titcumb

unread,
Dec 28, 2015, 6:58:25 AM12/28/15
to browscap on behalf of Omer van der Horst Jansen
FYI, you would need to modify the filter used for the XML definition in the following file:


Modify the "$xmlWriter" definition to use the "$fullFilter" instead of "$stdFilter", and I'd probably comment out the rest of the writers if you're not interested in them :)

Thanks
James

Omer van der Horst Jansen

unread,
Dec 28, 2015, 9:34:40 AM12/28/15
to browscap on behalf of James Titcumb
Thanks James! I've changed my code to use the CSV file.

--
You received this message because you are subscribed to a topic in the Google Groups "browscap" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/browscap/x9pA5g38wt0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to browscap+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/browscap/CAKnqCEZnOC9oHuGN98d2CK8g3dzsAVaHyBU--MU9SDVuW2vokQ%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages