getVideo method

Future<VideoFull> getVideo(
  1. String videoId
)

Retrieves detailed information about a video given its video ID.

Implementation

Future<VideoFull> getVideo(String videoId) async {
  if (!RegExp(r"^[a-zA-Z0-9-_]{11}$").hasMatch(videoId)) {
    throw Exception("Invalid videoId");
  }

  final data = await constructRequest("player", body: {"videoId": videoId});

  final video = VideoParser.parse(data);
  if (video.videoId != videoId) {
    throw Exception("Invalid videoId");
  }
  return video;
}