browser 6.0.0 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 955928c52746af052fa9e4acb5555ba3d438326670ee5b587f7a66eff89193f5
4
- data.tar.gz: a9a9a822b3dcac0fa8b5a1f946e60c1c4eef3bc2801c41b990b33c496bb635ed
3
+ metadata.gz: cc6ec7dfcb388ec7584be57709ff9c01fbef5cc8ce65cab9810a27d42adafd84
4
+ data.tar.gz: 34979727435f7b5a8e6fb65c758f144925c167abc192abcdefc939353eee9ed6
5
5
  SHA512:
6
- metadata.gz: b35967db554e9dc880c4998418fde96e2fd8c75283ebc9549c948754ce9b9b383fc5977cfe1008ae176e4e00c7ecf1318d0ed8bc31f987ed19aaef294cbb669b
7
- data.tar.gz: 845a5a586f88a402f967a1c5ce43cdb3f736c33aa78288e23972f4ee14e07d81fa805bef169000979d14dcb9d24299ef008d452c29c04b88b50e3516f76b3baf
6
+ metadata.gz: 4859b7dcca0706511efeaa14a5eccda8c3d8754aa5223fcb1b930d93436c8cdf547f8511ce0b9e519109626c56b0b3b22f2fc527964c537500e463eead5a8709
7
+ data.tar.gz: 5f37c58194e893bb10a5d6ad95ec0f106e9d6b7f0a1db4754d69844a7d0d560620bf876199be511b75e460a0dad8227434b785e4718d84d09f6d3e78108df398
@@ -23,7 +23,7 @@ jobs:
23
23
  gemfile:
24
24
  - Gemfile
25
25
  - gemfiles/7_1.gemfile
26
- - gemfiles/6_1.gemfile
26
+ - gemfiles/7_0.gemfile
27
27
 
28
28
  steps:
29
29
  - uses: actions/checkout@v2.4.0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 6.2.0
4
+
5
+ - Add `Browser::Base#epiphany?`.
6
+ - Don't ever match linux-based browsers as Safari.
7
+
8
+ ## 6.1.0
9
+
10
+ - Add more bots (mostly related to AI crawlers)
11
+ - Add AppSignal bot
12
+ - Add Checkly bot
13
+ - Detect Chrome when requesting desktop site.
14
+
3
15
  ## 6.0.0
4
16
 
5
17
  - Add `Browser::Base#chromium_based?`.
@@ -96,13 +108,11 @@
96
108
  - You can now define new bot matchers by adding a callable object to
97
109
  `Browser::Bot.matchers`.
98
110
  - Fix `browser.yandex?` and `browser.sputnik?`.
99
- - [BREAKING CHANGE] Removed methods to enable the bot's empty user agent
100
- detection (`Browser::Bot.detect_empty_ua!` and
101
- `Browser::Bot.detect_empty_ua?`).
102
- - [BREAKING CHANGE] Bot detection is now more aggressive by default. It matches
103
- empty user agents, anything that matches
104
- `crawl|fetch|search|monitoring|spider|bot`, and anything listed under
105
- https://github.com/fnando/browser/blob/master/bots.yml.
111
+ - [BREAKING CHANGE] Removed methods to enable the bot's empty user agent detection
112
+ (`Browser::Bot.detect_empty_ua!` and `Browser::Bot.detect_empty_ua?`).
113
+ - [BREAKING CHANGE] Bot detection is now more aggressive by default. It matches empty
114
+ user agents, anything that matches `crawl|fetch|search|monitoring|spider|bot`,
115
+ and anything listed under https://github.com/fnando/browser/blob/master/bots.yml.
106
116
  - Add Jaunt to the bot list.
107
117
 
108
118
  ## 2.7.1
data/README.md CHANGED
@@ -55,6 +55,7 @@ browser.qq?
55
55
  browser.weibo?
56
56
  browser.sputnik?
57
57
  browser.sougou_browser?
58
+ browser.epiphany?
58
59
 
59
60
  # Get bot info
60
61
  browser.bot.name
@@ -432,7 +433,7 @@ information.
432
433
 
433
434
  ## Maintainer
434
435
 
