Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change to cookieless HTTP manager, add itag to StreamFormat #15

Merged
merged 3 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public YoutubeAudioSourceManager(boolean allowSearch,
boolean allowDirectVideoIds,
boolean allowDirectPlaylistIds,
@NotNull Client... clients) {
this.httpInterfaceManager = HttpClientTools.createDefaultThreadLocalManager();
this.httpInterfaceManager = HttpClientTools.createCookielessThreadLocalManager();
this.allowSearch = allowSearch;
this.allowDirectVideoIds = allowDirectVideoIds;
this.allowDirectPlaylistIds = allowDirectPlaylistIds;
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ protected boolean extractFormat(@NotNull 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
Loading