Last active
December 22, 2015 05:08
-
-
Save clicktx/6421672 to your computer and use it in GitHub Desktop.
Woothee - multi-language user-agent strings parsers (perl implementation)
https://metacpan.org/release/TAGOMORIS/Woothee-0.3.3 のテスト。tabletは判別されない、か。 UserAgent一覧は以下から抜粋
http://www.openspc2.org/userAgent/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use 5.010; | |
use strict; | |
use warnings; | |
use Data::Dumper; | |
use Woothee; | |
say Dumper (Woothee->parse("Mozilla/5.0 (Linux; U; Android 4.0.3; ja-jp; Sony Tablet S Build/TISU0R0110) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30")); | |
say Dumper (Woothee->parse("Mozilla/5.0 (Linux; U; Android 4.1.1; ja-jp; Galaxy Nexus Build/JRO03H) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30")); | |
say Dumper (Woothee->parse("Mozilla/5.0 (Linux; Android 4.1.1; Nexus 7 Build/JRO03S) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19")); | |
__END__ | |
# 実行結果 | |
$VAR1 = { | |
'version' => '4.0', | |
'name' => 'Safari', | |
'category' => 'smartphone', | |
'vendor' => 'Apple', | |
'os' => 'Android' | |
}; | |
$VAR1 = { | |
'version' => '4.0', | |
'name' => 'Safari', | |
'category' => 'smartphone', | |
'vendor' => 'Apple', | |
'os' => 'Android' | |
}; | |
$VAR1 = { | |
'version' => '18.0.1025.166', | |
'name' => 'Chrome', | |
'category' => 'smartphone', | |
'vendor' => 'Google', | |
'os' => 'Android' | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment