Alexander Czyrny
commited on
Regex optimizations for get_ytplayer_config (#800)
Browse files* Regex optimizations for get_ytplayer_config
See: https://github.com/nficano/pytube/issues/796
- pytube/extract.py +1 -3
pytube/extract.py
CHANGED
@@ -246,9 +246,7 @@ def get_ytplayer_config(html: str) -> Any:
|
|
246 |
"""
|
247 |
config_patterns = [
|
248 |
r";ytplayer\.config\s*=\s*({.*?});",
|
249 |
-
r"
|
250 |
-
r";yt\.setConfig\(\{'PLAYER_CONFIG':\s*({.*})}\);",
|
251 |
-
r";yt\.setConfig\(\{'PLAYER_CONFIG':\s*({.*})(,'EXPERIMENT_FLAGS'|;)", # noqa: E501
|
252 |
]
|
253 |
logger.debug("finding initial function name")
|
254 |
for pattern in config_patterns:
|
|
|
246 |
"""
|
247 |
config_patterns = [
|
248 |
r";ytplayer\.config\s*=\s*({.*?});",
|
249 |
+
r"yt\.setConfig\(.*'PLAYER_CONFIG':\s*({.+?})"
|
|
|
|
|
250 |
]
|
251 |
logger.debug("finding initial function name")
|
252 |
for pattern in config_patterns:
|