435
- - Nando Vieira - http://nandovieira.com
436
+ - Nando Vieira - https://nandovieira.com
436
437
 
437
438
  ## Contributors
438
439
 
data/bots.yml CHANGED
@@ -16,6 +16,7 @@ apachebench: ApacheBench (ab)
16
16
  apis-google: APIs-Google
17
17
  appengine-google: Google App Engine
18
18
  applebot: Apple Bot
19
+ appsignal: AppSignal Bot
19
20
  archive.org_bot: Internet Archive (archive.org)
20
21
  archiveteam archivebot: ArchiveTeam ArchiveBot
21
22
  ask jeeves: Ask Jeeves
@@ -38,6 +39,7 @@ buzzbot: Buzzbot
38
39
  buzztalk: buzztalk
39
40
  catchbot: CatchBot (catchbot.com)
40
41
  check_http: Nagios monitor
42
+ checkly: Checkly
41
43
  chrome-lighthouse: Chrome-Lighthouse
42
44
  cipacrawler: CipaCrawler
43
45
  cliqzbot: Cliqzbot
@@ -291,7 +293,28 @@ zoombot: ZoomBot
291
293
  zoominfobot: ZoominfoBot
292
294
  zyborg: Zyborg
293
295
 
296
+ # AI Crawlers
297
+ # https://darkvisitors.com
298
+ amazonbot: Amazon
299
+ anthropic-ai: Anthropic-AI
300
+ applebot: Apple
301
+ bytespider: TikTok
302
+ ccbot: Common Crawl
303
+ chatgpt-user: ChatGPT
304
+ claude-web: Anthropic-AI
305
+ cohere-ai: Cohere
306
+ diffbot: Diffbot
307
+ facebookbot: Facebook
308
+ google-extended: Google
309
+ googleother: Google
310
+ gptbot: ChatGPT
311
+ omgili: Webz.io
312
+ perplexitybot: Perplexity
313
+ webz.io: Webz.io
314
+ youbot: You.com
315
+
294
316
  # Generic lib user agents go here.
317
+ httpie: HTTPie
295
318
  eventmachine httpclient: Ruby http library
296
319
  go 1.1 package http: Go 1.1 package http
297
320
  htmlparser: HTMLParser
data/browser.gemspec CHANGED
@@ -16,6 +16,7 @@ Gem::Specification.new do |s|
16
16
 
17
17
  s.metadata["rubygems_mfa_required"] = "true"
18
18
  s.metadata["changelog_uri"] = "https://github.com/fnando/browser/blob/main/CHANGELOG.md"
19
+ s.metadata["funding_uri"] = "https://github.com/sponsors/fnando"
19
20
 
20
21
  s.files = `git ls-files`.split("\n")
21
22
  s.executables = `git ls-files -- exe/*`
data/lib/browser/base.rb CHANGED
@@ -268,6 +268,11 @@ module Browser
268
268
  instance_of?(Electron) && detect_version?(full_version, expected_version)
269
269
  end
270
270
 
271
+ # Detect if the browser is Epiphany.
272
+ def epiphany?(expected_version = nil)
273
+ instance_of?(Epiphany) && detect_version?(full_version, expected_version)
274
+ end
275
+
271
276
  private def validate_size(subject, input)
272
277
  actual_bytesize = input.bytesize
273
278
  size_limit = Browser.public_send(:"#{subject}_size_limit")
@@ -37,6 +37,7 @@ require_relative "miui_browser"
37
37
  require_relative "maxthon"
38
38
  require_relative "sougou_browser"
39
39
  require_relative "google_search_app"
40
+ require_relative "epiphany"
40
41
 
41
42
  require_relative "bot"
42
43
  require_relative "bot/empty_user_agent_matcher"
@@ -77,23 +78,26 @@ module Browser
77
78
  InternetExplorer,
78
79
  Firefox,
79
80
  Otter,
