Skip to content

Commit 1a322ad

Browse files
committed
Add uploader verified by service extraction
1 parent db253e2 commit 1a322ad

54 files changed

Lines changed: 474 additions & 91 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelExtractor.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,6 @@ public ChannelExtractor(StreamingService service, ListLinkHandler linkHandler) {
4040
public abstract String getParentChannelName() throws ParsingException;
4141
public abstract String getParentChannelUrl() throws ParsingException;
4242
public abstract String getParentChannelAvatarUrl() throws ParsingException;
43+
public abstract boolean isVerified() throws ParsingException;
44+
4345
}

extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfoItem.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class ChannelInfoItem extends InfoItem {
2727
private String description;
2828
private long subscriberCount = -1;
2929
private long streamCount = -1;
30-
30+
private boolean verified = false;
3131

3232
public ChannelInfoItem(int serviceId, String url, String name) {
3333
super(InfoType.CHANNEL, serviceId, url, name);
@@ -56,4 +56,12 @@ public long getStreamCount() {
5656
public void setStreamCount(long stream_count) {
5757
this.streamCount = stream_count;
5858
}
59+
60+
public boolean isVerified() {
61+
return verified;
62+
}
63+
64+
public void setVerified(boolean verified) {
65+
this.verified = verified;
66+
}
5967
}

extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfoItemExtractor.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,8 @@ public interface ChannelInfoItemExtractor extends InfoItemExtractor {
2727
String getDescription() throws ParsingException;
2828

2929
long getSubscriberCount() throws ParsingException;
30+
3031
long getStreamCount() throws ParsingException;
32+
33+
boolean isVerified() throws ParsingException;
3134
}

extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfoItemsCollector.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ public ChannelInfoItem extract(ChannelInfoItemExtractor extractor) throws Parsin
5959
} catch (Exception e) {
6060
addError(e);
6161
}
62+
try {
63+
resultItem.setVerified(extractor.isVerified());
64+
} catch (Exception e) {
65+
addError(e);
66+
}
67+
6268
return resultItem;
6369
}
6470
}

extractor/src/main/java/org/schabi/newpipe/extractor/comments/CommentsInfoItem.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public class CommentsInfoItem extends InfoItem {
1212
private String uploaderName;
1313
private String uploaderAvatarUrl;
1414
private String uploaderUrl;
15+
private boolean uploaderVerified;
1516
private String textualUploadDate;
1617
@Nullable
1718
private DateWrapper uploadDate;
@@ -103,4 +104,12 @@ public boolean isPinned() {
103104
public void setPinned(boolean pinned) {
104105
this.pinned = pinned;
105106
}
107+
108+
public void setUploaderVerified(boolean uploaderVerified) {
109+
this.uploaderVerified = uploaderVerified;
110+
}
111+
112+
public boolean isUploaderVerified() {
113+
return uploaderVerified;
114+
}
106115
}

extractor/src/main/java/org/schabi/newpipe/extractor/comments/CommentsInfoItemExtractor.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,9 @@ public interface CommentsInfoItemExtractor extends InfoItemExtractor {
5353
* Whether the comment is pinned
5454
*/
5555
boolean isPinned() throws ParsingException;
56+
57+
/**
58+
* Whether the uploader is verified by the service
59+
*/
60+
boolean isUploaderVerified() throws ParsingException;
5661
}

extractor/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistExtractor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public PlaylistExtractor(StreamingService service, ListLinkHandler linkHandler)
2020
public abstract String getUploaderUrl() throws ParsingException;
2121
public abstract String getUploaderName() throws ParsingException;
2222
public abstract String getUploaderAvatarUrl() throws ParsingException;
23+
public abstract boolean isUploaderVerified() throws ParsingException;
2324

2425
public abstract long getStreamCount() throws ParsingException;
2526

extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCConferenceExtractor.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import com.grack.nanojson.JsonObject;
55
import com.grack.nanojson.JsonParser;
66
import com.grack.nanojson.JsonParserException;
7-
87
import org.schabi.newpipe.extractor.Page;
98
import org.schabi.newpipe.extractor.StreamingService;
109
import org.schabi.newpipe.extractor.channel.ChannelExtractor;
@@ -17,9 +16,8 @@
1716
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
1817
import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector;
1918

20-
import java.io.IOException;
21-
2219
import javax.annotation.Nonnull;
20+
import java.io.IOException;
2321

2422
public class MediaCCCConferenceExtractor extends ChannelExtractor {
2523
private JsonObject conferenceData;
@@ -69,6 +67,11 @@ public String getParentChannelAvatarUrl() throws ParsingException {
6967
return "";
7068
}
7169

70+
@Override
71+
public boolean isVerified() throws ParsingException {
72+
return false;
73+
}
74+
7275
@Nonnull
7376
@Override
7477
public InfoItemsPage<StreamInfoItem> getInitialPage() {

extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCLiveStreamExtractor.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ public String getUploaderName() throws ParsingException {
126126
return conference.getString("conference");
127127
}
128128

129+
@Override
130+
public boolean isUploaderVerified() throws ParsingException {
131+
return false;
132+
}
133+
129134
@Nonnull
130135
@Override
131136
public String getUploaderAvatarUrl() {
@@ -180,7 +185,7 @@ public List<AudioStream> getAudioStreams() throws IOException, ExtractionExcepti
180185
for (int s = 0; s < room.getArray("streams").size(); s++) {
181186
final JsonObject stream = room.getArray("streams").getObject(s);
182187
if (stream.getString("type").equals("audio")) {
183-
for (final String type :stream.getObject("urls").keySet()) {
188+
for (final String type : stream.getObject("urls").keySet()) {
184189
final JsonObject url = stream.getObject("urls").getObject(type);
185190
audioStreams.add(new AudioStream(url.getString("url"), MediaFormat.getFromSuffix(type), -1));
186191
}
@@ -197,7 +202,7 @@ public List<VideoStream> getVideoStreams() throws IOException, ExtractionExcepti
197202
if (stream.getString("type").equals("video")) {
198203
final String resolution = stream.getArray("videoSize").getInt(0) + "x"
199204
+ stream.getArray("videoSize").getInt(1);
200-
for (final String type :stream.getObject("urls").keySet()) {
205+
for (final String type : stream.getObject("urls").keySet()) {
201206
if (!type.equals("hls")) {
202207
final JsonObject url = stream.getObject("urls").getObject(type);
203208
videoStreams.add(new VideoStream(
@@ -218,7 +223,7 @@ public List<VideoStream> getVideoOnlyStreams() throws IOException, ExtractionExc
218223

219224
@Nonnull
220225
@Override
221-
public List<SubtitlesStream> getSubtitlesDefault(){
226+
public List<SubtitlesStream> getSubtitlesDefault() {
222227
return Collections.emptyList();
223228
}
224229

extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCLiveStreamKioskExtractor.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ public String getUploaderUrl() throws ParsingException {
7373
return "https://media.ccc.de/c/" + conferenceInfo.getString("slug");
7474
}
7575

76+
@Override
77+
public boolean isUploaderVerified() throws ParsingException {
78+
return false;
79+
}
80+
7681
@Nullable
7782
@Override
7883
public String getTextualUploadDate() throws ParsingException {

0 commit comments

Comments
 (0)