diff --git a/regexes.yaml b/regexes.yaml index f09bbbee..1f480045 100644 --- a/regexes.yaml +++ b/regexes.yaml @@ -759,6 +759,13 @@ user_agent_parsers: # AnyConnect - regex: '(AnyConnect)\/(\d+)(?:\.(\d+)(?:\.(\d+)|)|)' + # Sonos + # @ref: https://docs.sonos.com/docs/soap-requests-and-responses#user-agent-header + - regex: '(Sonos)/(\d+)\.(\d+)()-[^(]+\((ACR|ICRU|MDCR|WDCR)' + family_replacement: 'SonosApp' + - regex: '(Sonos)/(\d+)\.(\d+)-[^(]+\(ZP' + family_replacement: 'SonosPlayer' + # Monitis - regex: 'compatible; monitis' family_replacement: 'Monitis' @@ -4354,6 +4361,16 @@ device_parsers: brand_replacement: 'Motorola' model_replacement: 'XT902' + ######### + # Sonos + # @ref: https://docs.sonos.com/docs/soap-requests-and-responses#user-agent-header + # @ref: https://explore.whatismybrowser.com/useragents/explore/software_name/sonos-player/ + ######### + - regex: 'Sonos/\d+[^(]+\((ZP[^)]+)\)' + brand_replacement: 'Sonos' + device_replacement: 'Player' + model_replacement: '$1' + ######### # Trekstor # @ref: http://www.trekstor.co.uk/surftabs-en.html diff --git a/tests/test_device.yaml b/tests/test_device.yaml index f868d927..b4fa9008 100644 --- a/tests/test_device.yaml +++ b/tests/test_device.yaml @@ -80584,5 +80584,17 @@ test_cases: brand: 'Motorola' model: 'motorola moto g play (2021)' + - user_agent_string: 'Linux UPnP/1.0 Sonos/76.2-47142 (ZPS22)' + family: 'Player' + brand: 'Sonos' + model: 'ZPS22' - \ No newline at end of file + - user_agent_string: 'Linux UPnP/1.0 Sonos/26.7-48310 (ZP120)' + family: 'Player' + brand: 'Sonos' + model: 'ZP120' + + - user_agent_string: 'Linux UPnP/1.0 Sonos/29.3-87071 (ICRU\_iPhone7,1); iOS/Version 8.2 (Build 12D508)' + family: 'iPhone' + brand: 'Apple' + model: 'iPhone7,1' diff --git a/tests/test_ua.yaml b/tests/test_ua.yaml index 1a6c8f8e..cd1a6192 100644 --- a/tests/test_ua.yaml +++ b/tests/test_ua.yaml @@ -8688,6 +8688,30 @@ test_cases: minor: '2' patch: '1' + - user_agent_string: 'Linux UPnP/1.0 Sonos/76.2-47142 (ZPS22)' + family: 'SonosPlayer' + major: '76' + minor: '2' + patch: + + - user_agent_string: 'Linux UPnP/1.0 Sonos/26.7-48310 (ZP120)' + family: 'SonosPlayer' + major: '26' + minor: '7' + patch: + + - user_agent_string: 'Linux UPnP/1.0 Sonos/29.3-87071 (ICRU\_iPhone7,1); iOS/Version 8.2 (Build 12D508)' + family: 'SonosApp' + major: '29' + minor: '3' + patch: + + - user_agent_string: 'Linux UPnP/1.0 Sonos/76.2-48062 (ACR_:samsung:p3quew:SM-G998U1)' + family: 'SonosApp' + major: '76' + minor: '2' + patch: + - user_agent_string: 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 Safari/605.1.15 (Ecosia ios@8.1.3.72)' family: 'Ecosia iOS' major: '8'