mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
Update other categorization
This commit is contained in:
@@ -264,6 +264,23 @@ trait DetectsHashedNames
|
||||
return preg_match('/[aeiou]/i', $letterOnly) !== 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the letter-only portion of a token has a normal vowel ratio.
|
||||
*/
|
||||
protected function hasNormalVowelRatio(string $str, float $min = 0.2): bool
|
||||
{
|
||||
$letters = preg_replace('/[^a-z]/i', '', $str);
|
||||
|
||||
if ($letters === '' || strlen($letters) < 5) {
|
||||
return false;
|
||||
}
|
||||
|
||||
preg_match_all('/[aeiou]/i', $letters, $matches);
|
||||
$vowelCount = count($matches[0]);
|
||||
|
||||
return ($vowelCount / strlen($letters)) >= $min;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a string looks like a random/obfuscated string rather than a real title.
|
||||
*
|
||||
@@ -315,7 +332,7 @@ trait DetectsHashedNames
|
||||
protected function stripExtensionsForAnalysis(string $name): string
|
||||
{
|
||||
return preg_replace(
|
||||
'/\.(mkv|avi|mp4|m4v|mpg|mpeg|wmv|flv|mov|ts|vob|iso|divx|par2?|nfo|sfv|nzb|rar|r\d{2,3}|zip|7z|gz|tar|001)$/i',
|
||||
'/\.(mkv|avi|mp4|m4v|mpg|mpeg|wmv|flv|mov|ts|vob|iso|divx|par2?|nfo|sfv|nzb|rar|r\d{2,3}|zip|7z|gz|tar|001|msix|msixbundle|appx|appxbundle|apk|xap|ipa|deb|rpm|pkg|dmg|exe|msi)$/i',
|
||||
'',
|
||||
trim($name)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user