-
Notifications
You must be signed in to change notification settings - Fork 158
Bump version to 0.5.1 #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
694 commits
Select commit
Hold shift + click to select a range
1fdb0de
Fixing travis.yml
lstrojny 2a79e36
Add link to whatsmy.info to README.
sandinmyjoints 2f623a7
New CLI tools for travis
lstrojny e4c410d
Updating README
lstrojny ebf8ba1
Merge pull request #305 from enemaerke/master
enemaerke 0ab719d
identify bingbot as a Spider
732c106
Kindle Fire HDX support
92ab148
Merge pull request #308 from lstrojny/feature/modernization
tobie 8a39909
Using regexes.php file instead of regexes.json
lstrojny fb7e296
Updating maintainer
lstrojny 06dd149
Merge pull request #316 from lstrojny/feature/php-array-file
lstrojny 78e6c3f
Smaller cleanups
lstrojny fef7f3f
Excluding performance test
lstrojny be831b4
OCD
lstrojny 38d209d
Merge pull request #303 from gregorydanko/kindlefire
commenthol 4972b73
Test case for Issue #297
21dc0a6
Issue 297: Move Firefox patterns between IE11 and other IE
7c978e1
Adding entry for LinkedInBot
niklasae 0f36164
Clean out extra space
niklasae 11aa16b
Use packaged regexes.yaml and not fetch it from remote
lstrojny b42ddd0
Merge pull request #311 from rottenbytes/bingbot
lstrojny d15a0f7
Updating docs
lstrojny 904b4f3
Merge branch 'master' into feature/split-parsers
lstrojny 82e87a8
Merge pull request #317 from tobie/feature/split-parsers
lstrojny 6ae0d60
Airmail,Outlook,Thunderbird new. Lightning updated
epgrubmair 81d0788
Outlook,Airmail,Thunderbird,Applemail unit tests for js fixed
epgrubmair 767ffa8
Merge pull request #325 from epgrubmair/mail_clients_1
tobie 64d1194
Merge pull request #321 from tobie/feature/simplified-constructor
lstrojny 3dcb264
Merge pull request #327 from antonioribeiro/patch-1
lstrojny a839825
Update npmignore
jakub-g b405175
Include tablets in 'Firefox OS' os detection.
b56f634
Merge pull request #337 from jakub-g/npmignore
tobie 2c90baa
Merge pull request #331 from miketaylr/fx-tablet
tobie 887fc0d
Merge pull request #335 from ChrisMcKee/master
enemaerke 371b524
Add Google+ Bot detection
spadgos 4508649
Adds test for Google Plus bot
spadgos d24541b
Merge pull request #345 from spadgos/patch-1
lstrojny 0b2fd75
Merge pull request #292 from lcalvy/master
lstrojny 6c15275
Better detection of QQ browsers.
lostsnow ed7f575
Merge pull request #353 from lostsnow/master
lstrojny 3e3d2f3
Vodafone is not a Browser
commenthol 064c574
Merge pull request #359 from commenthol/vodafone
lstrojny d779ce0
Detection of iBrowser, iRapp
commenthol ab63d80
Detect Windows NT 6.3 as Windows 8.1
commenthol e64bad0
Corrects detection of Symbian-OS
commenthol 66f3140
Merge pull request #364 from commenthol/ossymbian
lstrojny 4ce232d
Better detection of iOS from In-App Browsing
commenthol 09a3feb
Merge pull request #358 from commenthol/ibrowserirapp
lstrojny 5afa518
Merge pull request #363 from commenthol/oswin8.1
lstrojny 27d5c3e
Merge pull request #365 from commenthol/osiosapp
lstrojny 92670a2
Detect OS for OperaMini on Bada
commenthol bc68149
simplified regex operamini
commenthol b66236d
testcases for Opera Mini/att/ added
commenthol c8b309b
better detection of opera mobile
commenthol 948c24b
testcase fixed
commenthol 538e098
Merge pull request #367 from commenthol/osoperaminibada
lstrojny fb3cfce
Merge pull request #357 from commenthol/operamini
lstrojny a998d15
Merge pull request #356 from commenthol/operamobi
lstrojny 727e062
Better detection of Android Version; Simplified regex
commenthol c39532b
Merge pull request #360 from commenthol/osandroid
lstrojny f072f6b
Better detection of Linux Distributions, Versions
commenthol 24a0230
Merge pull request #334 from selwin/master
elsigh dcb543a
Merge pull request #369 from commenthol/oslinux
lstrojny e4ad1b2
Better OS detection for UCBrowser
commenthol cf01b22
qqbrowser: refactored regexes; mqqbrowser/mini added
commenthol 46efef5
Better Detection of GoogleTV; Joined Regex
commenthol b9bbd24
Better OS-detection for Windows Phone and other Windows Os
commenthol 8ea73d1
Merge pull request #361 from commenthol/osucweb
lstrojny 4adaff3
Merge pull request #355 from commenthol/qqbrowser
lstrojny 1e5d218
Merge pull request #366 from commenthol/osgoogletv
lstrojny 5950b67
Merge pull request #362 from commenthol/oswindows
lstrojny a0ae29c
Delete doubled test cases
commenthol 978240e
Detection of Dolphin Browser (Android + iOs)
commenthol af0f8c2
Detection of Nokia Series 30Plus added
commenthol af7c0cd
Merge pull request #372 from commenthol/os-series30
lstrojny 4622d6c
Adding Googlebot/2.1 as spider
yurigorokhov 1539740
Removing unnecessary line change
yurigorokhov aff83c1
Making version a regex
yurigorokhov b86b2e8
Removing regex groups
yurigorokhov 0471f07
Merge pull request #377 from yurigorokhov/googlebot-spider
lstrojny 40eab92
Adding Netvibes as Spider
commenthol 61b90af
Merge pull request #379 from commenthol/device-spider-netvibes
lstrojny 2ea5508
Detection of CFNetwork and iOS Applications
commenthol b397a3a
Merge pull request #381 from commenthol/ua-cfnetwork
lstrojny 9ee943d
add Sogou Pic Spider to the regexes
Ironholds c5342b9
add test for Sogu Pic Spider
Ironholds 29c617c
Clarify copyright status of the project(s)
Ironholds cff05c9
Merge pull request #383 from Ironholds/master
lstrojny 341b8fd
Squashed spider additions
9c5ad9d
Merge pull request #388 from Ironholds/master
lstrojny 5eb58f4
Merge pull request #391 from atifaziz/net35
enemaerke d0dc607
Merge pull request #393 from atifaziz/issue-390
enemaerke 73e003a
Merge pull request #394 from atifaziz/cs-app-top
enemaerke 1582762
Merge pull request #395 from atifaziz/cs-app
enemaerke bb080b3
Modify several regexes to accept more UA strings.
keshonok eb8d91c
Merge pull request #398 from atifaziz/cs-funk
enemaerke 2dea937
Merge pull request #400 from enemaerke/master
enemaerke 1e5ff4c
Added Android 4.4.2 tests to user agent. Added Nexus 5 test to devices.
markchalloner 86e3f57
Updated parser to expect Chrome Mobile for Nexus 5 instead of the OS …
markchalloner 1e39b66
Update the Haskell section in the README
basvandijk 1d44ed5
Update haskell example
deckool 93f91f6
Merge pull request #424 from deckool/patch-1
tobie 333046f
Revert "Update haskell example"
tobie 0ae8194
Merge pull request #425 from tobie/revert-424-patch-1
tobie e611e3b
Merge pull request #416 from basvandijk/update-haskell-docs
tobie a529bab
Merge pull request #402 from markchalloner/master
tobie d83daa1
Merge pull request #397 from keshonok/keshonok_regexes
tobie 0b29c99
Merge pull request #384 from Ironholds/patch-1
tobie ebae315
Merge pull request #312 from teambob/master
tobie f5936f7
Fixed regex for Opera Mobile to work with preg_match in php.
de9b5a6
Merge pull request #426 from ryancwarren/master
Ironholds 321039c
New entries for Spiders, Espial Smart TV, plus fixes for Windows Phon…
gquinones c302657
Merge pull request #429 from gquinones/master
Ironholds a10a95d
add new spider regex definitions and associated tests
39e9571
Merge pull request #430 from Ironholds/master
Ironholds 95d0d9a
Refined descriptions of CFNetwork versions of iOS. Added PlayStation …
gquinones 3a3cde8
merged tobie
gquinones f06245d
Merge pull request #431 from gquinones/master
Ironholds bd32948
Merge pull request #347 from asuhan/master
Ironholds b209449
Merge pull request #401 from atifaziz/cs-app-cleanup
Ironholds 1b5f67b
Merge pull request #309 from sandinmyjoints/link-readme-to-whatsmyua-…
Ironholds 4304448
Merge pull request #434 from emidln/emidln/add_dollar1_os_replacement…
Ironholds 36cb9b6
Merge pull request #439 from tmeryu/add-gae-support
Ironholds e2704fb
issue #440 - correct nodejs documentation
commenthol f738948
Merge pull request #441 from commenthol/fix-nodejs-documentation
commenthol 73543da
Add a spider (Riddler) that spams me.
cxmcc 39fed99
Merge pull request #442 from cxmcc/bots
Ironholds 63ac89d
Adding DBot into spider pattern.
1f892c9
Adding 'wsr-agent/1.0' to spider list.
cxmcc 589c6f8
Merge pull request #443 from openmail/openmail
Ironholds 771195e
simplify the spider-handling regex
559dc9a
Add manuafacturer info, fix too greedy regexes, improve andoid device…
cjnoyescrisp ff81242
Add manuafacturer info, fix too greedy regexes, improve andoid device…
cjnoyescrisp a0b8d13
Merge pull request #447 from cjnoyescrisp/master
Ironholds 0037cea
Merge pull request #449 from ceocoder/generate_valid_json
Ironholds a472a17
add Xenu to the spider IDing
6ba5265
it's become clear that the ua-parsing is, at least in Python, not cas…
b16e246
autocomplete
a1d06a7
add SeznamBot to Spider IDs
bffff1d
add PaperLiBot to Spider IDs
0ca6c35
add SputnikBot to Spider IDs
3835df2
add CCBot to Spider IDs
4814714
add ProoXiBot
9d4a87d
add Scrapy
2fa4d96
Fix Amazon Silk detection
drucifer 404d290
Fix Mobile Safari version # regex
drucifer 4edf05d
Add test cases
drucifer 34f9021
Retain patch number for Mobile Safari
drucifer 447a3fe
Move Silk even earlier in file to take priority over Chrome Mobile
drucifer dbaa6f3
Move NetFront to stay a step ahead of the new location of Silk
drucifer 3ef738b
Removing YamlDotNet dependency, replaced with minimal text parsing
enemaerke 3b5b293
Merge pull request #453 from enemaerke/master
enemaerke 0963c3f
Merge pull request #455 from floydsoft/patch-1
Ironholds 46c18ea
Merge pull request #452 from drucifer/master
Ironholds 2afc041
Merge pull request #380 from somechris/java-versioning
Ironholds b3dbd2f
Merge pull request #457 from onkarjanwa/patch-1
Ironholds dff9b29
Puffin Browser added
commenthol 82c45eb
fix Puffin Browser missing patch version
commenthol 5e70610
Merge pull request #460 from commenthol/ua-puffin
Ironholds abaf8e0
add new spiders
ce18019
Merge pull request #462 from Ironholds/master
Ironholds 3a5181d
more crawlers
da4c1ff
Merge pull request #463 from Ironholds/master
Ironholds 8957274
Improve Travis testing call
Ironholds 0f67779
Update README.markdown
tobie bdb7f36
current state brand model parsing
commenthol 1ac96a7
Merge pull request #466 from commenthol/brand-model-progress
Ironholds 4bae085
slight tweak
Ironholds c78e57c
Revert "Current State Brand-Model Parsing"
tobie 229a772
Merge pull request #469 from tobie/revert-466-brand-model-progress
Ironholds 4a1406d
0.3.4
tobie 830e691
initial project setup
commenthol 2d558b8
IE TechPreview uses Edge
commenthol 94502d5
Add irc notifications on build tests.
tobie 74a8867
Fix package.json after migration.
tobie 3bf98d2
Pick a less verbose test reporter.
tobie 0e4c833
Merge pull request #7 from tobie/cleanup-pkg
commenthol 74ec2fa
Rename README file for consistency.
tobie 7d4ca96
Merge pull request #8 from tobie/rename
commenthol 28ad0ba
Specification 0.1 Draft
commenthol e5e73ff
Specification
tobie fcee669
tests README added
tobie c19a040
minor fix
tobie 5657c92
test suites separated
commenthol cdd5a67
move Netfront to prevous place
commenthol dc5e464
Merge pull request #9 from commenthol/specification
Ironholds 5a04429
Merge pull request #11 from commenthol/testsuites
Ironholds 7855e1b
Merge pull request #12 from commenthol/ua-netfront-move
Ironholds 68a36da
Revert "move Netfront to prevous place"
tobie aed7c69
Revert "Testsuites"
tobie 2d003a5
Merge pull request #15 from ua-parser/revert-11-testsuites
Ironholds d07f5fc
Merge pull request #14 from ua-parser/revert-12-ua-netfront-move
Ironholds c38841b
dot removed
commenthol 8ca30c4
Merge pull request #16 from commenthol/dot-removed
tobie b4b1625
change yaml format to match others
commenthol 0c1abc3
Merge pull request #13 from commenthol/pgts-yaml-format
tobie d64e9fc
Improve documentation formatting
bnjmnt4n 3bcfde4
Merge pull request #18 from d10/docs
Ironholds f5a0250
Add new Opera browsers: Coast and Opera Mini
r4fek c92cdb5
Merge pull request #19 from r4fek/opera-regexes
Ironholds 3021618
brand-model parsing with current test set
commenthol 1600390
testcases brand model
commenthol b3a6e3e
test_device_brandmodel.yaml merged into test_device.yaml
commenthol 22ef8a1
Merge pull request #10 from commenthol/brand-model
tobie e3eb7b7
fix-replacement-groups
commenthol 3d089cc
updating ua object to match implementations
diminished 5b03726
Update specification.md
diminished f6ccc13
Update specification.md
diminished 88eabe5
Merge pull request #26 from diminished/master
commenthol b928927
test device model and brand values
mrjgreen c4e479e
Windows 10 detection
ee28e35
Windows NT 6.4 is also Windows 10
8f7aae8
Merge pull request #37 from mrjgreen/test-device
elsigh 73be54d
added failing test for thomson hbbtv
a431239
passing hbbtv test
207971c
Merge pull request #44 from mrjgreen/hbbtv-thomson
commenthol 69d3a35
Merge pull request #42 from yozik04/master
commenthol 9bb7724
Merge pull request #25 from commenthol/fix-replacement-groups
commenthol f3000a7
Add regex and test for Vivaldi (https://vivaldi.com/)
05dc6ff
Merge pull request #47 from bluesmoon/add-vivaldi
commenthol 553471e
- add Mac OS X Yosemite, CFNetwork/711 and 720 versions;
218c268
Merge pull request #52 from obormot/apple_updates
commenthol d431bec
MacAppStore added
commenthol 5d97a93
Merge pull request #48 from commenthol/macappstore
commenthol 3e69839
iTunes added
commenthol 783cf47
Merge pull request #50 from commenthol/itunes
commenthol 42b4eff
better detection of Mac OS X
commenthol 49d2ed1
Merge pull request #49 from commenthol/osx
commenthol edf2249
better bot detection
commenthol 7977294
Merge pull request #27 from commenthol/better-bot-detection
commenthol 6fd6c26
Fixed HbbTV/Thomson regex
27a4703
Merge pull request #53 from russellwhitaker/rw/correct-hbbtv-thomson-14
commenthol e1e4b32
Corrected device_parser section example and family_replacement
1dbefc4
Removed js_ua from browser test fixtures and removed references in te…
3f2f648
Merge pull request #57 from russellwhitaker/rw/update_specification_d…
elsigh f3f0be8
Merge pull request #58 from russellwhitaker/rw/remove_js_ua
elsigh 87b6282
Fixed MS Edge detection (Edge != IE)
nicole-ashley d6488da
Add Java user agent family
housepage dbe4d49
Add tests for add Java user agent family
housepage 57b37b6
Merge pull request #59 from nikrolls/fix-ms-edge-detection
commenthol caf64e1
Merge pull request #60 from housepage/add-java-user-agent-family
commenthol 0fdc414
removal of negative lookaheads
commenthol 8433fa6
Merge pull request #64 from commenthol/no-neg-lookahead
elsigh c9c7483
Fix a bug in one of the Android regexps.
csilvers 146cd3b
Add a test!
csilvers 0adc071
Merge pull request #73 from csilvers/master
elsigh b017cd0
Merge uap-core
selwin 20abd66
Merge branch 'master' of https://github.com/ua-parser/uap-python
selwin f4ea8e3
Merge branch 'master' of https://github.com/ua-parser/uap-python
selwin b6c3dc9
Bump up version to 0.5.1
selwin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.DS_Store | ||
node_modules/ | ||
*.pyc | ||
*.egg-info/ | ||
.eggs/ | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Contributing Changes to regexes.yaml | ||
------------------------------------ | ||
|
||
Contributing to the project, especially `regexes.yaml`, is both welcomed and encouraged. To do so just do the following: | ||
|
||
1. Fork the project | ||
2. Create a branch for your changes | ||
3. Modify `regexes.yaml` as appropriate | ||
4. Add relevant tests to the following files and follow their format: | ||
* `tests/test_device.yaml` | ||
* `tests/test_os.yaml` | ||
* `tests/test_ua.yaml` | ||
5. Push your branch to GitHub and submit a pull request | ||
6. Monitor the pull request to make sure the Travis build succeeds. If it fails simply make the necessary changes to your branch and push it. Travis will re-test the changes. | ||
|
||
That's it. If you don't feel comfortable forking the project or modifying the YAML you can also [submit an issue](https://github.com/ua-parser/uap-core/issues) that includes the appropriate user agent string and the expected results of parsing. | ||
|
||
Thanks! |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Apache License, Version 2.0 | ||
=========================== | ||
|
||
Copyright 2009 Google Inc. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,204 @@ | ||
# ua-parser Specification | ||
|
||
Version 0.2 Draft | ||
|
||
This document describes the specification on how a parser must implement the `regexes.yaml` file for correctly parsing user-agent strings on basis of that file. | ||
|
||
This specification intends to help maintainers and contributors to correctly use the provided information within the `regexes.yaml` file for obtaining information from the different user-agent strings. Furthermore this specification tries to be the basis for discussions on evolving the projects and the needed parsing algorithms. | ||
|
||
This document will not provide any information on how to implement the ua-parser project on your server and how to retreive the user-agent string for further processing. | ||
|
||
# `regexes.yaml` | ||
|
||
Any information which can be obtained from a user-agent string may contain information on: | ||
|
||
* User-Agent aka “the browser” | ||
* OS (Operating System) the User-Agent currently uses (or runs on) | ||
* Device information by means of the physical device the User-Agent is using | ||
|
||
This information is provided within the `regexes.yaml` file. Each kind of information requires a different parser which extracts the related type. These are: | ||
|
||
* `user_agent_parser` | ||
* `os_parsers` | ||
* `device_parsers` | ||
|
||
Each parser contains a list of regular-expressions which are named `regex`. For each `regex` replacements specific to the parser can be named to attribute or change information. A replacement may require a match from the regular-expression which is extracted by an expression enclosed in normal brackets `"()"`. Each match can be addressed with `$1` to `$9` and used in a parser specific replacement. | ||
|
||
**TODO**: Provide some insights into the used chars. E.g. escape `"."` as `"\."` and `"("` as `"\("`. `"/"` does not need to be escaped. | ||
|
||
## `user_agent_parsers` | ||
|
||
The `user_agent_parsers` returns information of the `family` type of the User-Agent. | ||
If available the version infomation specifying the `family` may be extracted as well if available. | ||
Here major, minor and patch version information can be addressed or overwritten. | ||
|
||
| match in regex | default replacement | placeholder in replacement | note | | ||
| ---- | ------------------- | ---- | --------------------------------------- | | ||
| 1 | family_replacement | $1 | specifies the User-Agents family | | ||
| 2 | v1_replacement | $2 | major version number/info of the family | | ||
| 3 | v2_replacement | $3 | minor version number/info of the family | | ||
| 4 | v3_replacement | $4 | patch version number/info of the family | | ||
|
||
In case that no replacement is specified, the association is given by order of the match. If in the `regex` no first match (within normal brackets) is given, the `family_replacement` shall be specified! | ||
To overwrite the respective value the replacement value needs to be named for a `regex`-item. | ||
|
||
**Parser Implementation:** | ||
|
||
The list of regular-expressions `regex` shall be evaluated for a given user-agent string beginning with the first `regex`-item in the list to the last item. The first matching `regex` stops processing the list. Regex-matching shall be case sensitive. | ||
|
||
In case that no replacement for a match is specified for a `regex`-item, the first match defines the `family`, the second `major`, the third `minor`and the forth `patch` information. | ||
If a `*_replacement` string is specified it shall overwrite or replace the match. | ||
|
||
As placeholder for inserting matched characters use within | ||
* `family_replacement`: `$1` | ||
* `v1_replacement`: `$2` | ||
* `v2_replacement`: `$3` | ||
* `v3_replacement`: `$4` | ||
|
||
If no matching `regex` is found the value for `family` shall be “Other”. The version information `major`, `minor` and `patch` shall not be defined. | ||
|
||
**Example:** | ||
|
||
For the User-Agent: `Mozilla/5.0 (Windows; Windows NT 5.1; rv:2.0b3pre) Gecko/20100727 Minefield/4.0.1pre` | ||
the matching `regex`: | ||
|
||
``` | ||
- regex: '(Namoroka|Shiretoko|Minefield)/(\d+)\.(\d+)\.(\d+(?:pre)?)' | ||
family_replacement: 'Firefox ($1)' | ||
``` | ||
|
||
resolves to: | ||
|
||
``` | ||
family: Firefox (Minefield) | ||
major : 4 | ||
minor : 0 | ||
patch : 1pre | ||
``` | ||
|
||
## `os_parsers` | ||
|
||
The `os_parsers` return information of the `os` type of the Operating System (OS) the User-Agent runs. | ||
If available the version information specifying the `os` may be extracted as well if available. | ||
Here major, minor and patch version information can be addressed or overwritten. | ||
|
||
| match in regex | default replacement | placeholder in replacement | note | | ||
| ---- | ----------------- | ---- | ---------------------------------------- | | ||
| 1 | os_replacement | $1 | specifies the OS | | ||
| 2 | os_v1_replacement | $2 | major version number/info of OS | | ||
| 3 | os_v2_replacement | $3 | minor version number/info of the OS | | ||
| 4 | os_v3_replacement | $4 | patch version number/info of the OS | | ||
| 5 | os_v4_replacement | $5 | patchMinor version number/info of the OS | | ||
|
||
In case that no replacement is specified, the association is given by order of the match. If in the `regex` no first match (within normal brackets) is given, the `os_replacement` shall be specified! | ||
To overwrite the respective value the replacement value needs to be named for a `regex`-item. | ||
|
||
**Parser Implementation:** | ||
|
||
The list of regular-expressions `regex` shall be evaluated for a given user-agent string beginning with the first `regex`-item in the list to the last item. The first matching `regex` stops processing the list. Regex-matching shall be case sensitive. | ||
|
||
In case that no replacement for a match is specified for a `regex`-item, the first match defines the `os` family, the second `major`, the third `minor`, the forth `patch` and the fifth `patchMinor` version information. | ||
If a `*_replacement` string is specified it shall overwrite or replace the match. | ||
|
||
As placeholder for inserting matched characters use within | ||
* `os_replacement`: `$1` | ||
* `os_v1_replacement`: `$2` | ||
* `os_v2_replacement`: `$3` | ||
* `os_v3_replacement`: `$4` | ||
* `os_v4_replacement`: `$5` | ||
|
||
In case that no matching `regex` is found the value for `os` shall be “Other”. The version information `major`, `minor`, `patch` and `patchMinor` shall not be defined. | ||
|
||
**Example:** | ||
|
||
For the User-Agent: `Mozilla/5.0 (Windows; U; Win95; en-US; rv:1.1) Gecko/20020826` | ||
the matching `regex`: | ||
|
||
``` | ||
- regex: 'Win(95|98|3.1|NT|ME|2000)' | ||
os_replacement: 'Windows $1' | ||
``` | ||
|
||
resolves to: | ||
|
||
``` | ||
os: Windows 95 | ||
``` | ||
|
||
## `device_parsers` | ||
|
||
The `device_parsers` return information of the device `family` the User-Agent runs on. | ||
Furthermore `brand` and `model` of the device can be specified. | ||
`brand` names the manufacturer of the device, where model specifies the model of the device. | ||
|
||
| match in regex | default replacement | placeholder in replacement | note | | ||
| ---- | ------------------ | ------- | ---------------------------------------- | | ||
| 1 | device_replacement | $1...$9 | specifies the device family | | ||
| any | brand_replacement | $1...$9 | major version number/info of OS | | ||
| 1 | model_replacement | $1...$9 | minor version number/info of the OS | | ||
|
||
In case that no replacement is specified the association is given by order of the match. | ||
If in the `regex` no first match (within normal brackets) is given the `device_replacement` together with the `model_replacement` shall be specified! | ||
To overwrite the respective value the replacement value needs to be named for a given `regex`. | ||
|
||
For the `device_parsers` some `regex` require case insensitive parsing for proper matching. (E.g. Generic Feature Phones). To distinguish this from the case sensitive default case, the value `regex_flag: 'i'` is used to indicate that the regular-expression matching shall be case-insensitive for this regular expression. | ||
|
||
**Parser Implementation:** | ||
|
||
The list of regular-expressions `regex` shall be evaluated for a given user-agent string beginning with the first `regex`-item in the list to the last item. The first matching `regex` stops processing the list. Regex-matching shall be case sensitive. | ||
|
||
In case that no replacement for a match is given, the first match defines the `family` and the `model`. | ||
If a `*_replacement` string is specified it shall overwrite or replace the match. | ||
|
||
As placeholder for inserting matched characters `$1` to `$9` can be used to insert the matched characters from the regex into the replacement string. | ||
|
||
In case that no matching `regex` is found the value for `family` shall be “Other”. `brand` and `model` shall not be defined. | ||
Leading and tailing whitespaces shall be trimmed from the result. | ||
|
||
**Example:** | ||
|
||
For the User-Agent: `Mozilla/5.0 (Linux; U; Android 4.2.2; de-de; PEDI_PLUS_W Build/JDQ39) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30` | ||
the matching `regex`: | ||
|
||
``` | ||
- regex: '; *(PEDI)_(PLUS)_(W) Build' | ||
device_replacement: 'Odys $1 $2 $3' | ||
brand_replacement: 'Odys' | ||
model_replacement: '$1 $2 $3' | ||
``` | ||
|
||
resolves to: | ||
|
||
``` | ||
family: 'Odys PEDI PLUS W' | ||
brand: 'Odys' | ||
model: 'PEDI PLUS W' | ||
``` | ||
|
||
# Parser Output | ||
|
||
To allow interoperability with code that builds upon ua-parser, it is recommended to provide the parser output in a standardized way. The structure defined in [WebIDL](http://www.w3.org/TR/WebIDL/) may follow: | ||
|
||
``` | ||
interface ua-parser-output { | ||
attribute string string; // The "user-agent" string | ||
object ua: { // The "user_agent_parsers" result | ||
attribute string family; | ||
attribute string major; | ||
attribute string minor; | ||
attribute string patch; | ||
}; | ||
object os: { // The "os_parsers" result | ||
attribute string family; | ||
attribute string major; | ||
attribute string minor; | ||
attribute string patch; | ||
attribute string patchMinor; | ||
}; | ||
object device: { // The "device_parsers" result | ||
attribute string family; | ||
attribute string brand; | ||
attribute string model; | ||
}; | ||
}; | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"name": "uap-core", | ||
"description": "The regex file necessary to build language ports of Browserscope's user agent parser.", | ||
"version": "0.4.0", | ||
"maintainers": [ | ||
{ | ||
"name": "Tobie Langel", | ||
"email": "[email protected]", | ||
"web": "http://tobielangel.com" | ||
}, | ||
{ | ||
"name": "Lindsey Simon", | ||
"email": "[email protected]", | ||
"web": "http://www.idreamofuni.com" | ||
} | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "http://github.com/ua-parser/uap-core.git" | ||
}, | ||
"licenses": [ | ||
{ | ||
"type": "Apache-2.0", | ||
"url": "https://raw.github.com/ua-parser/uap-core/master/LICENSE" | ||
} | ||
], | ||
"devDependencies": { | ||
"yamlparser": ">=0.0.2", | ||
"mocha": "*", | ||
"uap-ref-impl": "*" | ||
}, | ||
"scripts": { | ||
"test": "mocha -u tdd -R min ./tests/test.js" | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has an unresolved merge conflict, which is also reflected on pypi. :(