browser 2.5.3 → 2.6.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: 293548a9eea57000babf98f31dd4fbb5652886d9af4d0fea9be163e58d041c10
4
- data.tar.gz: 0e5c8ae27a8b45b751c1b8c2a40aa0daf37a6a7c6547621a2dee348a6f207216
3
+ metadata.gz: 6256505798952cc5d227f5740875e7d517518f0446a04da637b82be4e3e475fb
4
+ data.tar.gz: f145f9ce9a4058c0b2830b2e298bd4ff252c293893aa79b8d3758d345b8489f7
5
5
  SHA512:
6
- metadata.gz: 708cd426295863ce846e4b7934ac6fa7d2716c3a0e2bf136dab0f4f79dde7648a3a41ad2dca3565bde09abe0658b08e2b5dce184d371a449f9ecbceb7a152629
7
- data.tar.gz: 2d6c9699c81fe9bd5be50089682524c12076b3962bcc2936d9592fd93d5c4cb467dcd8ece8c78cd9252bc3395884b8b3bace3daedfdfa8742a74c51b2b280a92
6
+ metadata.gz: 490cf0cdb255bc7c5a1db87454823b22fe5d3bd8874bf6c4d49061f44b481c2ee8dcea1c4135b6f21030ce255ca93ae347240c61decbedd69b5506a8c8a3911a
7
+ data.tar.gz: 2c34b6d70503c65e616cfa0b2f7912e345aa9563618c3f6384bdecc32e0395f00fb0f2931fb1829d783dde369c9fed24c3469cd6f6307589e6cc9b5dbc740bcf
@@ -71,12 +71,18 @@ SingleLineBlockParams:
71
71
  VariableInterpolation:
72
72
  Enabled: false
73
73
 
74
- Style/TrailingCommaInLiteral:
74
+ Style/TrailingCommaInArrayLiteral:
75
+ Enabled: false
76
+
77
+ Style/TrailingCommaInHashLiteral:
75
78
  Enabled: false
76
79
 
77
80
  WhileUntilModifier:
78
81
  Enabled: false
79
82
 
83
+ Naming/UncommunicativeMethodParamName:
84
+ Enabled: false
85
+
80
86
  PredicateName:
81
87
  NamePrefixBlacklist:
82
88
  - is_
@@ -93,13 +99,11 @@ DotPosition:
93
99
  SpaceBeforeBlockBraces:
94
100
  EnforcedStyle: space
95
101
 
96
- SpaceInsideBlockBraces:
97
- EnforcedStyle: no_space
98
-
99
102
  DoubleNegation:
100
103
  Enabled: false
101
104
 
102
105
  SpaceInsideBlockBraces:
106
+ EnforcedStyle: space
103
107
  SpaceBeforeBlockParameters: false
104
108
 
105
109
  SpaceInsideHashLiteralBraces:
@@ -107,20 +111,26 @@ SpaceInsideHashLiteralBraces:
107
111
 
108
112
  PercentLiteralDelimiters:
109
113
  PreferredDelimiters:
110
- '%': '[]'
111
- '%i': '[]'
112
- '%q': '[]'
113
- '%Q': '[]'
114
- '%r': '[]'
115
- '%s': '[]'
116
- '%w': '[]'
117
- '%W': '[]'
118
- '%x': '[]'
114
+ "%": "[]"
115
+ "%i": "[]"
116
+ "%q": "[]"
117
+ "%Q": "[]"
118
+ "%r": "[]"
119
+ "%s": "[]"
120
+ "%w": "[]"
121
+ "%W": "[]"
122
+ "%x": "[]"
119
123
 
120
124
  Style/CollectionMethods:
121
125
  PreferredMethods:
