diff options
Diffstat (limited to '')
-rw-r--r-- | 2022/organizers-notebook/index.org | 66 |
1 files changed, 65 insertions, 1 deletions
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("""<<talk()>>""") +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("""<<talk()>>""") +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 |