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

Supports SamsungBrowser #25

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
8 changes: 8 additions & 0 deletions lib/woothee/browser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ def self.challenge_safari_chrome(ua, result)

version = Woothee::VALUE_UNKNOWN

# SamsungBrowser
if ua =~ /(?:SamsungBrowser)\/([.0-9]+)/o
version = $1
update_map(result, Woothee::DataSet.get('SamsungBrowser'))
update_version(result, version)
return true
end

# Edge
if ua =~ /(?:Edge|Edg|EdgiOS|EdgA)\/([.0-9]+)/o
version = $1
Expand Down
10 changes: 8 additions & 2 deletions lib/woothee/crawler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ module Woothee::Crawler
extend Woothee::Util

def self.challenge_google(ua, result)
return false if ua.index('Google').nil?

if ua.index('compatible; Googlebot')
if ua.index('compatible; Googlebot-Mobile')
update_map(result, Woothee::DataSet.get('GoogleBotMobile'))
Expand All @@ -22,6 +20,14 @@ def self.challenge_google(ua, result)
update_map(result, Woothee::DataSet.get('GoogleBot'))
return true
end
if ua.index('compatible; AdsBot-Google-Mobile') || ua.index('Applebot/')
update_map(result, Woothee::DataSet.get('AdsBotGoogleMobile'))
return true
end
if ua.index('AdsBot-Google')
update_map(result, Woothee::DataSet.get('AdsBotGoogle'))
return true
end
if ua.index('Mediapartners-Google')
if ua.index('compatible; Mediapartners-Google') or ua == 'Mediapartners-Google'
update_map(result, Woothee::DataSet.get('GoogleMediaPartners'))
Expand Down
11 changes: 10 additions & 1 deletion lib/woothee/dataset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module Woothee

module Woothee::DataSet
DATASET = {}
# GENERATED from dataset.yaml at Tue Mar 17 20:33:08 JST 2020 by tagomoris
# GENERATED from dataset.yaml at Fri Sep 4 16:20:50 JST 2020 by lobin
obj = {:label => 'MSIE', :name => 'Internet Explorer', :type => :browser}
obj[:vendor] = 'Microsoft'
DATASET[obj[:label]] = obj
Expand Down Expand Up @@ -69,6 +69,9 @@ module Woothee::DataSet
obj = {:label => 'YaBrowser', :name => 'Yandex Browser', :type => :browser}
obj[:vendor] = 'Yandex'
DATASET[obj[:label]] = obj
obj = {:label => 'SamsungBrowser', :name => 'SamsungBrowser', :type => :browser}
obj[:vendor] = 'Samsung'
DATASET[obj[:label]] = obj
obj = {:label => 'Win', :name => 'Windows UNKNOWN Ver', :type => :os}
obj[:category] = :pc
DATASET[obj[:label]] = obj
Expand Down Expand Up @@ -348,6 +351,12 @@ module Woothee::DataSet
obj = {:label => 'VariousCrawler', :name => 'misc crawler', :type => :full}
obj[:category] = :crawler
DATASET[obj[:label]] = obj
obj = {:label => 'AdsBotGoogleMobile', :name => 'AdsBot-Google-Mobile', :type => :full}
obj[:category] = :crawler
DATASET[obj[:label]] = obj
obj = {:label => 'AdsBotGoogle', :name => 'AdsBot-Google', :type => :full}
obj[:category] = :crawler
DATASET[obj[:label]] = obj

DATASET.freeze

Expand Down
2 changes: 1 addition & 1 deletion woothee