summary refs log tree commit diff
path: root/_.txt
diff options
context:
space:
mode:
Diffstat (limited to '_.txt')
-rw-r--r--_.txt19
1 files changed, 19 insertions, 0 deletions
diff --git a/_.txt b/_.txt
new file mode 100644
index 0000000..6737b50
--- /dev/null
+++ b/_.txt
@@ -0,0 +1,19 @@
+import urllib.request, json
+
+req = urllib.request.Request("https://www.youtube.com/youtubei/v1/player?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8")
+req.add_header("Content-Type", "application/json")
+j = json.loads(
+    urllib.request.urlopen(
+        req,
+        b'{"context":{"client":{"clientName":"TVHTML5_SIMPLY_EMBEDDED_PLAYER","clientVersion":"2.0"},"thirdParty":{"embedUrl":"https://www.youtube.com"}},"videoId": "VpGjqueO0b4"}',
+    )
+    .read()
+    .decode()
+)
+j = j["videoDetails"]
+print(
+    f'{j["title"]} ({j["lengthSeconds"]} sec), uploaded by {j["author"]}, {j["viewCount"]} views',
+    j["isCrawlable"],
+    j["isUnpluggedCorpus"],
+    j["isLiveContent"],
+)