Skip to content

Commit

Permalink
Expose itag in StreamFormat
Browse files Browse the repository at this point in the history
  • Loading branch information
devoxin committed May 27, 2024
1 parent 2bb3505 commit 22e2690
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ protected boolean extractFormat(JsonBrowser formatJson,

formats.add(new StreamFormat(
ContentType.parse(formatJson.get("mimeType").text()),
(int) formatJson.get("itag").asLong(-1L),
formatJson.get("bitrate").asLong(Units.BITRATE_UNKNOWN),
contentLength,
formatJson.get("audioChannels").asLong(2),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
public class StreamFormat {
private final FormatInfo info;
private final ContentType type;
private final int itag;
private final long bitrate;
private final long contentLength;
private final long audioChannels;
Expand All @@ -37,6 +38,7 @@ public class StreamFormat {
*/
public StreamFormat(
ContentType type,
int itag,
long bitrate,
long contentLength,
long audioChannels,
Expand All @@ -49,6 +51,7 @@ public StreamFormat(
) {
this.info = FormatInfo.get(type);
this.type = type;
this.itag = itag;
this.bitrate = bitrate;
this.contentLength = contentLength;
this.audioChannels = audioChannels;
Expand Down Expand Up @@ -76,6 +79,10 @@ public ContentType getType() {
return type;
}

public int getItag() {
return itag;
}

/**
* @return Bitrate of the format
*/
Expand Down Expand Up @@ -150,7 +157,8 @@ public boolean isDrc() {
@Override
public String toString() {
return "YoutubeStreamFormat{" +
"type=" + type +
"itag=" + itag +
", type=" + type +
", bitrate=" + bitrate +
", audioChannels=" + audioChannels +
", isDrc=" + isDrc +
Expand Down

0 comments on commit 22e2690

Please sign in to comment.