Add mediaplayer as a new browser.type

This commit is contained in:
Faisal Salman 2024-06-11 09:12:36 +07:00
parent b52a7ea268
commit de4978e8d9
5 changed files with 32 additions and 27 deletions

View File

@ -152,6 +152,7 @@ const BrowserType = Object.freeze({
EMAIL: 'email', EMAIL: 'email',
FETCHER: 'fetcher', FETCHER: 'fetcher',
INAPP: 'inapp', INAPP: 'inapp',
MEDIAPLAYER: 'mediaplayer',
MODULE: 'module' MODULE: 'module'
}); });

View File

@ -156,6 +156,7 @@ const BrowserType = Object.freeze({
EMAIL: 'email', EMAIL: 'email',
FETCHER: 'fetcher', FETCHER: 'fetcher',
INAPP: 'inapp', INAPP: 'inapp',
MEDIAPLAYER: 'mediaplayer',
MODULE: 'module' MODULE: 'module'
}); });
@ -228,6 +229,7 @@ const Vendor = Object.freeze({
PALM: 'Palm', PALM: 'Palm',
PANASONIC: 'Panasonic', PANASONIC: 'Panasonic',
PEBBLE: 'Pebble', PEBBLE: 'Pebble',
PICO: 'Pico',
POLYTRON: 'Polytron', POLYTRON: 'Polytron',
REALME: 'Realme', REALME: 'Realme',
RIM: 'RIM', RIM: 'RIM',
@ -325,6 +327,7 @@ const OS = Object.freeze({
PALM: 'Palm', PALM: 'Palm',
PC_BSD: 'PC-BSD', PC_BSD: 'PC-BSD',
PCLINUXOS: 'PCLinuxOS', PCLINUXOS: 'PCLinuxOS',
PICO: 'Pico',
PLAN9: 'Plan9', PLAN9: 'Plan9',
PLAYSTATION: 'PlayStation', PLAYSTATION: 'PlayStation',
QNX: 'QNX', QNX: 'QNX',

View File

@ -19,6 +19,7 @@ const CLI = 'cli';
const EMAIL = 'email'; const EMAIL = 'email';
const FETCHER = 'fetcher'; const FETCHER = 'fetcher';
const INAPP = 'inapp'; const INAPP = 'inapp';
const MEDIAPLAYER = 'mediaplayer';
const MODULE = 'module'; const MODULE = 'module';
////////////////////// //////////////////////
@ -221,13 +222,13 @@ const MediaPlayers = Object.freeze({
/(apple(?:coremedia|))\/([\w\._]+)/i, // Generic Apple CoreMedia /(apple(?:coremedia|))\/([\w\._]+)/i, // Generic Apple CoreMedia
/(coremedia) v([\w\._]+)/i /(coremedia) v([\w\._]+)/i
], [NAME, VERSION], [ ], [NAME, VERSION, [TYPE, MEDIAPLAYER]], [
/(aqualung|lyssna|bsplayer)\/([\w\.-]+)/i // Aqualung/Lyssna/BSPlayer /(aqualung|lyssna|bsplayer)\/([\w\.-]+)/i // Aqualung/Lyssna/BSPlayer
], [NAME, VERSION], [ ], [NAME, VERSION, [TYPE, MEDIAPLAYER]], [
/(ares|ossproxy)\s([\w\.-]+)/i // Ares/OSSProxy /(ares|ossproxy)\s([\w\.-]+)/i // Ares/OSSProxy
], [NAME, VERSION], [ ], [NAME, VERSION, [TYPE, MEDIAPLAYER]], [
/(audacious|audimusicstream|amarok|bass|core|dalvik|gnomemplayer|music on console|nsplayer|psp-internetradioplayer|videos)\/([\w\.-]+)/i, /(audacious|audimusicstream|amarok|bass|core|dalvik|gnomemplayer|music on console|nsplayer|psp-internetradioplayer|videos)\/([\w\.-]+)/i,
// Audacious/AudiMusicStream/Amarok/BASS/OpenCORE/Dalvik/GnomeMplayer/MoC // Audacious/AudiMusicStream/Amarok/BASS/OpenCORE/Dalvik/GnomeMplayer/MoC
@ -235,90 +236,90 @@ const MediaPlayers = Object.freeze({
/(clementine|music player daemon)\s([\w\.-]+)/i, // Clementine/MPD /(clementine|music player daemon)\s([\w\.-]+)/i, // Clementine/MPD
/(lg player|nexplayer)\s([\d\.]+)/i, /(lg player|nexplayer)\s([\d\.]+)/i,
/player\/(nexplayer|lg player)\s([\w\.-]+)/i // NexPlayer/LG Player /player\/(nexplayer|lg player)\s([\w\.-]+)/i // NexPlayer/LG Player
], [NAME, VERSION], [ ], [NAME, VERSION, [TYPE, MEDIAPLAYER]], [
/(nexplayer)\s([\w\.-]+)/i // Nexplayer /(nexplayer)\s([\w\.-]+)/i // Nexplayer
], [NAME, VERSION], [ ], [NAME, VERSION, [TYPE, MEDIAPLAYER]], [
/(flrp)\/([\w\.-]+)/i // Flip Player /(flrp)\/([\w\.-]+)/i // Flip Player
], [[NAME, 'Flip Player'], VERSION], [ ], [[NAME, 'Flip Player'], VERSION, [TYPE, MEDIAPLAYER]], [
/(fstream|nativehost|queryseekspider|ia-archiver|facebookexternalhit)/i /(fstream|nativehost|queryseekspider|ia-archiver|facebookexternalhit)/i
// FStream/NativeHost/QuerySeekSpider/IA Archiver/facebookexternalhit // FStream/NativeHost/QuerySeekSpider/IA Archiver/facebookexternalhit
], [NAME], [ ], [NAME, [TYPE, MEDIAPLAYER]], [
/(gstreamer) souphttpsrc.+libsoup\/([\w\.-]+)/i /(gstreamer) souphttpsrc.+libsoup\/([\w\.-]+)/i
// Gstreamer // Gstreamer
], [NAME, VERSION], [ ], [NAME, VERSION, [TYPE, MEDIAPLAYER]], [
/(htc streaming player)\s[\w_]+\s\/\s([\d\.]+)/i, // HTC Streaming Player /(htc streaming player)\s[\w_]+\s\/\s([\d\.]+)/i, // HTC Streaming Player
/(java|python-urllib|python-requests|wget|libcurl)\/([\w\.-_]+)/i, /(java|python-urllib|python-requests|wget|libcurl)\/([\w\.-_]+)/i,
// Java/urllib/requests/wget/cURL // Java/urllib/requests/wget/cURL
/(lavf)([\d\.]+)/i // Lavf (FFMPEG) /(lavf)([\d\.]+)/i // Lavf (FFMPEG)
], [NAME, VERSION], [ ], [NAME, VERSION, [TYPE, MEDIAPLAYER]], [
/(htc_one_s)\/([\d\.]+)/i, // HTC One S /(htc_one_s)\/([\d\.]+)/i, // HTC One S
], [[NAME, /_/g, ' '], VERSION], [ ], [[NAME, /_/g, ' '], VERSION, [TYPE, MEDIAPLAYER]], [
/(mplayer)(?:\s|\/)(?:(?:sherpya-){0,1}svn)(?:-|\s)(r\d+(?:-\d+[\w\.-]+))/i, /(mplayer)(?:\s|\/)(?:(?:sherpya-){0,1}svn)(?:-|\s)(r\d+(?:-\d+[\w\.-]+))/i,
// MPlayer SVN // MPlayer SVN
], [NAME, VERSION], [ ], [NAME, VERSION, [TYPE, MEDIAPLAYER]], [
/(mplayer)(?:\s|\/)([\w\.-]+)/i, // MPlayer /(mplayer)(?:\s|\/)([\w\.-]+)/i, // MPlayer
/(mplayer) unknown-([\w\.\-]+)/i // MPlayer UNKNOWN /(mplayer) unknown-([\w\.\-]+)/i // MPlayer UNKNOWN
], [NAME, VERSION], [ ], [NAME, VERSION, [TYPE, MEDIAPLAYER]], [
/(mplayer)/i, // MPlayer (no other info) /(mplayer)/i, // MPlayer (no other info)
/(yourmuze)/i, // YourMuze /(yourmuze)/i, // YourMuze
/(media player classic|nero showtime)/i // Media Player Classic/Nero ShowTime /(media player classic|nero showtime)/i // Media Player Classic/Nero ShowTime
], [NAME], [ ], [NAME, [TYPE, MEDIAPLAYER]], [
/(nero (?:home|scout))\/([\w\.-]+)/i // Nero Home/Nero Scout /(nero (?:home|scout))\/([\w\.-]+)/i // Nero Home/Nero Scout
], [NAME, VERSION], [ ], [NAME, VERSION, [TYPE, MEDIAPLAYER]], [
/(nokia\d+)\/([\w\.-]+)/i // Nokia /(nokia\d+)\/([\w\.-]+)/i // Nokia
], [NAME, VERSION], [ ], [NAME, VERSION, [TYPE, MEDIAPLAYER]], [
/\s(songbird)\/([\w\.-]+)/i // Songbird/Philips-Songbird /\s(songbird)\/([\w\.-]+)/i // Songbird/Philips-Songbird
], [NAME, VERSION], [ ], [NAME, VERSION, [TYPE, MEDIAPLAYER]], [
/(winamp)3 version ([\w\.-]+)/i, // Winamp /(winamp)3 version ([\w\.-]+)/i, // Winamp
/(winamp)\s([\w\.-]+)/i, /(winamp)\s([\w\.-]+)/i,
/(winamp)mpeg\/([\w\.-]+)/i /(winamp)mpeg\/([\w\.-]+)/i
], [NAME, VERSION], [ ], [NAME, VERSION, [TYPE, MEDIAPLAYER]], [
/(ocms-bot|tapinradio|tunein radio|unknown|winamp|inlight radio)/i // OCMS-bot/tap in radio/tunein/unknown/winamp (no other info) /(ocms-bot|tapinradio|tunein radio|unknown|winamp|inlight radio)/i // OCMS-bot/tap in radio/tunein/unknown/winamp (no other info)
// inlight radio // inlight radio
], [NAME], [ ], [NAME, [TYPE, MEDIAPLAYER]], [
/(quicktime|rma|radioapp|radioclientapplication|soundtap|totem|stagefright|streamium)\/([\w\.-]+)/i /(quicktime|rma|radioapp|radioclientapplication|soundtap|totem|stagefright|streamium)\/([\w\.-]+)/i
// QuickTime/RealMedia/RadioApp/RadioClientApplication/ // QuickTime/RealMedia/RadioApp/RadioClientApplication/
// SoundTap/Totem/Stagefright/Streamium // SoundTap/Totem/Stagefright/Streamium
], [NAME, VERSION], [ ], [NAME, VERSION, [TYPE, MEDIAPLAYER]], [
/(smp)([\d\.]+)/i // SMP /(smp)([\d\.]+)/i // SMP
], [NAME, VERSION], [ ], [NAME, VERSION, [TYPE, MEDIAPLAYER]], [
/(vlc) media player - version ([\w\.]+)/i, // VLC Videolan /(vlc) media player - version ([\w\.]+)/i, // VLC Videolan
/(vlc)\/([\w\.-]+)/i, /(vlc)\/([\w\.-]+)/i,
/(xbmc|gvfs|xine|xmms|irapp)\/([\w\.-]+)/i, // XBMC/gvfs/Xine/XMMS/irapp /(xbmc|gvfs|xine|xmms|irapp)\/([\w\.-]+)/i, // XBMC/gvfs/Xine/XMMS/irapp
/(foobar2000)\/([\d\.]+)/i, // Foobar2000 /(foobar2000)\/([\d\.]+)/i, // Foobar2000
/(itunes)\/([\d\.]+)/i // iTunes /(itunes)\/([\d\.]+)/i // iTunes
], [NAME, VERSION], [ ], [NAME, VERSION, [TYPE, MEDIAPLAYER]], [
/(wmplayer)\/([\w\.-]+)/i, // Windows Media Player /(wmplayer)\/([\w\.-]+)/i, // Windows Media Player
/(windows-media-player)\/([\w\.-]+)/i /(windows-media-player)\/([\w\.-]+)/i
], [[NAME, /-/g, ' '], VERSION], [ ], [[NAME, /-/g, ' '], VERSION, [TYPE, MEDIAPLAYER]], [
/windows\/([\w\.-]+) upnp\/[\d\.]+ dlnadoc\/[\d\.]+ (home media server)/i, /windows\/([\w\.-]+) upnp\/[\d\.]+ dlnadoc\/[\d\.]+ (home media server)/i,
// Windows Media Server // Windows Media Server
], [VERSION, [NAME, 'Windows']], [ ], [VERSION, [NAME, 'Windows'], [TYPE, MEDIAPLAYER]], [
/(com\.riseupradioalarm)\/([\d\.]*)/i // RiseUP Radio Alarm /(com\.riseupradioalarm)\/([\d\.]*)/i // RiseUP Radio Alarm
], [NAME, VERSION], [ ], [NAME, VERSION, [TYPE, MEDIAPLAYER]], [
/(rad.io)\s([\d\.]+)/i, // Rad.io /(rad.io)\s([\d\.]+)/i, // Rad.io
/(radio.(?:de|at|fr))\s([\d\.]+)/i /(radio.(?:de|at|fr))\s([\d\.]+)/i
], [[NAME, 'rad.io'], VERSION] ], [[NAME, 'rad.io'], VERSION, [TYPE, MEDIAPLAYER]]
] ]
}); });

