Fix videoinfo.py
A bit ugly, but I couldn't solve it any other way. I'm bad with regex.
This commit is contained in:
committed by
GitHub
parent
78373bf45c
commit
96474f10c6
@@ -7,7 +7,7 @@ from ..util.extract_video_id import extract_video_id
|
||||
|
||||
headers = config.headers
|
||||
|
||||
pattern = re.compile(r"yt\.setConfig\({'PLAYER_CONFIG': ({.*})}\);")
|
||||
pattern = re.compile(r"'PLAYER_CONFIG': ({.*}}})")
|
||||
|
||||
item_channel_id = [
|
||||
"videoDetails",
|
||||
@@ -91,7 +91,8 @@ class VideoInfo:
|
||||
|
||||
def _parse(self, text):
|
||||
result = re.search(pattern, text)
|
||||
res = json.loads(result.group(1))
|
||||
result = result.group(1)[:-1]
|
||||
res = json.loads(result)
|
||||
response = self._get_item(res, item_response)
|
||||
if response is None:
|
||||
self._check_video_is_private(res.get("args"))
|
||||
|
||||
Reference in New Issue
Block a user