Skip to content

Add YouTube as a platform#52

Open
serrebidev wants to merge 2 commits into
masonasons:masterfrom
serrebidev:add-youtube-platform
Open

Add YouTube as a platform#52
serrebidev wants to merge 2 commits into
masonasons:masterfrom
serrebidev:add-youtube-platform

Conversation

@serrebidev

Copy link
Copy Markdown

Hi! First off — I love FastSM. It's become my daily driver, and I really appreciate the work you put into it.

Since YouTube keeps drifting more and more toward being a social network (subscriptions, community posts, comments, likes), I thought I'd take a shot at adding it as a platform alongside Mastodon and Bluesky. Totally understand if it's not a direction you want to take the app — no hard feelings if you'd rather not merge it.

What this adds

  • OAuth 2.0 login using Google's installed-app (loopback) flow — browser consent once, then a long-lived refresh token is persisted and silently refreshed.
  • YouTube Data API v3: account identity, subscriptions, likes/ratings, subscribe/unsubscribe, comments.
  • InnerTube for search and the recommendations/home feed (the parts the official API doesn't expose).
  • A per-account Templates tab with a $description$ placeholder so YouTube posts render the way you want (default shows title + author; description is opt-in).
  • Platform-select wiring (radio button in the add-account dialog) and PyInstaller build support for the lazy-imported Google libraries.

Credentials / security

No secrets are committed. The OAuth client secret lives in platforms/youtube/client_secret.json, which is git-ignored. The bundled client constants in oauth.py are intentionally left empty for you to fill in with a verified FastSM Google client (or users can supply their own via prefs / a local client_secret.json). The one hardcoded key in innertube.py is the public InnerTube key the YouTube web player ships to everyone, not a personal credential.

Testing

I tested this end-to-end with a testing key (my own Google Cloud OAuth client) and it works — login, loading the account, subscriptions, search, and posting templates all function.

Happy to adjust anything or split it up if that's easier to review. Thanks for considering it!

serrebidev and others added 2 commits June 20, 2026 23:19
Adds a YouTube backend alongside Mastodon and Bluesky: OAuth 2.0 login
(Google installed-app loopback flow), identity/subscriptions/likes/
comments via the YouTube Data API v3, and search/recommendations via
InnerTube. Includes a per-account Templates tab with a $description$
placeholder, platform-select wiring, and PyInstaller build support.

The OAuth client secret is git-ignored (platforms/youtube/client_secret.json)
so no credentials are committed; the bundled client constants are left empty
for the maintainer to fill with a verified FastSM client.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Vendors the maintained youtube-search-python fork into
platforms/youtube/vendor/youtubesearchpython so YouTube search,
suggestions, and InnerTube metadata work without a PyPI dependency on
the unmaintained upstream release.

- A sys.path shim in platforms/youtube/__init__.py makes the vendored
  copy importable as the top-level `youtubesearchpython`, so existing
  imports work unchanged.
- requirements.txt drops the youtube-search-python pin and adds its one
  runtime dependency, httpx.
- build.py bundles the vendor tree (+ collect-all httpx) and adds the
  hidden imports PyInstaller can't trace through the runtime shim.
- Upstream MIT LICENSE and a vendor README (attribution + rationale)
  are included.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@serrebidev

Copy link
Copy Markdown
Author

Follow-up: I vendored the search backend so this doesn't depend on the unmaintained youtube-search-python on PyPI.

  • The maintained fork now lives at platforms/youtube/vendor/youtubesearchpython/ (26 source files, MIT — upstream LICENSE included, plus a vendor/README.md with attribution and the reason it's vendored: updated InnerTube clientVersion/renderer paths so search keeps working).
  • It's made importable as the top-level youtubesearchpython via a small sys.path shim in platforms/youtube/__init__.py, so the existing import youtubesearchpython calls work unchanged with no PyPI install.
  • requirements.txt drops the old pin and adds the library's one real runtime dep, httpx.
  • build.py bundles the vendor tree (--add-data + --collect-all httpx) and adds the hidden imports PyInstaller can't trace through the runtime shim.

I verified the import resolves to the vendored copy (v1.6.2) and loads cleanly. Happy to drop the vendoring and go back to a plain PyPI dependency instead if you'd prefer that — whatever's easier for you to maintain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant