fischcode commited on
Commit
ec0d6b8
·
1 Parent(s): deee280

Update parser.py

Browse files

Integrate fix from last PR

Files changed (1) hide show
  1. pytube/parser.py +1 -2
pytube/parser.py CHANGED
@@ -134,14 +134,13 @@ def parse_for_object_from_startpoint(html, start_point):
134
  full_obj = find_object_from_startpoint(html, start_point)
135
  try:
136
  return json.loads(full_obj)
137
- except Exception as e:
138
  try:
139
  return ast.literal_eval(full_obj)
140
  except (ValueError, SyntaxError):
141
  raise HTMLParseError('Could not parse object.')
142
 
143
 
144
-
145
  def throttling_array_split(js_array):
146
  """Parses the throttling array into a python list of strings.
147
 
 
134
  full_obj = find_object_from_startpoint(html, start_point)
135
  try:
136
  return json.loads(full_obj)
137
+ except json.decoder.JSONDecodeError:
138
  try:
139
  return ast.literal_eval(full_obj)
140
  except (ValueError, SyntaxError):
141
  raise HTMLParseError('Could not parse object.')
142
 
143
 
 
144
  def throttling_array_split(js_array):
145
  """Parses the throttling array into a python list of strings.
146