Provenance: kanban t_02148213 (research) -> t_4265c369 (author) -> t_fefdf30b (review). Review verdict: APPROVED-WITH-FIXES, 7/7 checks PASS, 17/17 YouTube links oEmbed-verified, 26+ CLI commands re-run against v0.21.1, no Murray/JDS client data present. Artifact: deliverables/scot-hermes-playbook/HERMES-PLAYBOOK-FOR-SCOT.md 377 lines, sha256 b0966a649fec96da4975ec00e627fbaba3a92a62c4a92b33bc06589c47d25f7f Includes the research dossier and its raw verification evidence under research/. STATUS: written and reviewed, NOT delivered to the client. Delivery is gated on Kwame's approval and tracked as a separate blocked kanban card.
34 lines
1.5 KiB
Python
34 lines
1.5 KiB
Python
import json, subprocess, re
|
|
|
|
data = json.load(open("/home/hermes/syslog/drafts/scot-hermes-playbook/research/video-verification.json"))
|
|
have = {r["videoId"] for r in data}
|
|
extra = []
|
|
for v in ["8GjyOQy19so", "zwqhemjHq3E"]:
|
|
if v in have:
|
|
continue
|
|
url = f"https://www.youtube.com/watch?v={v}"
|
|
oe = subprocess.run(["curl", "-s", f"https://www.youtube.com/oembed?url={url}&format=json"],
|
|
capture_output=True, text=True, timeout=30)
|
|
try:
|
|
oej = json.loads(oe.stdout)
|
|
o = {"status": "PASS", "title": oej.get("title"), "author": oej.get("author_name")}
|
|
except Exception:
|
|
o = {"status": "FAIL", "raw": oe.stdout[:200]}
|
|
wp = subprocess.run(["curl", "-s", "-L", url,
|
|
"-H", "User-Agent: Mozilla/5.0 (Windows NT 10.0) Chrome/124.0",
|
|
"-H", "Accept-Language: en-US"], capture_output=True, text=True, timeout=30)
|
|
html = wp.stdout
|
|
pub = re.search(r'"publishDate":"([\d\-T:Z]+)"', html)
|
|
dur = re.search(r'"lengthSeconds":"(\d+)"', html)
|
|
views = re.search(r'"viewCount":"(\d+)"', html)
|
|
rec = {"videoId": v, "oembed": o,
|
|
"publishDate": pub.group(1) if pub else None,
|
|
"lengthSeconds": int(dur.group(1)) if dur else None,
|
|
"views": int(views.group(1)) if views else None}
|
|
extra.append(rec)
|
|
print(json.dumps(rec))
|
|
|
|
data.extend(extra)
|
|
json.dump(data, open("/home/hermes/syslog/drafts/scot-hermes-playbook/research/video-verification.json", "w"), indent=2)
|
|
print("total videos in ledger:", len(data))
|