80
- Facebook, # must be placed before Chrome and Safari
81
- Instagram, # must be placed before Chrome and Safari
82
- Snapchat, # must be placed before Chrome and Safari
83
- Weibo, # must be placed before Chrome and Safari
84
- MicroMessenger, # must be placed before QQ
85
- QQ, # must be placed before Chrome and Safari
86
- Alipay, # must be placed before Chrome and Safari
87
- Electron, # must be placed before Chrome and Safari
88
- Yandex, # must be placed before Chrome and Safari
89
- Sputnik, # must be placed before Chrome and Safari
90
- DuckDuckGo, # must be placed before Chrome and Safari
91
- SamsungBrowser, # must be placed before Chrome and Safari
92
- HuaweiBrowser, # must be placed before Chrome and Safari
93
- MiuiBrowser, # must be placed before Chrome and Safari
94
- Maxthon, # must be placed before Chrome and Safari
95
- SougouBrowser, # must be placed before Chrome and Safari
96
- GoogleSearchApp, # must be placed before Chrome and Safari
81
+ Epiphany,
82
+ Facebook,
83
+ Instagram,
84
+ Snapchat,
85
+ Weibo,
86
+ MicroMessenger, # must be placed before QQ
87
+ QQ,
88
+ Alipay,
89
+ Electron,
90
+ Yandex,
91
+ Sputnik,
92
+ DuckDuckGo,
93
+ SamsungBrowser,
94
+ HuaweiBrowser,
95
+ MiuiBrowser,
96
+ Maxthon,
97
+ SougouBrowser,
98
+ GoogleSearchApp,
99
+
100
+ # Must be last
97
101
  Chrome,
98
102
  Safari,
99
103
  Unknown
@@ -202,7 +202,7 @@ module Browser
202
202
  # rubocop:disable Layout/LineLength
203
203
  private def detect_mobile?
204
204
  psp? ||
205
- /zunewp7/i.match?(ua) ||
205
+ /zunewp7|crios/i.match?(ua) ||
206
206
  %r{(android|bb\d+|meego).+mobile|avantgo|bada/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino}i.match(ua) ||
207
207
  %r{1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-}i.match?(ua[0..3])
208
208
  end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Browser
4
+ class Epiphany < Base
5
+ def id
6
+ :epiphany
7
+ end
8
+
9
+ def name
10
+ "Epiphany"
11
+ end
12
+
13
+ def full_version
14
+ ua[%r{Epiphany/([\d.]+)}, 1] || "0.0"
15
+ end
16
+
17
+ def match?
18
+ ua.include?("Epiphany")
19
+ end
20
+ end
21
+ end
@@ -3,7 +3,7 @@
3
3
  module Browser
4
4
  class Platform
5
5
  class IOS < Base
6
- MATCHER = /(iPhone|iPad|iPod)/.freeze
6
+ MATCHER = /(iPhone|iPad|iPod|CriOS)/.freeze
7
7
  VERSION_MATCHER =
8
8
  /OS (?<major>\d+)_(?<minor>\d+)_?(?<patch>\d+)?/.freeze
9
9
 
@@ -19,6 +19,7 @@ module Browser
19
19
 
20
20
  def match?
21
21
  ua.include?("Safari") &&
22
+ !platform.linux? &&
22
23
  !ua.match?(/PhantomJS|FxiOS/) &&
23
24
  !edge? &&
24
25
  !chrome? &&
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Browser
4
- VERSION = "6.0.0"
4
+ VERSION = "6.2.0"
5
5
  end
data/test/sample_app.rb CHANGED
@@ -9,7 +9,7 @@ class PagesController < ActionController::Base
9
9
  end
10
10
  end
11
11
 
12
- class PotsController < ActionController::API
12
+ class BotsController < ActionController::API
13
13
  def index
