]> git.gir.st - subscriptionfeed.git/blob - README.md
move test instance to subscriptions.gir.st:443
[subscriptionfeed.git] / README.md
1 # Unnamed Youtube Frontend
2
3 [rough functional overview diagram](https://app.diagrams.net/?lightbox=1&highlight=0000ff&edit=_blank&layers=1&nav=1&title=youtubefrontend6.drawio#R5Vxbc6M4Fv41rtl5cIo7%2BDGXds9U9dSmJg%2BzvS9dAmRQt4xYEIk9v34lLjZIckw6BkwmL0EHAeY737noSGJh3m93nzOQxn%2BQEOKFoYW7hfmwMAzd0j32j0v2lcTTrEoQZSisOx0FT%2BhvWAu1WlqgEOadjpQQTFHaFQYkSWBAOzKQZeSl221DcPepKYigJHgKAJalf6GQxvVbGO5R%2FhtEUdw8WXdW1ZktaDrXb5LHICQvLZH5aWHeZ4TQ6mi7u4eYg9fgUl23PnH28MMymNA%2BF2D76fOGuN%2B%2B%2Bl9X%2F%2F12%2F8eTHm2WtlPd5hngon7j%2BtfSfQNBRookhPwu2sK8e4kRhU8pCPjZF6Z0JovpFrOWzg43CON7gknG2glJWKe7EORxeTk%2FXz8OZhTuTr6IfoCH8QqSLaTZnnXZdalRM8qpmy9H9RhmLYtbqrGtWghqSkSHOx9RYwc1cG8AsblxCzMYMhbVTZLRmEQkAfjTUXrXRfXY5wshaY3Vd0jpvjYJUFDSRZqhle3%2FU19fNr7yxo3dNB927ZMP%2B7qVU5DRW24aRxWVsjXir11fETY9AgzyHAWVsO5yVCR%2Fz9fVyGAhRRbAV%2FBr7BpkEaSv9bPVvMggBhQ9d3%2BISsvlpezFwL7VISUooXnrzo9c0KKb1%2BWbXdv%2BkTHVHY%2F8Ofy0n6eULpklJswpcUcKKPBBDiXKMf%2BS8kPeIackg%2BeN9RLGaHfRMT3ZHB2FNTpDGaO5mtYYb2y7a4%2BrcwZZth5hhhgAMLtaKzV7WukkRmo2YbehoSkEQ6G%2F49qv9R%2FGqE1FrHUw5SESPbPDiB%2FePv7eSNlDWicUfQMQxPBU7xPuIdhjxLienfcOfmUUX%2FyDA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a work in progress, still unreleased software. Feel free to look around, but keep in mind it's not finished yet.
6
7 Contributors wanted! Please send me an email (see commit log) or contact `girst` on irc.freenode.net (hanging out in `#invidious` for now)
8
9 Test Instance: [https://subscriptions.gir.st/](https://subscriptions.gir.st/)
10
11 TODO:
12 - task queue for refesh-cipher, pull-subs, update-websub
13 - should handle delays itself
14 - would allow us to just put a websub/pullsub request into the queue
15 whenever a user subscribes to a channel, without worrying about
16 ratelimiting ourselves.
17 - webhook: as blueprint; main app looks in envvar/config what to load?
18 - abstract database access
19 we want to be able to choose between at least sqlite and postgres
20 - implement 'dangerous' functions as disablable blueprint
21 - search through invidious-api
22 - proxy for hls/dash manifests, ...
23 - hls.js for livestreams
24 - proxy for geolocked videos?
25 - document all the things
26 - quality of life improvements:
27 - asynchronically call update-subs and pull-subs on subscribing, iff necessary
28 - development-friendly error handling:
29 - log unkown info/endcards to file
30 - proper support for sponsorblock (cached db?)
31 (blocked on https://github.com/ajayyy/SponsorBlockServer/pull/86)
32 - cleanups:
33 - move subsystem-specific stuff out of common/common.py (e.g. reddit)
34 - remove jsonify()
35 - purge magic strings (e.g guest token)
36 - fix all the TODOs and XXXs
37 - clean up login stuff
38 https://flask-login.readthedocs.io/en/latest/
39 https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-v-user-logins
40 - jinja2: for/else
41 - welcome message: maybe make dismissable, show on all pages?
42 - find a name!
43 - /channel/UE.../videos 404s
44 - invidious search: api returns 'nice' author strings (e.g. numberphile instead of UC...)
45 if not channel_id.match(...): redirect('/user/...') (in invidious blueprint)
46
47 stuff to look at:
48 - app.config.from_pyfile('the-config.cfg')
49 NOTE: this will not work for the non-python/non-flask parts
50
51 wishlist:
52 - proxy googlevideo (and probably thumnails) responses
53
54 # Installation
55
56 see INSTALL file
57
58 # Non-Features
59
60 - no algorithmically determined video recommendations: Find additional content through Youtube search, endcards or Reddit
61 - no youtube comments
62
63 # Notes
64 - caching external api requests
65 currently using in-memory-backend, which is purged every 10minutes. a real installation should use redis, which should scale better and handle purging for us.
66 the in-memory cache conflicts with gunicorn's worker model: which is a sepreate process for each request. switch to mulitple gthreads on a single worker to avoid getting the cache torn down after every request (note that threads may leak memory, if my observations from $dayjob are still valid).
67 - neater sqlite output:
68 .mode column
69 .headers on
70
71 # Advanced Topics
72
73 ## Extending Unnamed Youtube Frontend
74
75 UYtF is trivially extensible using [Flask Blueprints]. Just drop a new
76 blueprint in `app/` and register it in the `[frontend]modules` section of
77 `config.ini`. The Blueprint inside a module is expected to be named `frontend`.
78
79 The default `youtube` blueprint provides unblockable but minimal versions of
80 the /channel and /playlist endpoints. A custom blueprint (or, as an example,
81 the `invidious` blueprint) can overwrite existing routes by being listed before
82 the one to be overridden in `config.ini`.
83 A blueprint may also delegate a request to another (lower precedence) blueprint
84 using `return fallback_route(*args, **kwargs)`. This can be useful if the
85 endpoint might not be as reliable (e.g. invidious-api being blocked)
86
87 [Flask Blueprints]: https://flask.palletsprojects.com/en/1.1.x/blueprints/
88
89 ## Guest User
90
91 The guest user doesn't really exist; you can't log in as guest, and all guest
92 views are read-only. To modify the shown subscription feed, you'll have to
93 modify the database manually. To add a single channel, issuing
94 `INSERT INTO subscriptions (user, channel_id) VALUES ("guest", "UC...")`. To
95 load many at once, prepare a file (guest.csv) of channel ids
96 that looks like this:
97
98 UCxxxxxxxxxxxxxxxxxxxxxxxx,guest,channel
99
100 Then from the `sqlite3` console, issue:
101 .mode csv
102 .import guest.csv subscriptions
Imprint / Impressum