Просмотр исходного кода

Allow empty results in single-item queries

Zachary Kotlarek 11 лет назад
Родитель
Сommit
c1ba13b57c
1 измененных файлов с 1 добавлено и 2 удалено
  1. 1 2
      yt/subscribe.pl

+ 1 - 2
yt/subscribe.pl

@@ -982,11 +982,10 @@ sub getVideoData($) {
 	if (   exists($data->{'pageInfo'})
 		&& ref($data->{'pageInfo'}) eq 'HASH'
 		&& exists($data->{'pageInfo'}->{'totalResults'})
-		&& $data->{'pageInfo'}->{'totalResults'} > 0
 		&& exists($data->{'items'})
 		&& ref($data->{'items'}) eq 'ARRAY')
 	{
-		if ($data->{'pageInfo'}->{'totalResults'} != scalar(@{$ids})) {
+		if (scalar(@{$ids}) > 1 && $data->{'pageInfo'}->{'totalResults'} != scalar(@{$ids})) {
 			die('Video/metadata search count mismatch: ' . $data->{'pageInfo'}->{'totalResults'} . '/' . scalar(@{$ids}) . "\n");
 		}
 		$data = $data->{'items'};