Merge branch 'jdepoix:master' into master
This commit is contained in:
		
						commit
						3b2e6e253d
					
				|  | @ -0,0 +1,23 @@ | ||||||
|  | --- | ||||||
|  | name: Bug report | ||||||
|  | about: Create a report to help us improve | ||||||
|  | title: '' | ||||||
|  | labels: '' | ||||||
|  | assignees: '' | ||||||
|  | 
 | ||||||
|  | --- | ||||||
|  | 
 | ||||||
|  | # To Reproduce | ||||||
|  | Steps to reproduce the behavior: | ||||||
|  | 
 | ||||||
|  | ### Which Python version are you using? | ||||||
|  | 
 | ||||||
|  | ### Which version of youtube-transcript-api are you using? | ||||||
|  | 
 | ||||||
|  | ### What code / cli command are you executing? | ||||||
|  | 
 | ||||||
|  | # Expected behavior | ||||||
|  | Describe what you expected to happen. | ||||||
|  | 
 | ||||||
|  | # Actual behaviour | ||||||
|  | Describe what is happening instead of the **Expected behavior**. Add error messages if there are any. | ||||||
|  | @ -0,0 +1,20 @@ | ||||||
|  | --- | ||||||
|  | name: Feature request | ||||||
|  | about: Suggest an idea for this project | ||||||
|  | title: '' | ||||||
|  | labels: '' | ||||||
|  | assignees: '' | ||||||
|  | 
 | ||||||
|  | --- | ||||||
|  | 
 | ||||||
|  | **Is your feature request related to a problem? Please describe.** | ||||||
|  | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] | ||||||
|  | 
 | ||||||
|  | **Describe the solution you'd like** | ||||||
|  | A clear and concise description of how you want youtube-transcript-api to solve your problem. | ||||||
|  | 
 | ||||||
|  | **Describe alternatives you've considered** | ||||||
|  | A clear and concise description of any alternative solutions or features you've considered. | ||||||
|  | 
 | ||||||
|  | **Additional context** | ||||||
|  | Add any other context about the feature request here. If you have any additional technical information which could be relevant for the implementation, feel free to share them here. | ||||||
|  | @ -92,6 +92,8 @@ class YouTubeTranscriptApi(object): | ||||||
|         video ids, which could not be retrieved |         video ids, which could not be retrieved | ||||||
|         :rtype ({str: [{'text': str, 'start': float, 'end': float}]}, [str]}): |         :rtype ({str: [{'text': str, 'start': float, 'end': float}]}, [str]}): | ||||||
|         """ |         """ | ||||||
|  |         assert isinstance(video_ids, list), "`video_ids` must be a list of strings" | ||||||
|  | 
 | ||||||
|         data = {} |         data = {} | ||||||
|         unretrievable_videos = [] |         unretrievable_videos = [] | ||||||
| 
 | 
 | ||||||
|  | @ -126,6 +128,7 @@ class YouTubeTranscriptApi(object): | ||||||
|         :return: a list of dictionaries containing the 'text', 'start' and 'duration' keys |         :return: a list of dictionaries containing the 'text', 'start' and 'duration' keys | ||||||
|         :rtype [{'text': str, 'start': float, 'end': float}]: |         :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() |         return cls.list_transcripts(video_id, proxies, cookies).find_transcript(languages).fetch() | ||||||
|      |      | ||||||
|     @classmethod |     @classmethod | ||||||
|  |  | ||||||
|  | @ -254,6 +254,14 @@ class TestYouTubeTranscriptApi(TestCase): | ||||||
|                 {'text': 'just something shorter, I made up for testing', 'start': 5.7, 'duration': 3.239} |                 {'text': 'just something shorter, I made up for testing', 'start': 5.7, 'duration': 3.239} | ||||||
|             ] |             ] | ||||||
|         ) |         ) | ||||||
|  |      | ||||||
|  |     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') |     @patch('youtube_transcript_api.YouTubeTranscriptApi.get_transcript') | ||||||
|     def test_get_transcripts(self, mock_get_transcript): |     def test_get_transcripts(self, mock_get_transcript): | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue