get_transcripts signature updated to be python2 compatible
This commit is contained in:
		
							parent
							
								
									0142f9a61f
								
							
						
					
					
						commit
						bcff586ee5
					
				|  | @ -6,6 +6,7 @@ import logging | ||||||
| 
 | 
 | ||||||
| import requests | import requests | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| logger = logging.getLogger(__name__) | logger = logging.getLogger(__name__) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -29,7 +30,7 @@ class YouTubeTranscriptApi(): | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     @staticmethod |     @staticmethod | ||||||
|     def get_transcripts(*video_ids, continue_after_error=False): |     def get_transcripts(video_ids, continue_after_error=False): | ||||||
|         """ |         """ | ||||||
|         Retrieves the transcripts for a list of videos. |         Retrieves the transcripts for a list of videos. | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| #!./.venv/bin/python | #!/usr/bin/python | ||||||
| 
 | 
 | ||||||
| import sys | import sys | ||||||
| 
 | 
 | ||||||
|  | @ -6,11 +6,15 @@ import json | ||||||
| 
 | 
 | ||||||
| from pprint import pprint | from pprint import pprint | ||||||
| 
 | 
 | ||||||
|  | import logging | ||||||
|  | 
 | ||||||
| from src.transcript_api import YouTubeTranscriptApi | from src.transcript_api import YouTubeTranscriptApi | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| if __name__ == '__main__': | if __name__ == '__main__': | ||||||
|  |     logging.basicConfig() | ||||||
|  | 
 | ||||||
|     if sys.argv[1] == '--json': |     if sys.argv[1] == '--json': | ||||||
|         print(json.dumps(YouTubeTranscriptApi.get_transcripts(*sys.argv[2:], continue_after_error=True)[0])) |         print(json.dumps(YouTubeTranscriptApi.get_transcripts(sys.argv[2:], continue_after_error=True)[0])) | ||||||
|     else: |     else: | ||||||
|         pprint(YouTubeTranscriptApi.get_transcripts(*sys.argv[1:], continue_after_error=True)[0]) |         pprint(YouTubeTranscriptApi.get_transcripts(sys.argv[1:], continue_after_error=True)[0]) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue