Skip to content
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

Improves detection for Android, GNU/Linux and tvOS #7664

Merged
merged 7 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Parser/OperatingSystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ protected function parsePlatform(): string
}
}

if ($this->matchUserAgent('arm|aarch64|Apple ?TV|Watch ?OS|Watch1,[12]')) {
if ($this->matchUserAgent('arm|.*arm64|aarch64|Apple ?TV|Watch ?OS|Watch1,[12]')) {
return 'ARM';
}

Expand All @@ -691,7 +691,7 @@ protected function parsePlatform(): string
return 'x64';
}

if ($this->matchUserAgent('.+32bit|.+win32|(?:i[0-9]|x)86|i86pc')) {
if ($this->matchUserAgent('.*32bit|.*win32|(?:i[0-9]|x)86|i86pc')) {
return 'x86';
}

Expand Down
34 changes: 33 additions & 1 deletion Tests/Parser/fixtures/oss.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4454,7 +4454,7 @@
name: Lineage OS
short_name: LEN
version: "17.1"
platform: ""
platform: "ARM"
family: Android
-
user_agent: Mozilla/5.0 (Linux; Android 9; lineage_serranoltexx) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Mobile Safari/537.36
Expand Down Expand Up @@ -4910,3 +4910,35 @@
version: "7"
platform: ""
family: GNU/Linux
-
user_agent: RSSOwl/2.2.1.201312301316 (X11; U; en)
os:
name: GNU/Linux
short_name: LIN
version: ""
platform: ""
family: GNU/Linux
-
user_agent: Anytime/1.3.3 b95 (phone;android sdk_gphone64_arm64-userdebug 13 TE1A.220922.012 9302419 dev-keys) https://github.com/amugofjava/anytime_podcast_player
os:
name: Android
short_name: AND
version: "13"
platform: "ARM"
family: Android
-
user_agent: 'Trade Me/163.0 (Android: samsung (SM-S9210)); API 14'
os:
name: Android
short_name: AND
version: "14"
platform: ""
family: Android
-
user_agent: iPlayTV/3.3.9 (Apple TV; iOS 16.1; Scale/1.00)
os:
name: tvOS
short_name: ATV
version: "16.1"
platform: ARM
family: iOS
9 changes: 6 additions & 3 deletions Tests/fixtures/feed_reader.yml
Original file line number Diff line number Diff line change
Expand Up @@ -479,16 +479,19 @@
browser_family: Unknown
-
user_agent: RSSOwl/2.2.1.201312301316 (X11; U; en)
os: [ ]
os:
name: GNU/Linux
version: ""
platform: ""
client:
type: feed reader
name: RSSOwl
version: 2.2.1.201312301316
device:
type: ""
type: desktop
brand: ""
model: ""
os_family: Unknown
os_family: GNU/Linux
browser_family: Unknown
-
user_agent: Evergreen (macOS; RSS Reader; https://ranchero.com/evergreen/)
Expand Down
4 changes: 2 additions & 2 deletions Tests/fixtures/podcasting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2256,8 +2256,8 @@
user_agent: Anytime/1.3.3 b95 (phone;android sdk_gphone64_arm64-userdebug 13 TE1A.220922.012 9302419 dev-keys) https://github.com/amugofjava/anytime_podcast_player
os:
name: Android
version: ""
platform: ""
version: "13"
platform: "ARM"
client:
type: mobile app
name: Anytime Podcast Player
Expand Down
20 changes: 14 additions & 6 deletions regexes/oss.yml
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@
name: 'Android'
version: ''

- regex: '(?:Android OS|OMDroid)[ /](\d+[\.\d]*)'
- regex: '(?:Android OS|OMDroid|sdk_gphone64_arm64-userdebug)[ /](\d+[\.\d]*)'
name: 'Android'
version: '$1'

Expand Down Expand Up @@ -650,6 +650,10 @@
name: 'Android'
version: '$1'

- regex: '\(Android:.*\); API (\d+[\.\d]*)'
name: 'Android'
version: '$1'

- regex: ' Adr |.*(?<!like |/ )Android|Silk-Accelerated=[a-z]{4,5}'
name: 'Android'
version: ''
Expand Down Expand Up @@ -1056,6 +1060,10 @@
name: 'tvOS'
version: '$1'

- regex: 'Apple TV; iOS ((?:9|1[0-7])[_\.]\d+(?:[_.]\d+)*)'
name: 'tvOS'
version: '$1'

- regex: 'iOS(?:; |/)((?:9|1[0-7])\.\d+(?:[_\.]\d+)*) (?:model/)?AppleTV'
name: 'tvOS'
version: '$1'
Expand All @@ -1064,6 +1072,10 @@
name: 'tvOS'
version: '$1'

- regex: 'AppleTV(?:/?(\d+[\.\d]+))?'
name: 'tvOS'
version: '$1'

##########
# watchOS (https://developer.apple.com/watchos/)
##########
Expand Down Expand Up @@ -1694,10 +1706,6 @@
name: 'Google TV'
version: '$1'

- regex: 'AppleTV(?:/?(\d+[\.\d]+))?'
name: 'tvOS'
version: '$1'

- regex: 'WebTV/(\d+[\.\d]+)'
name: 'WebTV'
version: '$1'
Expand Down Expand Up @@ -1798,7 +1806,7 @@
name: 'GNU/Linux'
version: '$1'

- regex: 'Linux(?:OS)?[^a-z]|Cinnamon/(?:\d+[\.\d]+)|.+(?:pc|unknown)-linux-gnu'
- regex: 'Linux(?:OS)?[^a-z]|Cinnamon/(?:\d+[\.\d]+)|.+(?:pc|unknown)-linux-gnu|X11'
name: 'GNU/Linux'
version: ''

Expand Down
Loading