getPlayerResponseWithSignature method

Future<PlayerResponse> getPlayerResponseWithSignature(
  1. VideoId videoId,
  2. String? signatureTimestamp
)

Implementation

Future<PlayerResponse> getPlayerResponseWithSignature(
  VideoId videoId,
  String? signatureTimestamp,
) async {
  /// The only client that can handle age-restricted videos without authentication is the
  ///  TVHTML5_SIMPLY_EMBEDDED_PLAYER client.
  ///  This client does require signature deciphering, so we only use it as a fallback.
  final content = await httpClient.postString(
    'https://www.youtube.com/youtubei/v1/player?key=AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w&prettyPrint=false',
    body: {
      ..._tvClient,
      'videoId': videoId.value,
      'playbackContext': {
        'contentPlaybackContext': {
          'signatureTimestamp': signatureTimestamp ?? '19369',
        },
      },
    },
  );
  return PlayerResponse.parse(content);
}