Skip to content

Commit

Permalink
More debug in YouTubeVideoUrl
Browse files Browse the repository at this point in the history
force-test skip-release
  • Loading branch information
Taapat authored Feb 1, 2025
1 parent 8809149 commit 9cc86de
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/YouTubeVideoUrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,10 @@ def _extract_signature_timestamp(self):

def _extract_visitor_id(self, video_id):
webpage = self._download_webpage('https://www.youtube.com/watch?v=%s&bpctr=9999999999&has_verified=1' % video_id)
print('[YouTubeVideoUrl] extract_visitor_id')
if webpage:
ytcfg = search(r'ytcfg\.set\s*\(\s*({[^}]+})\s*\)\s*;', webpage)
print('[YouTubeVideoUrl] search webpage')
ytcfg = search(r'ytcfg\.set\s*\(\s*({.+?})\s*\)\s*;', webpage)
if ytcfg:
data = loads(ytcfg.group(1))
print('[YouTubeVideoUrl] visitor data0', data.get('VISITOR_DATA'))
Expand Down

0 comments on commit 9cc86de

Please sign in to comment.