File size: 584 Bytes
134b939
 
82321d6
 
134b939
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env python3

# flake8: noqa: E402

from os import path
import sys
import json

currentdir = path.dirname(path.realpath(__file__))
parentdir = path.dirname(currentdir)
sys.path.append(parentdir)

from pytube import YouTube

yt = YouTube(sys.argv[1], defer_prefetch_init=True)
yt.prefetch()
output = {
    "url": sys.argv[1],
    "watch_html": yt.watch_html,
    "video_info": yt.vid_info,
    "js": yt.js,
}

outpath = path.join(currentdir, "mocks", "yt-video-" + yt.video_id + ".json")
print("Writing to: " + outpath)
with open(outpath, "w") as f:
    json.dump(output, f)