mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2024-12-12 21:30:33 +05:30
Renaming and new fields/methods
- Mainly in PlaylistInfoItem and the collector
This commit is contained in:
parent
b1eefa040e
commit
5bf2e95d7b
@ -29,11 +29,12 @@ public abstract class InfoItem implements Serializable {
|
||||
USER
|
||||
}
|
||||
|
||||
public final InfoType info_type;
|
||||
|
||||
public InfoItem(InfoType infoType) {
|
||||
this.info_type = infoType;
|
||||
}
|
||||
|
||||
public final InfoType info_type;
|
||||
public int service_id = -1;
|
||||
public String url;
|
||||
public String name;
|
||||
|
@ -38,9 +38,7 @@ public enum MediaFormat {
|
||||
MP3 (0x5, "MP3", "mp3", "audio/mpeg");
|
||||
|
||||
public final int id;
|
||||
@SuppressWarnings("WeakerAccess")
|
||||
public final String name;
|
||||
@SuppressWarnings("WeakerAccess")
|
||||
public final String suffix;
|
||||
public final String mimeType;
|
||||
|
||||
|
@ -4,6 +4,7 @@ import org.schabi.newpipe.extractor.InfoItem;
|
||||
|
||||
public class PlaylistInfoItem extends InfoItem {
|
||||
|
||||
public String uploader_name;
|
||||
public String thumbnail_url;
|
||||
/**
|
||||
* How many streams this playlist have
|
||||
|
@ -15,6 +15,11 @@ public class PlaylistInfoItemCollector extends InfoItemCollector {
|
||||
resultItem.service_id = getServiceId();
|
||||
resultItem.url = extractor.getWebPageUrl();
|
||||
|
||||
try {
|
||||
resultItem.uploader_name = extractor.getUploaderName();
|
||||
} catch (Exception e) {
|
||||
addError(e);
|
||||
}
|
||||
try {
|
||||
resultItem.thumbnail_url = extractor.getThumbnailUrl();
|
||||
} catch (Exception e) {
|
||||
|
@ -4,6 +4,7 @@ import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||
|
||||
public interface PlaylistInfoItemExtractor {
|
||||
String getThumbnailUrl() throws ParsingException;
|
||||
String getUploaderName() throws ParsingException;
|
||||
String getPlaylistName() throws ParsingException;
|
||||
String getWebPageUrl() throws ParsingException;
|
||||
long getStreamCount() throws ParsingException;
|
||||
|
@ -29,7 +29,7 @@ public class SoundcloudStreamInfoItemExtractor implements StreamInfoItemExtracto
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUploader() {
|
||||
public String getUploaderName() {
|
||||
return searchResult.getJSONObject("user").getString("username");
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,7 @@ public class YoutubePlaylistExtractor extends PlaylistExtractor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUploader() throws ParsingException {
|
||||
public String getUploaderName() throws ParsingException {
|
||||
return li.select("div[class=pl-video-owner] a").text();
|
||||
}
|
||||
|
||||
|
@ -829,7 +829,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUploader() throws ParsingException {
|
||||
public String getUploaderName() throws ParsingException {
|
||||
return li.select("span.g-hovercard").first().text();
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ public class YoutubeStreamInfoItemExtractor implements StreamInfoItemExtractor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUploader() throws ParsingException {
|
||||
public String getUploaderName() throws ParsingException {
|
||||
try {
|
||||
return item.select("div[class=\"yt-lockup-byline\"]").first()
|
||||
.select("a").first()
|
||||
|
@ -247,7 +247,7 @@ public class YoutubeUserExtractor extends UserExtractor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUploader() throws ParsingException {
|
||||
public String getUploaderName() throws ParsingException {
|
||||
return getUserName();
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ import org.schabi.newpipe.extractor.InfoItem;
|
||||
public class StreamInfoItem extends InfoItem {
|
||||
public StreamType stream_type;
|
||||
|
||||
public String uploader;
|
||||
public String uploader_name;
|
||||
public String thumbnail_url;
|
||||
public String upload_date;
|
||||
public long view_count = -1;
|
||||
|
@ -50,7 +50,7 @@ public class StreamInfoItemCollector extends InfoItemCollector {
|
||||
addError(e);
|
||||
}
|
||||
try {
|
||||
resultItem.uploader = extractor.getUploader();
|
||||
resultItem.uploader_name = extractor.getUploaderName();
|
||||
} catch (Exception e) {
|
||||
addError(e);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public interface StreamInfoItemExtractor {
|
||||
String getWebPageUrl() throws ParsingException;
|
||||
String getTitle() throws ParsingException;
|
||||
int getDuration() throws ParsingException;
|
||||
String getUploader() throws ParsingException;
|
||||
String getUploaderName() throws ParsingException;
|
||||
String getUploadDate() throws ParsingException;
|
||||
long getViewCount() throws ParsingException;
|
||||
String getThumbnailUrl() throws ParsingException;
|
||||
|
@ -31,9 +31,8 @@ public class UserInfoItemCollector extends InfoItemCollector {
|
||||
public UserInfoItem extract(UserInfoItemExtractor extractor) throws ParsingException {
|
||||
UserInfoItem resultItem = new UserInfoItem();
|
||||
// important information
|
||||
resultItem.name = extractor.getUserName();
|
||||
|
||||
resultItem.service_id = getServiceId();
|
||||
resultItem.name = extractor.getUserName();
|
||||
resultItem.url = extractor.getWebPageUrl();
|
||||
|
||||
// optional information
|
||||
|
@ -57,7 +57,7 @@ public class Utils {
|
||||
}
|
||||
|
||||
if (!Parser.isMatch(pattern, url.toLowerCase())) {
|
||||
throw new ParsingException("Url not suitable for this url handler");
|
||||
throw new ParsingException("Url don't match the pattern");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
||||
/**
|
||||
* Test for {@link UserExtractor}
|
||||
*/
|
||||
|
||||
public class YoutubeUserExtractorTest {
|
||||
|
||||
UserExtractor extractor;
|
||||
|
Loading…
Reference in New Issue
Block a user