public class YoutubeStreamInfoItemExtractor extends Object implements StreamInfoItemExtractor
Constructor and Description |
---|
YoutubeStreamInfoItemExtractor(com.grack.nanojson.JsonObject videoInfoItem,
TimeAgoParser timeAgoParser)
Creates an extractor of StreamInfoItems from a YouTube page.
|
Modifier and Type | Method and Description |
---|---|
long |
getDuration()
Get the stream duration in seconds
|
String |
getName() |
String |
getShortDescription()
Get the video's short description.
|
StreamType |
getStreamType()
Get the stream type
|
String |
getTextualUploadDate()
The original textual date provided by the service.
|
String |
getThumbnailUrl() |
DateWrapper |
getUploadDate()
Extracts the upload date and time of this item and parses it.
|
String |
getUploaderAvatarUrl()
Get the uploader's avatar
|
String |
getUploaderName()
Get the uploader name
|
String |
getUploaderUrl() |
String |
getUrl() |
long |
getViewCount()
Parses the number of views
|
boolean |
isAd()
Check if the stream is an ad.
|
boolean |
isUploaderVerified()
Whether the uploader has been verified by the service's provider.
|
public YoutubeStreamInfoItemExtractor(com.grack.nanojson.JsonObject videoInfoItem, @Nullable TimeAgoParser timeAgoParser)
videoInfoItem
- The JSON page elementtimeAgoParser
- A parser of the textual dates or null
.public StreamType getStreamType()
StreamInfoItemExtractor
getStreamType
in interface StreamInfoItemExtractor
public boolean isAd() throws ParsingException
StreamInfoItemExtractor
isAd
in interface StreamInfoItemExtractor
true
if the stream is an ad.ParsingException
- thrown if there is an error in the extractionpublic String getUrl() throws ParsingException
getUrl
in interface InfoItemExtractor
ParsingException
public String getName() throws ParsingException
getName
in interface InfoItemExtractor
ParsingException
public long getDuration() throws ParsingException
StreamInfoItemExtractor
getDuration
in interface StreamInfoItemExtractor
ParsingException
- thrown if there is an error in the extractionpublic String getUploaderName() throws ParsingException
StreamInfoItemExtractor
getUploaderName
in interface StreamInfoItemExtractor
ParsingException
- if parsing failspublic String getUploaderUrl() throws ParsingException
getUploaderUrl
in interface StreamInfoItemExtractor
ParsingException
@Nullable public String getUploaderAvatarUrl() throws ParsingException
StreamInfoItemExtractor
getUploaderAvatarUrl
in interface StreamInfoItemExtractor
null
if not provided by the service.ParsingException
- if there is an error in the extractionpublic boolean isUploaderVerified() throws ParsingException
StreamInfoItemExtractor
false
.isUploaderVerified
in interface StreamInfoItemExtractor
ParsingException
@Nullable public String getTextualUploadDate() throws ParsingException
StreamInfoItemExtractor
StreamInfoItemExtractor.getUploadDate()
isn't provided by the service, or it fails for some reason.getTextualUploadDate
in interface StreamInfoItemExtractor
null
if not provided.ParsingException
- if there is an error in the extractionStreamInfoItemExtractor.getUploadDate()
@Nullable public DateWrapper getUploadDate() throws ParsingException
StreamInfoItemExtractor
If the service doesn't provide an exact time, an approximation can be returned.
If the service doesn't provide any date at all, then null
should be returned.
getUploadDate
in interface StreamInfoItemExtractor
null
.ParsingException
- if there is an error in the extraction
or the extracted date couldn't be parsed.StreamInfoItemExtractor.getTextualUploadDate()
public long getViewCount() throws ParsingException
StreamInfoItemExtractor
getViewCount
in interface StreamInfoItemExtractor
ParsingException
- thrown if there is an error in the extractionpublic String getThumbnailUrl() throws ParsingException
getThumbnailUrl
in interface InfoItemExtractor
ParsingException
@Nullable public String getShortDescription() throws ParsingException
StreamInfoItemExtractor
getShortDescription
in interface StreamInfoItemExtractor
null
if not provided by the service.ParsingException
- if there is an error in the extraction