From 1747707be680c70073bc0cb496ffaacda3314f2b Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Wed, 22 Mar 2023 11:18:52 +0700 Subject: [PATCH] Backport - Fix #678 - Improve Yandex detection (cherry picked from commit 33f02099d1bf2e074446c0608c4fbfcd22371475) --- src/ua-parser.js | 2 +- test/browser-test.json | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 85ab3fed3..97a9f3c35 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -251,7 +251,7 @@ ], [VERSION, [NAME, 'Konqueror']], [ /trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i // IE11 ], [VERSION, [NAME, 'IE']], [ - /yabrowser\/([\w\.]+)/i // Yandex + /ya(?:search)?browser\/([\w\.]+)/i // Yandex ], [VERSION, [NAME, 'Yandex']], [ /(avast|avg)\/([\w\.]+)/i // Avast/AVG Secure Browser ], [[NAME, /(.+)/, '$1 Secure '+BROWSER], VERSION], [ diff --git a/test/browser-test.json b/test/browser-test.json index ef0cb34f2..8e2f225ec 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -1298,6 +1298,16 @@ "major" : "1" } }, + { + "desc" : "Yandex", + "ua" : "Mozilla/5.0 (Linux; arm_64; Android 11; M2101K7AG) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.125 YaApp_Android/22.70 YaSearchBrowser/22.70 BroPP/1.0 SA/3 Mobile Safari/537.36", + "expect" : + { + "name" : "Yandex", + "version" : "22.70", + "major" : "22" + } + }, { "desc" : "Puffin", "ua" : "Mozilla/5.0 (Linux; Android 6.0.1; Lenovo P2a42 Build/MMB29M; en-us) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Mobile Safari/537.36 Puffin/6.0.8.15804AP",