122
- collect: 'map'
123
- collect!: 'map!'
124
- inject: 'reduce'
125
- detect: 'find'
126
- find_all: 'select'
126
+ collect: "map"
127
+ collect!: "map!"
128
+ inject: "reduce"
129
+ detect: "find"
130
+ find_all: "select"
131
+
132
+ Style/SafeNavigation:
133
+ Enabled: false
134
+
135
+ Layout/RescueEnsureAlignment:
136
+ Enabled: false
@@ -2,11 +2,11 @@ language: ruby
2
2
  sudo: false
3
3
  cache: bundler
4
4
  rvm:
5
- - '2.4.2'
6
- - '2.3.5'
5
+ - "2.6.0"
6
+ - "2.5.0"
7
+ - "2.4.0"
7
8
  gemfile:
8
9
  - Gemfile
9
- - gemfiles/rails4.gemfile
10
10
  - gemfiles/rails5.gemfile
11
11
  script: bundle exec rake
12
12
  notifications:
@@ -1,5 +1,38 @@
1
1
  # Changelog
2
2
 
3
+ ## UNRELEASED
4
+
5
+ - Add GarlikCrawler, ImplisenseBot and WikiDo bots.
6
+ - Add Mastodon URL expander bot.
7
+ - Add eZ Publish Link Validator, GermCrawler, Pu_iN Crawler, ZoomBot, and ZoominfoBot bots.
8
+ - Add Datanyze bot.
9
+ - Add support for Instagram in-app browser.
10
+ - Add Updown.io monitor bot.
11
+ - Add Snapshat detection.
12
+ - Add Instagram detection.
13
+ - Add Nintendo Switch detection.
14
+ - Add WooRank bot.
15
+ - Add Trendsmap bot.
16
+ - Add Go 1.1 package http bot.
17
+ - Add MauiBot.
18
+ - Add SiteCheck-sitecrawl bot.
19
+ - Add PR-CY.RU bot.
20
+ - Add AdsTxtCrawler bot.
21
+ - Add HTTrack bot.
22
+ - Add Google Shopping bot.
23
+ - Add DataFeedWatch bot.
24
+ - Add Zabbix bot.
25
+ - Add TangibleeBot.
26
+ - Add Jooble bot.
27
+ - Add Fyre bot.
28
+ - Drop Rails 4 official support.
29
+ - Fix accept-language sorting (If HTTP-header has value `en,fr`—without qualities—the first language should be `en` instead of `fr`).
30
+ - Ignore malformed strings when comparing versions.
31
+ - Fix Facebook detection on newer apps.
32
+ - Change precedence for bot detection when common libs are used.
33
+ - Add Yandex's search browser to the exception list.
34
+
35
+
3
36
  ## v2.5.3
4
37
 
5
38
  - Add Google Site Verification to the bot list.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Browser
2
2
 