14
14
  render json: {
15
15
  isBot: browser.bot?,
@@ -42,7 +42,7 @@ class SampleApp < Rails::Application
42
42
 
43
43
  get "/home", to: "pages#home"
44
44
 
45
- get "/api/pages", to: "pots#index"
45
+ get "/api/pages", to: "bots#index"
46
46
  end
47
47
 
48
48
  config.middleware.use Browser::Middleware do
data/test/ua.yml CHANGED
@@ -30,11 +30,13 @@ BLACKBERRY7: "Mozilla/5.0 (BlackBerry; U; BlackBerry AAAA; en-US) AppleWebKit/53
30
30
  BLACKBERRY: "BlackBerry7100i/4.1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/103"
31
31
  CHROME: "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.99 Safari/533.4"
32
32
  CHROME_OS: "Mozilla/5.0 (X11; CrOS x86_64 3701.81.0) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.57 Safari/537.31."
33
+ CHROME_REQUEST_DESKTOP_SITE: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/130 Version/11.1.1 Safari/605.1.15"
33
34
  COREMEDIA: "Apple Mac OS X v10.6.4 CoreMedia v1.0.0.10F569"
34
35
  CUSTOM_APP: "Our App 0.0.1 (Linux; Android 4.0.3; HTC Ruby Build/IML74K; en_CA)"
35
36
  DUCKDUCKGO_BROWSER_ANDROID: Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.96 Mobile Safari/537.36 DuckDuckGo/5"
36
37
  DUCKDUCKGO_BROWSER_IOS: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 DuckDuckGo/7"
37
38
  ELECTRON: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Electron/1.4.12 Safari/537.36"
39
+ EPIPHANY: "Mozilla/5.0 (X11; Ubuntu; Linux x86_64) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Safari/605.1.15 Ubuntu/16.04 (3.18.11-0ubuntu1) Epiphany/3.18.11"
38
40
  FACEBOOK: Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60 [FBAN/FBIOS;FBAV/135.0.0.45.90;FBBV/66877072;FBDV/iPhone9,3;FBMD/iPhone;FBSN/iOS;FBSV/10.3.3;FBSS/2;FBCR/AT&T;FBID/phone;FBLC/en_US;FBOP/5;FBRV/0]
39
41
  FACEBOOK_ANDROID: "Mozilla/5.0 (Linux; Android 9; ONEPLUS A6003 Build/PKQ1.180716.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/73.0.3683.90 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/214.0.0.43.83;]"
40
42
  FACEBOOK_IOS: "Mozilla/5.0 (iPhone; CPU iPhone OS 12_1_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/16D57 [FBAN/FBIOS;FBDV/iPhone11,2;FBMD/iPhone;FBSN/iOS;FBSV/12.1.4;FBSS/3;FBCR/KPN NL;FBID/phone;FBLC/en_GB;FBOP/5]"
@@ -83,11 +85,11 @@ KINDLE: "Mozilla/5.0 (Linux; U; en-US) AppleWebKit/528.5+ (KHTML, like Gecko, Sa
83
85
  KINDLE_FIRE: "Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Kindle Fire Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"
84
86
  KINDLE_FIRE_HD: "Mozilla/5.0 (Linux; U; en-us; KFTT Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.4 Safari/535.19 Silk-Accelerated=true"
85
87
  KINDLE_FIRE_HD_MOBILE: "Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; KFTT Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.4 Mobile Safari/535.19 Silk-Accelerated=true"
86
- KINDLE_SILK_TABLET: Mozilla/5.0 (Linux; Android 4.4.3; KFTHWI Build/KTU84M) AppleWebKit/537.36 (KHTML, like Gecko) Silk/44.1.54 like Chrome/44.0.2403.63 Safari/537.36
87
88
  KINDLE_SILK_DESKTOP: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Silk/44.1.54 like Chrome/44.0.2403.63 Safari/537.36
88
89
  KINDLE_SILK_MOBILE: Mozilla/5.0 (Linux; U; Android 4.4.3; KFTHWI Build/KTU84M) AppleWebKit/537.36 (KHTML, like Gecko) Silk/44.1.54 like Chrome/44.0.2403.63 Mobile Safari/537.36
89
- KINDLE_SILK_TABLET_1ST_GEN: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.0.13.81_10003810) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true
90
90
  KINDLE_SILK_MOBILE_1ST_GEN: Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Silk/1.0.13.81_10003810) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 Silk-Accelerated=true
91
+ KINDLE_SILK_TABLET: Mozilla/5.0 (Linux; Android 4.4.3; KFTHWI Build/KTU84M) AppleWebKit/537.36 (KHTML, like Gecko) Silk/44.1.54 like Chrome/44.0.2403.63 Safari/537.36
92
+ KINDLE_SILK_TABLET_1ST_GEN: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.0.13.81_10003810) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true
91
93
  LUMIA800: "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; XBLWP7; ZuneWP7"
92
94
  MAC_OS: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.5 Safari/605.1.15"
