diff --git a/src/parser-browsers.js b/src/parser-browsers.js index 12a953c..fba7884 100644 --- a/src/parser-browsers.js +++ b/src/parser-browsers.js @@ -552,6 +552,23 @@ const browsersList = [ }, }, + /* PlayStation 4 */ + { + test: [/playstation 4/i], + describe(ua) { + const browser = { + name: 'PlayStation 4', + }; + const version = getFirstMatch(commonVersionIdentifier, ua); + + if (version) { + browser.version = version; + } + + return browser; + }, + }, + /* Safari */ { test: [/safari|applewebkit/i], diff --git a/src/parser-os.js b/src/parser-os.js index 2ee35a7..9896b6a 100644 --- a/src/parser-os.js +++ b/src/parser-os.js @@ -150,4 +150,16 @@ export default [ }; }, }, + + /* Playstation 4 */ + { + test: [/PlayStation 4/], + describe(ua) { + const version = getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i, ua); + return { + name: 'PlayStation 4', + version, + }; + }, + }, ]; diff --git a/src/parser-platforms.js b/src/parser-platforms.js index 6699aa8..6a3d1ea 100644 --- a/src/parser-platforms.js +++ b/src/parser-platforms.js @@ -4,6 +4,7 @@ const TYPES_LABELS = { tablet: 'tablet', mobile: 'mobile', desktop: 'desktop', + tv: 'tv', }; /* @@ -232,4 +233,16 @@ export default [ }; }, }, + + /* PlayStation 4 */ + { + test(parser) { + return parser.getOSName(true) === 'playstation 4'; + }, + describe() { + return { + type: TYPES_LABELS.tv, + }; + }, + }, ]; diff --git a/test/acceptance/useragentstrings.yml b/test/acceptance/useragentstrings.yml index f7a1cbe..5c05906 100644 --- a/test/acceptance/useragentstrings.yml +++ b/test/acceptance/useragentstrings.yml @@ -2595,3 +2595,17 @@ type: "desktop" engine: name: "Blink" + PlayStation 4: + - + ua: "Mozilla/5.0 (PlayStation 4 6.20) AppleWebKit/605.1.15 (KHTML, like Gecko) " + spec: + browser: + name: "PlayStation 4" + os: + name: "PlayStation 4" + version: "6.20" + platform: + type: "tv" + engine: + name: "WebKit" + version: "605.1.15"