commit
						35b87434e5
					
				|  | @ -92,6 +92,8 @@ class YouTubeTranscriptApi(object): | |||
|         video ids, which could not be retrieved | ||||
|         :rtype ({str: [{'text': str, 'start': float, 'end': float}]}, [str]}): | ||||
|         """ | ||||
|         assert isinstance(video_ids, list), "`video_ids` must be a list of strings" | ||||
| 
 | ||||
|         data = {} | ||||
|         unretrievable_videos = [] | ||||
| 
 | ||||
|  | @ -126,6 +128,7 @@ class YouTubeTranscriptApi(object): | |||
|         :return: a list of dictionaries containing the 'text', 'start' and 'duration' keys | ||||
|         :rtype [{'text': str, 'start': float, 'end': float}]: | ||||
|         """ | ||||
|         assert isinstance(video_id, str), "`video_id` must be a string" | ||||
|         return cls.list_transcripts(video_id, proxies, cookies).find_transcript(languages).fetch() | ||||
|      | ||||
|     @classmethod | ||||
|  |  | |||
|  | @ -255,6 +255,14 @@ class TestYouTubeTranscriptApi(TestCase): | |||
|             ] | ||||
|         ) | ||||
|      | ||||
|     def test_get_transcript__assertionerror_if_input_not_string(self): | ||||
|         with self.assertRaises(AssertionError): | ||||
|             YouTubeTranscriptApi.get_transcript(['video_id_1', 'video_id_2']) | ||||
|      | ||||
|     def test_get_transcripts__assertionerror_if_input_not_list(self): | ||||
|         with self.assertRaises(AssertionError): | ||||
|             YouTubeTranscriptApi.get_transcripts('video_id_1') | ||||
| 
 | ||||
|     @patch('youtube_transcript_api.YouTubeTranscriptApi.get_transcript') | ||||
|     def test_get_transcripts(self, mock_get_transcript): | ||||
|         video_id_1 = 'video_id_1' | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue