3.2 KiB
Logs into Nebula as the configured user, fetches available videos, and generates an RSS feed. No feed will be generated, if less than feed_cache_time_seconds seconds (set in config.json) have elapsed since last running this script.
Requirements
The following are needed to run this script:
- Python, version 3.8 to 3.10: I have tested 3.8.10 and 3.10.0. Older versions might work, but 3.6 is a hard minimum
- Firefox: It should be fairly easy to switch to Chrome instead,
nebula_loader.py
has a few references to Firefox which one would need to alter - Geckodriver is needed to remote-control Firefox. The executable should be in your path, it's possible to specify the path to the binary in the config file. Replace with ChromeDriver for Chrome
- Poetry: Not a hard requirement, I have included a requirements.txt which can be used to install dependencies with
pip install -r requirements.txt
. I haven't tested this, and the list is auto-generated by poetry, using python 3.10
Installation
- Download or clone the repository.
- If you are using poetry, run
poetry install
in thenebula-rss
directory. - If you are not using poetry, run
pip install -r requirements.txt
. If that doesn't work, try manually installing the dependencies listed inpyproject.toml
- Copy
config_default.json
toconfig.json
Usage
This assume you are inside the folder nebula-rss
.
First, configure your username and password in config.json
. You should also set your feed url and possibly adjust the path to the output file which will be generated.
Run poetry run python main.py
to generate your feed. Alternatively, run chmod +x ./main.py
to mark it as executable and then run poetry run ./main.py
.
If you a not using poetry, run python main.py
directly, or mark main.py
as executable and run ./main.py
.
You will likely want to run the script regularly, to update the feed. I'm using the following crontab * 0 * * * cd $HOME/nebula-rss; $HOME/.local/bin/poetry run ./main.py
, so that it runs once an hour.
I have not tested this on windows, but it should work without issues.
Notes
This is an extremely hacky solution and basically loads the Nebula homepage, logs in, goes to "My Library" and loads the list of videos. Naturally, this may break at any time, e.g. every time Nebula changes their layout slightly. Right after finishing this, I found a way to directly load the list of videos:
curl 'https://content.watchnebula.com/library/video/?page=1' \
-X 'GET' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Origin: https://nebula.app' \
-H 'Referer: https://nebula.app/' \
-H 'Accept-Language: en-GB,en;q=0.9' \
-H 'Host: content.watchnebula.com' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.2 Safari/605.1.15' \
-H 'Authorization: Bearer ADD_TOKEN_HERE' \
-H 'Connection: keep-alive' \
-H 'Nebula-Platform: web'
When I get around to implementing this (that is: logging in, reading the authorisation token, and then parsing the result) I might switch to this instead, should be more stable.