View File

@ -15,7 +15,7 @@ declare namespace UAParser {
name?: string; name?: string;
version?: string; version?: string;
major?: string; major?: string;
type?: 'crawler' | 'cli' | 'email' | 'fetcher' | 'inapp' | 'module'; type?: 'crawler' | 'cli' | 'email' | 'fetcher' | 'inapp' | 'mediaplayer' | 'module';
} }
interface ICPU extends IData<ICPU> { interface ICPU extends IData<ICPU> {

View File

@ -28,7 +28,7 @@ expectType<IBrowser>(browser);
expectType<string | undefined>(browser.name); expectType<string | undefined>(browser.name);
expectType<string | undefined>(browser.version); expectType<string | undefined>(browser.version);
expectType<string | undefined>(browser.major); expectType<string | undefined>(browser.major);
expectType<'crawler' | 'cli' | 'email' | 'fetcher' | 'inapp' | 'module' | undefined>(browser.type); expectType<'crawler' | 'cli' | 'email' | 'fetcher' | 'inapp' | 'mediaplayer' | 'module' | undefined>(browser.type);
expectType<boolean>(browser.is('')); expectType<boolean>(browser.is(''));
expectType<string>(browser.toString()); expectType<string>(browser.toString());
expectType<IBrowser | PromiseLike<IBrowser>>(browser.withClientHints()); expectType<IBrowser | PromiseLike<IBrowser>>(browser.withClientHints());