From 3dc716916a59aefdce062d87cd8240841f42b244 Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Wed, 21 Dec 2022 10:37:59 -0500 Subject: Automated commit --- 2022/organizers-notebook/index.org | 66 +++++++++++++++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) (limited to '2022/organizers-notebook') diff --git a/2022/organizers-notebook/index.org b/2022/organizers-notebook/index.org index d9f82800..2e8b8a76 100644 --- a/2022/organizers-notebook/index.org +++ b/2022/organizers-notebook/index.org @@ -821,10 +821,14 @@ page.goto("https://studio.youtube.com/") Save the cookies after it's all set up -#+begin_src python :dir "/home/sacha/proj/plays" :session plays +#+begin_src python :dir "/home/sacha/proj/plays" :session plays Path("cookies.json").write_text(json.dumps(cookies)) #+end_src +#+RESULTS: +:results: +:end: + #+begin_src python :dir "/home/sacha/proj/plays" :session plays context.add_cookies(json.loads(Path("cookies.json").read_text())) page.goto("https://studio.youtube.com/channel/UCwuyodzTl_KdEKNuJmeo99A") @@ -926,6 +930,66 @@ SCHEDULED: <2022-12-20 Tue> :CREATED: [2022-12-15 Thu 22:05] :END: +*** DONE Add maint chapter markers to Toobnix and Youtube, automate it +:PROPERTIES: +:CREATED: [2022-12-21 Wed 09:45] +:Effort: 1:00 +:QUANTIFIED: Emacs +:END: +:LOGBOOK: +- State "DONE" from "STARTED" [2022-12-21 Wed 10:30] +CLOCK: [2022-12-21 Wed 10:06]--[2022-12-21 Wed 10:30] => 0:24 +:END: + +#+NAME: answers-chapters +#+begin_src emacs-lisp +(setq talk (emacsconf-resolve-talk "maint")) +(replace-regexp-in-string + "\\\\" "\\\\\\\\" + (json-encode + (list + :qa-youtube (plist-get talk :qa-youtube) + :qa-toobnix (plist-get talk :qa-toobnix) + :slug (plist-get talk :slug) + :answers-description-youtube (emacsconf-publish-answers-description talk 'youtube) + :answers-description-toobnix (emacsconf-publish-answers-description talk 'youtube)))) +#+end_src + +Update YouTube + +#+begin_src python :dir "/home/sacha/proj/plays" :session plays :var talk_json=answers-chapters :noweb yes :results output +from playwright.sync_api import Playwright, sync_playwright, expect +from pathlib import Path +import json +import re + +talk = json.loads("""<>""") +playwright = sync_playwright().start() +browser = playwright.firefox.launch(headless=False) +context = browser.new_context() +page = context.new_page() +context.add_cookies(json.loads(Path("cookies.json").read_text())) +m = re.search("[^/=]+$", talk['qa-youtube']) +page.goto("https://studio.youtube.com/video/" + m.group(0) + "/edit") +page.locator("#description-textarea #textbox").fill(talk['answers-description-youtube']) + page.get_by_role('button', name="Save").click() +#+end_src + +Update Toobnix: + +#+begin_src python :dir "/home/sacha/proj/plays" :session plays :var talk_json=answers-chapters :noweb yes :results output +talk = json.loads("""<>""") +m = re.search("[^/=]+$", talk['qa-youtube']) +page.goto("https://toobnix.org/videos/update/" + m.group(0)) +page.locator("#description").fill(talk['answers-description-toobnix']) +page.locator('.orange-button').click() +#+end_src + + +#+RESULTS: +:results: +:end: + ** TODO Send thanks :PROPERTIES: :CUSTOM_ID: thanks -- cgit v1.2.3