nficano commited on
Commit
38a749a
·
1 Parent(s): 3ac8ea4

prevent error if no captions found

Browse files
Files changed (1) hide show
  1. pytube/__main__.py +2 -0
pytube/__main__.py CHANGED
@@ -163,6 +163,8 @@ class YouTube(object):
163
  self.fmt_streams.append(video)
164
 
165
  def initialize_caption_objects(self):
 
 
166
  caption_tracks = (
167
  self.player_config['args']
168
  ['player_response']
 
163
  self.fmt_streams.append(video)
164
 
165
  def initialize_caption_objects(self):
166
+ if 'captions' not in self.player_config['args']['player_response']:
167
+ return
168
  caption_tracks = (
169
  self.player_config['args']
170
  ['player_response']