93
95
  MAC_OSX: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9"
@@ -127,8 +129,6 @@ QQ_BROWSER_ANDROID: "Mozilla/5.0 (Linux; Android 5.1.1; SM-N9108V Build/LMY47X)
127
129
  QQ_BROWSER_IOS: "Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13E238 QQ/6.3.3.432 V1_IPH_SQ_6.3.3_1_APP_A Pixel/640 Core/UIWebView NetType/WIFI Mem/47"
128
130
  QQ_BROWSER_MAC: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36 QQBrowser/4.2.4753.400"
129
131
  QQ_BROWSER_MAC_LITE: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14 QQBrowserLite/1.0.4"
130
- SOUGOU_BROWSER: "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.81 Safari/537.36 SE 2.X MetaSr 1.0"
131
- SOUGOU_BROWSER_MOBILE: "Mozilla/5.0 (Linux; Android 7.1.2; Redmi 4X Build/N2G47H; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/68.0.3440.106 Mobile Safari/537.36 AWP/2.0 SogouMSE,SogouMobileBrowser/5.28.12"
132
132
  QUICKTIME: "QuickTime/7.6.8 (qtver=7.6.8;os=Windows NT 5.1Service Pack 3)"
133
133
  SAFARI3: "Mozilla/5.0 (Windows; U; Windows NT 6.0; en) AppleWebKit/522.15.5 (KHTML, like Gecko) Version/3.0.3 Safari/522.15.5"
134
134
  SAFARI4: "Mozilla/5.0 (Windows; U; Windows NT 6.0; fr-ch) AppleWebKit/531.9 (KHTML, like Gecko) Version/4.0.3 Safari/531.9"
@@ -143,14 +143,16 @@ SAFARI_IPHONE_WEBAPP_MODE: "Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_2 like Mac O
143
143
  SAMSUNG: "Mozilla/5.0 (Linux; U; Android 4.0.4; en-us; SAMSUNG-SGH-I497 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30"
144
144
  SAMSUNG_BROWSER: "Mozilla/5.0 (Linux; Android 10; SAMSUNG SM-N960U) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/11.1 Chrome/75.0.3770.143 Mobile Safari/537.36"
145
145
  SAMSUNG_CHROME: "Mozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG GT-I9195/I9195XXUCNEA Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36"
146
- SAMSUNG_SM-G975F: "Mozilla/5.0 (Linux; Android 10; SM-G975F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.101 Mobile Safari/537.36"
147
- SAMSUNG_SM-G960F: "Mozilla/5.0 (Linux; Android 8.0.0; SM-G960F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.127 Mobile Safari/537.36"
148
146
  SAMSUNG_SM-F700F: "Mozilla/5.0 (Linux; Android 10; SAMSUNG SM-F700F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/11.1 Chrome/75.0.3770.143 Mobile Safari/537.36"
149
147
  SAMSUNG_SM-FAKE: "Mozilla/5.0 (Linux; Android 8.0.0; SM-0000) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.127 Mobile Safari/537.36"
148
+ SAMSUNG_SM-G960F: "Mozilla/5.0 (Linux; Android 8.0.0; SM-G960F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.127 Mobile Safari/537.36"
149
+ SAMSUNG_SM-G975F: "Mozilla/5.0 (Linux; Android 10; SM-G975F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.101 Mobile Safari/537.36"
150
150
  SMART_TV: "Mozilla/5.0 (SmartHub; SMART-TV; U; Linux/SmartTV) AppleWebKit/531.2+ (KHTML, like Gecko) WebBrowser/1.0 SmartTV Safari/531.2+"
151
151
  SNAPCHAT: Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Snapchat/10.69.5.72 (iPhone10,3; iOS 13.2.2; gzip)
152
152
  SNAPCHAT_EMPTY_STRING_VERSION: "Mozilla/5.0 (Linux; Android 9; SM-N960U Build/PPR1.180610.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.96 Mobile Safari/537.36Snapchat10.70.0.0 (SM-N960U; Android 9#N960USQS3CSJ2#28; gzip)"
153
153
  SNAPCHAT_SPACE_VERSION: "Mozilla/5.0 (Linux; Android 9; SM-N960U Build/PPR1.180610.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.96 Mobile Safari/537.36Snapchat 10.70.0.0 (SM-N960U; Android 9#N960USQS3CSJ2#28; gzip)"
154
+ SOUGOU_BROWSER: "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.81 Safari/537.36 SE 2.X MetaSr 1.0"
155
+ SOUGOU_BROWSER_MOBILE: "Mozilla/5.0 (Linux; Android 7.1.2; Redmi 4X Build/N2G47H; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/68.0.3440.106 Mobile Safari/537.36 AWP/2.0 SogouMSE,SogouMobileBrowser/5.28.12"
154
156
  SPUTNIK: "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 SputnikBrowser/4.1.2801.0 Safari/537.36"
155
157
  SURFACE: "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; ARM; Trident/6.0; Touch)"
156
158
  SYMBIAN: "Nokia5250/10.0.011 (SymbianOS/9.4; U; Series60/5.0 Mozilla/5.0; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/525 (KHTML, like Gecko) Safari/525 3gpp-gba"
data/test/ua_bots.yml CHANGED
@@ -1,9 +1,13 @@
1
1
  ---
2
2
  ADLXBOT: "Mozilla/5.0 (compatible; adidxbot/2.0; +http://www.bing.com/bingbot.htm)"
3
3
  ADS_TXT_CRAWLER: "AdsTxtCrawler/1.0"
4
+ AMAZONBOT: Amazonbot
4
5
  ANDERSPINK: "Mozilla/5.0 (compatible; AndersPinkBot/1.0; +http://anderspink.com/bot.html)"
6
+ ANTHROPIC_AI: anthropic-ai
5
7
  APIS_GOOGLE: "APIs-Google; (+https://developers.google.com/webmasters/APIs-Google.html)"
6
8
  APPLE_BOT: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/600.2.5 (KHTML, like Gecko) Version/8.0.2 Safari/600.2.5 (Applebot/0.1)"
9
+ APPLEBOT: Applebot
10
+ APPSIGNALBOT: "AppSignalBot/1.0 (+https://appsignal.com)"
7
11
  ARCHIVEBOT: "ArchiveTeam ArchiveBot/20190617.01 (wpull 2.0.3) and not Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36"
8
12
  ASK: "Mozilla/2.0 (compatible; Ask Jeeves/Teoma; +http://sp.ask.com/docs/about/tech_crawling.html)"
9
13
  AWS_ELB: ELB-HealthChecker/1.0
@@ -13,25 +17,35 @@ BINGBOT: "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm
13
17
  BINGPREVIEW: "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534+ (KHTML, like Gecko) BingPreview/1.0b"
14
18
  BUBING: "BUbiNG (+http://law.di.unimi.it/BUbiNG.html)"
15
19
  BUZZBOT: "Buzzbot/1.0 (Buzzbot; http://www.buzzstream.com; buzzbot@buzzstream.com)"
20
+ BYTESPIDER: Bytespider
21
+ CCBOT: CCBot
22
+ CHATGPT_USER: ChatGPT-User
23
+ CHECKLY: "Checkly/1.0 (https://www.checklyhq.com)"
16
24
  CHROME_LIGHTHOUSE: "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3694.0 Mobile Safari/537.36 Chrome-Lighthouse"
17
25
  CIPACRAWLER: "CipaCrawler/3.0 (info@domaincrawler.com; http://www.domaincrawler.com/www.example.com)"
26
+ CLAUDE_WEB: Claude-Web
27
+ CLAUDEBOT: ClaudeBot
18
28
  CLOUDFLARE: "Mozilla/5.0 (compatible; CloudFlare-AlwaysOnline/1.0; +http://www.cloudflare.com/always-online) AppleWebKit/534.34"
29
+ COHERE-AI: cohere-ai
19
30
  COMMONCRAWL: "CCBot/2.0 (http://commoncrawl.org/faq/)"
20
31
  COMODO_SSL_CHECKER: "COMODO SSL Checker"
21
32
  COPYPANTS: "Mozilla/5.0 (compatible; BotPants/1.0; Linux; +info@copypants.com) KHTML/3.5.5 (like Gecko)"
22
33
  DATAFEEDWATCH: "Datafeedwatch/2.1.x"
23
34
  DATANYZE: "Mozilla/5.0 (X11; Datanyze; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
24
35
  DAUMOA: "Mozilla/5.0 (compatible; MSIE or Firefox mutant; not on Windows server;) Daumoa 4.0"
36
+ DIFFBOT: Diffbot
25
37
  DOMAINAREANIMATOR: "Domain Re-Animator Bot (http://domainreanimator.com) - support@domainreanimator.com"
26
38
  DOT_BOT: "Mozilla/5.0 (compatible; DotBot/1.1; http://www.opensiteexplorer.org/dotbot, help@moz.com)"
27
39
  DUCKDUCKGO: "DuckDuckBot/1.0; (+http://duckduckgo.com/duckduckbot.html)"
28
40
  EZPUBLISH: "eZ Publish Link Validator"
29
41
  FACEBOOK_BOT: "facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)"
42
+ FACEBOOKBOT: FacebookBot
30
43
  FYREBOT: "Fyrebot/1.0"
31
44
  GARLIK: "GarlikCrawler/1.2 (http://garlik.com/, crawler@garlik.com)"
32
45
  GERMCRAWLER: "GermCrawler"
33
46
  GO_1.1_PACKAGE_HTTP: "Go 1.1 package http"
34
47
  GO_HTTP_CLIENT: "Go-http-client"
48
+ GOOGLE-EXTENDED: Google-Extended
35
49
  GOOGLE_BOT: "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
36
50
  GOOGLE_IMAGE_PROXY: "Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)"
37
51
  GOOGLE_PAGE_SPEED_INSIGHTS: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.4 (KHTML, like Gecko; Google Page Speed Insights) Chrome/22.0.1229 Safari/537.4"
@@ -40,6 +54,7 @@ GOOGLE_SITE_VERIFICATION: Mozilla/5.0 (compatible; Google-Site-Verification/1.0)
40
54
  GOOGLE_STACKDRIVER_UPTIME_CHECKS: "GoogleStackdriverMonitoring-UptimeChecks"
41
55
  GOOGLE_STRUCTURED_DATA_TESTING_TOOL2: "Mozilla/5.0 (compatible; Google-Structured-Data-Testing-Tool +http://developers.google.com/structured-data/testing-tool/)"
42
56
  GOOGLE_STRUCTURED_DATA_TESTING_TOOL: "Mozilla/5.0 (compatible; X11; Linux x86_64; Google-StructuredDataTestingTool; +http://www.google.com/webmasters/tools/richsnippets)"
57
+ GPTBOT: GPTBot
43
58
  GRAPESHOT: "Mozilla/5.0 (compatible; GrapeshotCrawler/2.0; +http://www.grapeshot.co.uk/crawler.php)"
44
59
  HTTRACK: "Mozilla/4.5 (compatible; HTTrack 3.0x; Windows 98)"
45
60
  IMPLISENSEBOT: "ImplisenseBot 1.0"
@@ -61,7 +76,9 @@ MSNBOT_MEDIA: "msnbot-media/1.1 (+http://search.msn.com/msnbot.htm)"
61
76
  NETCRAFT2: Netcraft SSL Server Survey - contact info@netcraft.com
62
77
  NETCRAFT: Mozilla/5.0 (compatible; NetcraftSurveyAgent/1.0; +info@netcraft.com)
63
78
  NEWRELICPINGER: NewRelicPinger/1.0 (12345)
79
+ OMGILI: omgili
64
80
  PAESSLER: Mozilla/5.0 (compatible; PRTG Network Monitor (www.paessler.com); Windows)
81
+ PERPLEXITYBOT: PerplexityBot
65
82
  PR-CY_RU: Mozilla/5.0 (compatible; PR-CY.RU; + https://a.pr-cy.ru)
66
83
  PRIVACYAWAREBOT: "Mozilla/5.0 (compatible; PrivacyAwareBot/1.1; +http://www.privacyaware.org)"
67
84
  PROXIMIC: "Mozilla/5.0 (compatible; proximic; +http://www.proximic.com/info/spider.php)"
@@ -98,6 +115,7 @@ YAHOO_SLURP: "Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/
98
115
  YANDEX_DIRECT: "Mozilla/5.0 (compatible; YandexDirect/3.0; +http://yandex.com/bots)"
99
116
  YANDEX_METRIKA: "Mozilla/5.0 (compatible; YandexMetrika/3.0; +http://yandex.com/bots)"
100
117
  YANGA: "Yanga WorldSearch Bot v1.1/beta (http://www.yanga.co.uk/)"
118
+ YOUBOT: YouBot
101
119
  ZABBIX: "Zabbix"
102
120
  ZOOMBOT: "ZoomBot (Linkbot 1.0 http://suite.seozoom.it/bot.html)"
103
121
  ZOOMINFOBOT: "ZoominfoBot (zoominfobot at zoominfo dot com)"
@@ -26,6 +26,12 @@ class ChromeTest < Minitest::Test
26
26
  assert_equal "19", browser.version
27
27
  end
28
28
 
29
+ test "detects chrome in desktop mode" do
30
+ browser = Browser.new(Browser["CHROME_REQUEST_DESKTOP_SITE"])
31
+ assert browser.chromium_based?
32
+ assert browser.chrome?
33
+ end
34
+
29
35
  test "detects samsung chrome" do
30
36
  browser = Browser.new(Browser["SAMSUNG_CHROME"])
31
37
 
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "test_helper"
4
+
5
+ class EpiphanyBrowserTest < Minitest::Test
6
+ test "detects epiphany browser" do
7
+ browser = Browser.new(Browser["EPIPHANY"])
8
+
9
+ assert browser.epiphany?
10
+ refute browser.safari?
11
+ assert_equal "Epiphany", browser.name
12
+ assert_equal :epiphany, browser.id
13
+ assert_equal "3.18.11", browser.full_version
14
+ assert_equal "3", browser.version
15
+ end
16
+
17
+ test "detects version by range" do
18
+ browser = Browser.new(Browser["EPIPHANY"])
19
+ assert browser.epiphany?(%w[=3.18.11])
20
+ end
21
+ end
@@ -25,6 +25,12 @@ class IosTest < Minitest::Test
25
25
  assert_equal "5", browser.version
26
26
  end
27
27
 
28
+ test "detects chrome in desktop mode" do
29
+ browser = Browser.new(Browser["CHROME_REQUEST_DESKTOP_SITE"])
30
+ assert browser.platform.ios?
31
+ assert browser.device.mobile?
32
+ end
33
+
28
34
  test "detects safari in webapp mode" do
29
35
  browser = Browser.new(Browser["SAFARI_IPAD_WEBAPP_MODE"])
30
36
  refute browser.safari?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: browser
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 6.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-30 00:00:00.000000000 Z
11
+ date: 2024-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -214,6 +214,7 @@ files:
214
214
  - lib/browser/duck_duck_go.rb
215
215
  - lib/browser/edge.rb
216
216
  - lib/browser/electron.rb
217
+ - lib/browser/epiphany.rb
217
218
  - lib/browser/facebook.rb
218
219
  - lib/browser/firefox.rb
219
220
  - lib/browser/google_search_app.rb
@@ -296,6 +297,7 @@ files:
296
297
  - test/unit/duck_duck_go_test.rb
297
298
  - test/unit/edge_test.rb
298
299
  - test/unit/electron_test.rb
300
+ - test/unit/epiphany_test.rb
299
301
  - test/unit/facebook_test.rb
300
302
  - test/unit/firefox_test.rb
301
303
  - test/unit/generic_test.rb
@@ -333,6 +335,7 @@ licenses:
333
335
  metadata:
334
336
  rubygems_mfa_required: 'true'
335
337
  changelog_uri: https://github.com/fnando/browser/blob/main/CHANGELOG.md
338
+ funding_uri: https://github.com/sponsors/fnando
336
339
  post_install_message:
337
340
  rdoc_options: []
338
341
  require_paths:
@@ -348,7 +351,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
348
351
  - !ruby/object:Gem::Version
349
352
  version: '0'
350
353
  requirements: []
351
- rubygems_version: 3.5.9
354
+ rubygems_version: 3.5.22
352
355
  signing_key:
353
356
  specification_version: 4
354
357
  summary: Do some browser detection with Ruby.