3
- [![Travis-CI](https://travis-ci.org/fnando/browser.png)](https://travis-ci.org/fnando/browser)
3
+ [![Travis-CI](https://travis-ci.org/fnando/browser.svg)](https://travis-ci.org/fnando/browser)
4
4
  [![Code Climate](https://codeclimate.com/github/fnando/browser/badges/gpa.svg)](https://codeclimate.com/github/fnando/browser)
5
5
  [![Test Coverage](https://codeclimate.com/github/fnando/browser/badges/coverage.svg)](https://codeclimate.com/github/fnando/browser/coverage)
6
6
  [![Gem](https://img.shields.io/gem/v/browser.svg)](https://rubygems.org/gems/browser)
@@ -81,6 +81,7 @@ browser.device.tv?
81
81
  browser.device.vita?
82
82
  browser.device.wii?
83
83
  browser.device.wiiu?
84
+ browser.device.switch?
84
85
  browser.device.xbox?
85
86
  browser.device.xbox_360?
86
87
  browser.device.xbox_one?
@@ -244,7 +245,7 @@ This behavior changed in `v1.0.0`; previously there wasn't a way of getting the
244
245
 
245
246
  ### Safari
246
247
 
247
- iOS webviews and web apps aren't detect as Safari anymore, so be aware of that if that's your case. You can use a combination of platform and webkit detection to do whatever you want.
248
+ iOS webviews and web apps aren't detected as Safari anymore, so be aware of that if that's your case. You can use a combination of platform and webkit detection to do whatever you want.
248
249
 
249
250
  ```ruby
250
251
  # iPad's Safari running as web app mode.
@@ -1,3 +1,4 @@
1
1
  - ruby build
2
2
  - pinterest/android
3
3
  - pinterest/ios
4
+ - yandexsearchbrowser
data/bots.yml CHANGED
@@ -5,6 +5,7 @@ addthis: "AddThis"
5
5
  adldxbot: "Microsoft Bing Ads"
6
6
  admantx: "ADmantX Platform Semantic Analyzer"
7
7
  adsbot-google: "Google Adwords"
8
+ adstxtcrawler: "AdsTxtCrawler"
8
9
  advbot: "AdvBot"
9
10
  ahrefsbot: "Ahrefs backlinks research tool"
10
11
  alexa: "Alexa Crawler"
@@ -41,14 +42,16 @@ cloudflare: "CloudFlare-AlwaysOnline"
41
42
  cmradar/0.1: "CMRadar/0.1"
42
43
  coldfusion: "ColdFusion http library"
43
44
  commoncrawl: "CCBot"
44
- comodo ssl checker: 'COMODO SSL Checker'
45
+ comodo ssl checker: "COMODO SSL Checker"
45
46
  comodo-webinspector-crawler: "Comodo"
46
47
  copypants: "BotPants"
47
48
  crowsnest: "Crowsnest"
48
49
  curabot: "cura.yt"
49
50
  curl: "curl unix CLI http client"
50
51
  dap/nethttp: "DAP/NetHTTP"
52
+ datafeedwatch: "DataFeedWatch"
51
53
  datagnionbot: "datagnion.com/bot.html"
54
+ datanyze: "Datanyze"
52
55
  daumoa: "Korean portal and search engine indexing bot"
53
56
  developers.google.com/+/web/snippet/: "Google Plus"
54
57
  diffbot: "Diffbot"
@@ -61,11 +64,11 @@ duckduck: "Duck Duck Go"
61
64
  elb-healthchecker: "AWS ELB HealthChecker"
62
65
  embedly: "Embedly"
63
66
  eoaagent: "EOAAgent"
64
- eventmachine httpclient: "Ruby http library"
65
67
  everyonesocialbot: "EveryoneSocial"
66
68
  evrinid: "Evri bot"
67
69
  exabot: "Exalead's bot"
68
70
  exaleadcloudview: "ExaleadCloudView"
71
+ ez publish: "eZ Publish Link Validator"
69
72
  facebookexternalhit: "Facebook Bot"
70
73
  facebot: "Facebook Bot"
71
74
  feedburner: "RSS bot"
@@ -73,7 +76,10 @@ feedfetcher-google: "Google Feedfetcher"
73
76
  findxbot: "Findxbot"
74
77
  flipboardproxy: "FlipboardProxy"
75
78
  friendfeedbot: "FriendFeed"
79
+ fyrebot: "Fyrebot"
80
+ garlik: "GarlikCrawler"
76
81
  genieo: "Genieo Web filter bot"
82
+ germcrawler: "GermCrawler"
77
83
  getprismatic.com: "getprismatic.com"
78
84
  gigabot: "Gigabot spider"
79
85
  gimme60bot: "Gimme60 (gimme60.com)"
@@ -84,30 +90,29 @@ google Web Preview: "Google Instant Previews crawler"
84
90
  google-site-verification: Google-Site-Verification
85
91
  google-structured-data-testing-tool: "Google-StructuredDataTestingTool"
86
92
  google-structureddatatestingtool: "Google-StructuredDataTestingTool"
93
+ google-xrawler: "Google Shopping"
87
94
  googlebot: "Google Bot"
88
95
  googlestackdrivermonitoring-uptimechecks: "GoogleStackdriverMonitoring-UptimeChecks"
89
96
  grapeshotcrawler: "GrapeshotCrawler"
90
97
  gravitybot: "Gravity Bot"
91
98
  hatena::bookmark: "Hatena::Bookmark"
92
99
  heritrix: "heritrix"
93
- htmlparser: "HTMLParser"
94
- http_request2: "HTTP_Request2"
95
- httpclient: "HTTPClient"
96
100
  https://developers.google.com/+/web/snippet: "Google+ Snippet Fetcher"
101
+ httrack: "HTTrack"
97
102
  hubspot: "HubSpot"
98
103
  ia_archiver: "Internet Archive (WayBackMachine)"
99
104
  icoreservice: "iCoreService"
100
105
  idmarch: "idmarch.org/bot.html"
106
+ implisensebot: "ImplisenseBot"
101
107
  inagist: "URL resolver"
102
108
  insieve: "Insieve Bot"
103
109
  insitesbot: "Insitesbot"
104
110
  instapaper: "Instapaper"
105
111
  istellabot: "IstellaBot"
106
112
  jack: "jack"
107
- jakarta commons: "Jakarta Commons HttpClient"
108
- java: "Generic Java http library"
109
113
  jetslide: "Jetslide"
110
114
  jobseeker: "jobseeker.com.au/bot.html"
115
+ jooble: "Jooble"
111
116
  js-kit: "URL resolver"
112
117
  kemvibot: "Kemvi"
113
118
  kimengi: "Kimengi Bot"
@@ -116,7 +121,6 @@ kojitsubot: "Kojitsubot"
116
121
  komodiabot: "KomodiaBot"
117
122
  kraken: "kraken"
118
123
  laconica: "Laconica"
119
- libwww-perl: "Perl client-server library"
120
124
  lijit crawler: "Lijit"
121
125
  linkdexbot: "Linkdex Bot"
122
126
  linkedinbot: "LinkedIn"
@@ -128,10 +132,11 @@ loadtimebot: "Load Time Bot"
128
132
  longurl: "URL expander service"
129
133
  ltx71: "ltx71.com"
130
134
  lumibot: "Lumibot"
131
- lwp-trivial: "Another Perl library"
132
135
  magpie-crawler: "magpie-crawler"
133
136
  mail.ru_bot: "Mail.ru Bot"
134
137
  mappydata: "Mappy"
138
+ mastodon: "Mastodon URL expander"
139
+ mauibot: "MauiBot"
135
140
  meanpathbot: "meanpath"
136
141
  mediapartners-google: "Google Adsense bot"
137
142
  megaindex.ru: "MegaIndex"
@@ -169,15 +174,18 @@ phantomjs: "PhantomJS"
169
174
  pingdom: "Pingdom monitoring"
170
175
  pinterest: "Pinterest"
171
176
  plukkie: "botje.com/plukkie.htm"
177
+ pr-cy.ru: "PR-CY.RU"
172
178
  privacyawarebot: "PrivacyAwareBot"
173
179
  proximic: "Proximic Spider"
174
180
  psbot-page: "Picsearch"
181
+ pu_in: "Pu_iN Crawler"
175
182
  publiclibraryarchive.org: "publiclibraryarchive.org"
176
183
  pycurl: "Python http library"
177
184
  python-httplib2: "Python-httplib2"
178
185
  python-requests: "Python http library"
179
186
  python-urllib: "Python http library"
180
187
  queryseeker: "QuerySeekerSpider"
188
+ quick-crawler: "Quick-Crawler"
181
189
  quicklook: "QuickLook"
182
190
  re-animator: "Domain Re-Animator Bot"
183
191
  readability: "Readability"
@@ -187,7 +195,6 @@ relateiq: "RelateIQ"
187
195
  riddler: "Riddler Bot"
188
196
  rogerbot: "SeoMoz spider"
189
197
  rssmicro: "RSS/Atom Feed Robot (rssmicro.com)"
190
- ruby: "Ruby"
191
198
  scrapy: "Scrapy"
192
199
  screaming frog seo spider: Screaming Frog SEO Spider
193
200
  searchmetricsbot: "SearchmetricsBot"
@@ -202,11 +209,13 @@ shortlinktranslate: "Link shortener"
202
209
  showyoubot: "Showyou iOS app spider"
203
210
  siege: "Joe Dog Siege"
204
211
  sistrix: "SISTRIX"
212
+ sitecheck: "SiteCheck sitecrawl"
205
213
  siteuptime: "Site monitoring services"
206
214
  slack: "Slackbot-LinkExpanding"
207
215
  slackbot: "Slack Bot"
208
216
  slurp: "Yahoo spider"
209
217
  smtbot: "SimilarTech"
218
+ snapchat: "Snapchat"
210
219
  socialrank: "SocialRankIOBot"
211
220
  sogou: "Chinese search engine"
212
221
  spbot: "OpenLinkProfiler"
@@ -217,11 +226,13 @@ squider: "Squider"
217
226
  statuscake: "StatusCake"
218
227
  stripe: "Stripe"
219
228
  swiftbot: "Swiftype Bot"
229
+ tangibleebot: "TangibleeBot"
220
230
  teeraid: "TeeRaidBot"
221
231
  test certificate info: "C http library?"
222
232
  tineye: "TinEye Bot"
223
233
  traackr: "Traackr Bot"
224
234
  trendictionbot: "Trendiction Search"
235
+ trendsmap: "Trendsmap Resolver"
225
236
  turnitinbot: "TurnitinBot"
226
237
  tweetedtimes: "The Tweeted Times"
227
238
  tweetmemebot: "TweetMeMe Crawler"
@@ -233,6 +244,7 @@ twurly: "Twurly"
233
244
  typhoeus: "Typhoeus"
234
245
  umbot: "uberMetrics"
235
246
  unwindfetch: "Gnip"
247
+ updown: "Updown.io monitor"
236
248
  uptimerobot: "Uptime Robot"
237
249
  vagabondo: "Vagabondo"
238
250
  vb project: "Visual Basic"
@@ -248,10 +260,12 @@ webscout: "Webscout"
248
260
  wesee: "WeSEE"
249
261
  wget: "wget unix CLI http client"
250
262
  whatsapp: "WhatsApp"
263
+ wikido: "WikiDo"
251
264
  wordpress: "WordPress spider"
252
265
  woriobot: "woriobot"
253
266
  wormly: "WormlyBot"
254
267
  wotbox: "Wotbox"
268
+ woorank: "WooRank"
255
269
  xenu link sleuth: "Xenu Link Sleuth"
256
270
  xing-contenttabreceiver: "Xing bot"
257
271
  xovibot: "XoviBot"
@@ -261,7 +275,22 @@ yandex: "Yandex"
261
275
  yanga: "Yanga WorldSearch Bot"
262
276
  yeti: "Naver Corp"
263
277
  yourls: "YOURLS"
278
+ zabbix: 'Zabbix'
264
279
  zelist.ro: "feed parser"
265
280
  zibb: "ZIBB spider"
266
281
  zitebot: "Zite"
282
+ zoombot: "ZoomBot"
283
+ zoominfobot: "ZoominfoBot"
267
284
  zyborg: "Zyborg"
285
+
286
+ # Generic lib user agents go here.
287
+ eventmachine httpclient: "Ruby http library"
288
+ go 1.1 package http: "Go 1.1 package http"
289
+ htmlparser: "HTMLParser"
290
+ http_request2: "HTTP_Request2"
291
+ httpclient: "HTTPClient"
292
+ jakarta commons: "Jakarta Commons HttpClient"
293
+ java: "Generic Java http library"
294
+ libwww-perl: "Perl client-server library"
295
+ lwp-trivial: "Another Perl library"
296
+ ruby: "Ruby"
@@ -27,6 +27,6 @@ Gem::Specification.new do |s|
27
27
  s.add_development_dependency "minitest-utils"
28
28
  s.add_development_dependency "pry-meta"
29
29
  s.add_development_dependency "minitest-autotest"
30
- s.add_development_dependency "codeclimate-test-reporter"
30
+ s.add_development_dependency "simplecov"
31
31
  s.add_development_dependency "rubocop"
32
32
  end
@@ -14,8 +14,7 @@ module Browser
14
14
  .map {|string| string.squeeze(" ").strip }
15
15
  .map {|part| new(part) }
16
16
  .reject {|al| al.quality.zero? }
17
- .sort_by(&:quality)
18
- .reverse
17
+ .sort_by.with_index {|al, idx| [-al.quality, idx] }
19
18
  end
20
19
 
21
20
  attr_reader :part
@@ -15,10 +15,10 @@ module Browser
15
15
 
16
16
  DEVICE_ALIASES = %w[
17
17
  blackberry_playbook? console? ipad? iphone? ipod_touch? kindle?
18
- kindle_fire? mobile? nintendo? nintendo_wii? nintendo_wiiu? playbook?
19
- playstation3? playstation4? playstation? playstation_vita? ps3? ps4? psp?
20
- psp_vita? silk? surface? tablet? tv? vita? wii? wiiu? xbox? xbox_360?
21
- xbox_one?
18
+ kindle_fire? mobile? nintendo? nintendo_switch? nintendo_wii?
19
+ nintendo_wiiu? playbook? playstation3? playstation4? playstation?
20
+ playstation_vita? ps3? ps4? psp? psp_vita? silk? surface? tablet? tv?
21
+ vita? wii? wiiu? xbox? xbox_360? xbox_one?
22
22
  ].freeze
23
23
 
24
24
  def self.included(target)
@@ -78,6 +78,12 @@ module Browser
78
78
  "0"
79
79
  end
80
80
 
81
+ # Detect if browser is Instagram.
82
+ def instagram?(expected_version = nil)
83
+ Instagram.new(ua).match? &&
84
+ detect_version?(full_version, expected_version)
85
+ end
86
+
81
87
  # Detect if browser if Facebook.
82
88
  def facebook?(expected_version = nil)
83
89
  Facebook.new(ua).match? &&
@@ -41,6 +41,7 @@ module Browser
41
41
  def name
42
42
  return unless bot?
43
43
  return "Generic Bot" if bot_with_empty_ua?
44
+
44
45
  self.class.bots.find {|key, _| downcased_ua.include?(key) }.last
45
46
  end
46
47
 
@@ -26,6 +26,7 @@ require "browser/alipay"
26
26
  require "browser/electron"
27
27
  require "browser/facebook"
28
28
  require "browser/otter"
29
+ require "browser/instagram"
29
30
 
30
31
  require "browser/bot"
31
32
  require "browser/middleware"
@@ -35,10 +36,10 @@ require "browser/device"
35
36
  require "browser/meta"
36
37
 
37
38
  module Browser
38
- EMPTY_STRING = "".freeze
39
+ EMPTY_STRING = ""
39
40
 
40
41
  def self.root
41
- @root ||= Pathname.new(File.expand_path("../../..", __FILE__))
42
+ @root ||= Pathname.new(File.expand_path("../..", __dir__))
42
43
  end
43
44
 
44
45
  # Hold the list of browser matchers.
@@ -55,6 +56,7 @@ module Browser
55
56
  Firefox,
56
57
  Otter,
57
58
  Facebook, # must be placed before Chrome and Safari
59
+ Instagram, # must be placed before Chrome and Safari
58
60
  Weibo, # must be placed before Chrome and Safari
59
61
  QQ, # must be placed before Chrome and Safari
60
62
  Alipay, # must be placed before Chrome and Safari