fix(YouTube - Video quality): Fix additional incorrect quality resolutions used by YouTube
This commit is contained in:
parent
f904ca6d7e
commit
6bd9e49c7a
1 changed files with 14 additions and 3 deletions
|
|
@ -474,11 +474,22 @@ public final class VideoInformation {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Injection point. Fixes bad data used by YouTube.
|
* Injection point. Fixes bad data used by YouTube.
|
||||||
|
* Issue can be reproduced by selecting 480p quality on any Short,
|
||||||
|
* and occasionally with random regular videos.
|
||||||
*/
|
*/
|
||||||
public static int fixVideoQualityResolution(String name, int quality) {
|
public static int fixVideoQualityResolution(String name, int quality) {
|
||||||
final int correctQuality = 480;
|
try {
|
||||||
if (name.equals("480p") && quality != correctQuality) {
|
if (!name.startsWith(Integer.toString(quality))) {
|
||||||
return correctQuality;
|
final int suffixIndex = name.indexOf('p');
|
||||||
|
if (suffixIndex > 0) {
|
||||||
|
final int fixedQuality = Integer.parseInt(name.substring(0, suffixIndex));
|
||||||
|
Logger.printDebug(() -> "Fixing wrong quality resolution from: " +
|
||||||
|
name + "(" + quality + ") to: " + name + ")" + fixedQuality + ")");
|
||||||
|
return fixedQuality;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Logger.printException(() -> "fixVideoQualityResolution failed", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
return quality;
|
return quality;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue