mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2024-11-10 09:07:47 +01:00
Improve useragent parsing
This commit is contained in:
parent
22b4135d62
commit
dbb8128a3a
1 changed files with 2 additions and 2 deletions
|
@ -1,11 +1,11 @@
|
|||
export function parseUserAgent(userAgent: string): string {
|
||||
const ua = userAgent.toLowerCase();
|
||||
|
||||
if (ua.includes("com.google.android.youtube/") || ua.includes("com.vanced.android.youtube/")) {
|
||||
if (ua.match(/(com.google.android.youtube\/)|(com.vanced.android.youtube\/)|(^YouTube\/)|(^Dalvik\/)/)) {
|
||||
return `Vanced/${ua.match(/.android.youtube\/([^\s]+)/)[1]}`;
|
||||
}
|
||||
|
||||
if (ua.includes("mpv_sponsorblock/")) {
|
||||
if (ua.match(/(mpv_sponsorblock\/)|(^python-requests)|(^GuzzleHttp\/)|(^PostmanRuntime\/)/)) {
|
||||
return ua;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue