Crates.io | filmweb-csv |
lib.rs | filmweb-csv |
version | 0.2.13 |
source | src |
created_at | 2024-12-02 21:39:05.258185 |
updated_at | 2024-12-09 12:50:19.882424 |
description | Effortless Filmweb data -> CSV fetching. |
homepage | |
repository | https://github.com/wedkarz02/filmweb-csv |
max_upload_size | |
id | 1469278 |
size | 79,027 |
filmweb-csv
🚀 Effortless Filmweb data ➔ CSV fetching 🚀
filmweb-csv
is a CLI application that allows users to effortlessly fetch their personal data from Filmweb (basically Polish IMDB, but with a cooler name) and export this data into CSV format for easy analysis or sharing.
Key features include:
Personally, I use it to generate histograms and analyze the statistical distribution of my movie ratings.
Disclaimer: The Filmweb API has not been officially released, therefore it's not at all documented and might change at any time, which could break this app. If you encounter any issues, feel free to open a Github Issue and I'll do my best to resolve them quickly.
→ Rust
→ Cargo
→ Filmweb account
This project was developed on the Ubuntu 20.04.6 operating system and will likely work on most Linux-based systems without issues. It should also work on Windows, but I haven't tested it. If you encounter any problems, feel free to open a Github Issue.
You can install the application by building it from source or by downloading it from crates.io. For the latter, use cargo
:
$ cargo install filmweb-csv
After installing from crates.io you can skip to the Getting Started section.
If you'd like to build from source - keep reading.
Download the source code using the git clone
command:
$ git clone https://github.com/wedkarz02/filmweb-csv.git
Or use the Download ZIP option from the Github repository page.
Build the application using cargo
in debug mode:
$ cargo build
or in release mode:
$ cargo build --release
It's up to you whether to build in debug or release mode. It doesn't really matter since the main bottleneck of the application is the API fetching. If you don't mind slightly longer compilation time, go for the release mode for some extra runtime performance.
The binary is self-contained so you can easily copy / move / symlink it from the target/
directory:
$ cp ./target/release/filmweb-csv ~/.local/bin
$ mv ./target/release/filmweb-csv ~/.local/bin
$ ln ./target/release/filmweb-csv ~/.local/bin
This app requires you to authenticate via an API that unfortunately doesn't have a documented login process. To work around this, you need to get the 'Cookie' header, which is generated when you log into Filmweb.
How to get the Cookie header:
F12
, Ctrl+Shift+I
or other shortcut depending on your browser.Network
tab and refresh the page.info
as the Name.Headers
tab and scroll down to the Request Headers
section.Cookie
parameter and copy it's value (without the Cookie: part, just the value). It will likely be very long, make sure it's all there.I haven't found an easier way of authenticating. I will automate this process if they decide to release the API officially in the future.
To run the application use cargo
or run the compiled executable directly:
$ cargo run -- [OPTIONS]
$ filmweb-csv [OPTIONS]
The app defaults to fetching rated movies if no options were given.
This is a full copy of a help message, which you can also get by using the --help
option:
$ filmweb-csv --help
Usage: filmweb-csv [OPTIONS]
Options:
--fetch <FETCH> Type of resource to fetch [default: movies] [possible values: movies, series, games]
--from <FROM> Fetch from rated or watchlist [default: rated] [possible values: rated, watchlist]
-o, --output <OUTPUT> Specify the output directory [default: ./exports/]
-v, --verbose Log more details to stdout
--cookie <COOKIE> Cookie header for authentication
--save-cookie Save the cookie header to ~/.filmweb-csv/credentials.txt
-h, --help Print help
-V, --version Print version
To authenticate the application client use the --cookie
option and paste the cookie header in single quotes:
$ filmweb-csv [OPTIONS] --cookie '<HEADER VALUE>'
Single quotes are important because tokens might contain special characters like double quotes, semicolons and spaces.
Optionally you can use the --save-cookie
flag to cache the tokens. That way you won't have to include the --cookie
every time:
$ filmweb-csv [OPTIONS] --cookie '<HEADER VALUE>' --save-cookie
Tokens are saved to ~/.filmweb-csv/credentials.txt
in plaintext and are valid for about 15 minutes.
Full list of fetching options (assuming ~/.filmweb-csv
has valid tokens):
# Get rated movies:
$ filmweb-csv --fetch movies --from rated
# Get watchlisted movies:
$ filmweb-csv --fetch movies --from watchlist
# Get rated series:
$ filmweb-csv --fetch series --from rated
# Get watchlisted series:
$ filmweb-csv --fetch series --from watchlist
# Get rated video games:
$ filmweb-csv --fetch games --from rated
# Get watchlisted video games:
$ filmweb-csv --fetch games --from watchlist
Optionally you can include an --output
or -o
option to specify the output directory:
# Save the output to "./data/movies_rated.csv":
$ filmweb-csv --fetch movies --from rated --output data
$ filmweb-csv --fetch movies --from rated -o data
The output path defaults to exports
if not provided.
To enable info logging use the --verbose
or -v
flag:
# Enable verbose logging to stdout:
$ filmweb-csv --fetch movies --from rated --verbose
Logging to stdout is disabled by default (except for error logs) but logging to a file is always on. Logs are saved in the ~/.filmweb-csv/logs/
directory.
If not directly stated otherwise, everything in this project is under the MIT License. See the LICENSE file for more info.