2020-06-21 16:23:19 +02:00
|
|
|
import 'package:test/test.dart';
|
|
|
|
import 'package:youtube_explode_dart/youtube_explode_dart.dart';
|
|
|
|
|
|
|
|
void main() {
|
2020-10-17 22:09:52 +02:00
|
|
|
YoutubeExplode yt;
|
|
|
|
setUp(() {
|
|
|
|
yt = YoutubeExplode();
|
|
|
|
});
|
2020-06-21 16:23:19 +02:00
|
|
|
|
2020-10-17 22:09:52 +02:00
|
|
|
tearDown(() {
|
|
|
|
yt.close();
|
2020-06-21 16:23:19 +02:00
|
|
|
});
|
2020-10-17 22:09:52 +02:00
|
|
|
|
|
|
|
test('Get comments of a video', () async {
|
|
|
|
var videoUrl = 'https://www.youtube.com/watch?v=AI7ULzgf8RU';
|
|
|
|
var video = await yt.videos.get(VideoId(videoUrl), forceWatchPage: true);
|
|
|
|
var comments = await yt.videos.commentsClient.getComments(video).toList();
|
|
|
|
expect(comments.length, greaterThanOrEqualTo(1));
|
|
|
|
}, skip: 'This may fail on some environments');
|
2020-06-21 16:23:19 +02:00
|
|
|
}
|