nficano commited on
Commit
536d581
·
1 Parent(s): 68f06c1

lint + fixed tests

Browse files
Files changed (3) hide show
  1. pytube/cipher.py +6 -2
  2. pytube/helpers.py +2 -2
  3. tests/test_streams.py +0 -1
pytube/cipher.py CHANGED
@@ -35,8 +35,12 @@ def get_initial_function_name(js):
35
 
36
  """
37
  # c&&d.set("signature", EE(c));
38
- pattern = [r'yt\.akamaized\.net/\)\s*\|\|\s*.*?\s*c\s*&&\s*d\.set\([^,]+\s*,\s*(?P<sig>[a-zA-Z0-9$]+)\(',
39
- r'\.sig\|\|(?P<sig>[a-zA-Z0-9$]+)\(', r'\bc\s*&&\s*d\.set\([^,]+\s*,\s*(?P<sig>[a-zA-Z0-9$]+)\(']
 
 
 
 
40
  logger.debug('finding initial function name')
41
  return regex_search(pattern, js, group=1)
42
 
 
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
 
pytube/helpers.py CHANGED
@@ -38,7 +38,7 @@ def regex_search(pattern, string, groups=False, group=None, flags=0):
38
  if not results:
39
  raise RegexMatchError(
40
  'regex pattern ({pattern}) had zero matches'
41
- .format(pattern=p),
42
  )
43
  else:
44
  logger.debug(
@@ -62,7 +62,7 @@ def regex_search(pattern, string, groups=False, group=None, flags=0):
62
  if not results:
63
  raise RegexMatchError(
64
  'regex pattern ({pattern}) had zero matches'
65
- .format(pattern=pattern),
66
  )
67
  else:
68
  logger.debug(
 
38
  if not results:
39
  raise RegexMatchError(
40
  'regex pattern ({pattern}) had zero matches'
41
+ .format(pattern=p),
42
  )
43
  else:
44
  logger.debug(
 
62
  if not results:
63
  raise RegexMatchError(
64
  'regex pattern ({pattern}) had zero matches'
65
+ .format(pattern=pattern),
66
  )
67
  else:
68
  logger.debug(
tests/test_streams.py CHANGED
@@ -2,7 +2,6 @@
2
  import random
3
 
4
  import mock
5
- from pytest_mock import mocker
6
 
7
  from pytube import request
8
  from pytube import Stream
 
2
  import random
3
 
4
  import mock
 
5
 
6
  from pytube import request
7
  from pytube import Stream