-
Notifications
You must be signed in to change notification settings - Fork 433
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[YouTube] Use poTokens where needed and rework JSON requests
- Loading branch information
Showing
5 changed files
with
708 additions
and
382 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 23 additions & 5 deletions
28
extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/PoTokenResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,40 @@ | ||
package org.schabi.newpipe.extractor.services.youtube; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
import java.util.Objects; | ||
|
||
public final class PoTokenResult { | ||
|
||
/** | ||
* The visitor data associated with a poToken. | ||
* The visitor data associated with a {@code poToken}. | ||
*/ | ||
@Nonnull | ||
public final String visitorData; | ||
|
||
/** | ||
* The poToken, a Protobuf object encoded as a base 64 string. | ||
* The {@code poToken} of a player request, a Protobuf object encoded as a base 64 string. | ||
*/ | ||
public final String poToken; | ||
@Nonnull | ||
public final String playerRequestPoToken; | ||
|
||
public PoTokenResult(@Nonnull final String visitorData, @Nonnull final String poToken) { | ||
/** | ||
* The {@code poToken} to be appended to streaming URLs, a Protobuf object encoded as a base | ||
* 64 string. | ||
* | ||
* <p> | ||
* It may be required on some clients such as HTML5 ones and may also differ from the player | ||
* request {@code poToken}. | ||
* </p> | ||
*/ | ||
@Nullable | ||
public final String streamingDataPoToken; | ||
|
||
public PoTokenResult(@Nonnull final String visitorData, | ||
@Nonnull final String playerRequestPoToken, | ||
@Nullable final String streamingDataPoToken) { | ||
this.visitorData = Objects.requireNonNull(visitorData); | ||
this.poToken = Objects.requireNonNull(poToken); | ||
this.playerRequestPoToken = Objects.requireNonNull(playerRequestPoToken); | ||
this.streamingDataPoToken = streamingDataPoToken; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.