Merge branch 'dev' of github.com:TeamNewPipe/NewPipeExtractor into channel-tabs

This commit is contained in:
ThetaDev 2023-04-05 14:52:18 +02:00
commit e57d43f92d
3 changed files with 21 additions and 6 deletions

View File

@ -8,7 +8,7 @@ allprojects {
sourceCompatibility = JavaVersion.VERSION_11 sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11
version 'v0.22.5' version 'v0.22.6'
group 'com.github.TeamNewPipe' group 'com.github.TeamNewPipe'
repositories { repositories {

View File

@ -25,7 +25,7 @@ public class BandcampRelatedPlaylistInfoItemExtractor implements PlaylistInfoIte
@Override @Override
public String getUrl() throws ParsingException { public String getUrl() throws ParsingException {
return relatedAlbum.getElementsByClass("title-and-artist").attr("abs:href"); return relatedAlbum.getElementsByClass("album-link").attr("abs:href");
} }
@Override @Override

View File

@ -66,10 +66,15 @@ public class YoutubeCommentsExtractor extends CommentsExtractor {
* @return the continuation token or null if none was found * @return the continuation token or null if none was found
*/ */
@Nullable @Nullable
private String findInitialCommentsToken(final JsonObject nextResponse) private String findInitialCommentsToken(final JsonObject nextResponse) {
throws ExtractionException { final JsonArray contents = getJsonContents(nextResponse);
final String token = JsonUtils.getArray(nextResponse,
"contents.twoColumnWatchNextResults.results.results.contents") // For videos where comments are unavailable, this would be null
if (contents == null) {
return null;
}
final String token = contents
.stream() .stream()
// Only use JsonObjects // Only use JsonObjects
.filter(JsonObject.class::isInstance) .filter(JsonObject.class::isInstance)
@ -105,6 +110,16 @@ public class YoutubeCommentsExtractor extends CommentsExtractor {
return token; return token;
} }
@Nullable
private JsonArray getJsonContents(final JsonObject nextResponse) {
try {
return JsonUtils.getArray(nextResponse,
"contents.twoColumnWatchNextResults.results.results.contents");
} catch (final ParsingException e) {
return null;
}
}
@Nonnull @Nonnull
private InfoItemsPage<CommentsInfoItem> getInfoItemsPageForDisabledComments() { private InfoItemsPage<CommentsInfoItem> getInfoItemsPageForDisabledComments() {
return new InfoItemsPage<>(Collections.emptyList(), null, Collections.emptyList()); return new InfoItemsPage<>(Collections.emptyList(), null, Collections.emptyList());