nficano commited on
Commit
822e0cb
·
1 Parent(s): 2ccdca5

fixed tests

Browse files
Files changed (1) hide show
  1. pytube/cipher.py +7 -6
pytube/cipher.py CHANGED
@@ -28,18 +28,19 @@ logger = logging.getLogger(__name__)
28
 
29
 
30
  def get_initial_function_name(js):
31
- """Extract the name of the function responsible for computing the
32
- signature.
33
 
34
  :param str js:
35
  The contents of the base.js asset file.
36
 
37
  """
38
  # c&&d.set("signature", EE(c));
39
- pattern = (
40
- r'\bc\s*&&\s*d\.set\([^,]+\s*,'
41
- r'\s*\([^)]*\)\s*\(\s*(?P<sig>[a-zA-Z0-9$]+)\('
42
- )
 
 
43
  logger.debug('finding initial function name')
44
  return regex_search(pattern, js, group=1)
45
 
 
28
 
29
 
30
  def get_initial_function_name(js):
31
+ """Extract the name of the function responsible for computing the signature.
 
32
 
33
  :param str js:
34
  The contents of the base.js asset file.
35
 
36
  """
37
  # c&&d.set("signature", EE(c));
38
+ pattern = [
39
+ r'yt\.akamaized\.net/\)\s*\|\|\s*'
40
+ r'.*?\s*c\s*&&\s*d\.set\([^,]+\s*,\s*(?P<sig>[a-zA-Z0-9$]+)\(',
41
+ r'\.sig\|\|(?P<sig>[a-zA-Z0-9$]+)\(',
42
+ r'\bc\s*&&\s*d\.set\([^,]+\s*,\s*(?P<sig>[a-zA-Z0-9$]+)\(',
43
+ ]
44
  logger.debug('finding initial function name')
45
  return regex_search(pattern, js, group=1)
46