mirror of
https://github.com/TeamNewPipe/NewPipeExtractor
synced 2025-08-22 18:07:47 +00:00
[YouTube] Detect members first and members only shorts
This fixes view count extraction error for such content, as the view count is replaced by a text describing the availability of the short. Also made YoutubeShortsLockupInfoItemExtractor package private, as it doesn't need to be public.
This commit is contained in:
parent
22f7cd4a6f
commit
26bcfcdeaf
@ -33,12 +33,12 @@ import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
|
||||
* for an extractor for this UI data type.
|
||||
* </p>
|
||||
*/
|
||||
public class YoutubeShortsLockupInfoItemExtractor implements StreamInfoItemExtractor {
|
||||
class YoutubeShortsLockupInfoItemExtractor implements StreamInfoItemExtractor {
|
||||
|
||||
@Nonnull
|
||||
private final JsonObject shortsLockupViewModel;
|
||||
|
||||
public YoutubeShortsLockupInfoItemExtractor(@Nonnull final JsonObject shortsLockupViewModel) {
|
||||
YoutubeShortsLockupInfoItemExtractor(@Nonnull final JsonObject shortsLockupViewModel) {
|
||||
this.shortsLockupViewModel = shortsLockupViewModel;
|
||||
}
|
||||
|
||||
@ -93,6 +93,12 @@ public class YoutubeShortsLockupInfoItemExtractor implements StreamInfoItemExtra
|
||||
.getObject("secondaryText")
|
||||
.getString("content");
|
||||
if (!isNullOrEmpty(viewCountText)) {
|
||||
if (viewCountText.contains("✪")) {
|
||||
// If secondary text content contains ✪, this short should be a members first or a
|
||||
// members only one, we can't extract its view count in this case
|
||||
return -1;
|
||||
}
|
||||
|
||||
// This approach is language dependent
|
||||
if (viewCountText.toLowerCase().contains("no views")) {
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user