scrapxd: The Library for Letterboxd Data
scrapxd is a Python library designed for web scraping, analyzing, and exporting data from Letterboxd, the social network for cinephiles. With an intuitive, strictly-typed API using Pydantic, scrapxd makes it easy to access user profiles, film lists, diaries, and much more.
Key Features
- Scrape Whatever You Need: Extract detailed data from user profiles, including watched films, ratings, diary entries, lists, followers, and more.
- Film Search: Search for films on Letterboxd based on various filters.
- Pydantic Data Models: All returned data is validated and structured into Pydantic models, ensuring consistency and ease of use in your code.
- Analytics Module: Perform statistical analysis on the collected data, such as correlations and trends (requires the
[analytics]extra). - Exporting Module: Export collected data to popular formats like CSV, JSON, and Excel (
.xlsx) (requires the[export]extra). - Retries Logic: Utilizes
tenacityfor automatic retries on network failures, making the scraping process more reliable. - Simple and Intuitive: Designed with a clean and easy-to-use API, as demonstrated in the examples.
Installation
You can install the library directly from PyPI.
Standard Installation:
Bash
pip install scrapxd
The library has optional dependencies for extra features. You can install them as needed:
For Data Analytics:
Bash
pip install "scrapxd[analytics]"
For File Exporting:
Bash
pip install "scrapxd[export]"
To Install Everything (including testing dependencies):
Bash
pip install "scrapxd[all]"
Quickstart
Using scrapxd is very simple. Here is a basic example to get a user's watched films:
Python
from scrapxd import Scrapxd
# 1. Create a client instance
client = Scrapxd()
# 2. Get data for a Letterboxd user
# The client handles searching and pagination automatically
user = client.get_user("your_username_here")
user_films = user.logs
# 3. Access the data
print(f"Total films watched by '{user_films.username}': {user_films.number_of_entries}")
# Each entry is a Pydantic object with structured data
for entry in user_films.entries[:5]: # Displaying the first 5
print(f"- {entry.film.title} ({entry.film.year}) - Rating: {entry.rating}")
# 4. (Optional) Export the data to an Excel file
try:
user_films.to_xlsx(f"{user_films.username}_films")
print(f"\nData exported to {user_films.username}_films.xlsx")
except ImportError:
print("\nTo export data, please install with: pip install \"scrapxd[export]\"")
Detailed Examples
For a more in-depth guide covering all features like profile analysis, comparisons, and advanced use cases, please explore the Jupyter notebooks in the /examples folder:
Contributing
Contributions are very welcome! If you have an idea for a new feature, find a bug, or want to improve the documentation, please open an Issue or submit a Pull Request.
License
This project is licensed under the MIT License. See the LICENSE file for more details.
Contact
Cauã Santos - My LinkedIn Profile - cauafsantosdev@gmail.com
GitHub URL: https://github.com/cauafsantosdev/scrapxd
Metadata
Release files for scrapxd 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| scrapxd-0.1.3.tar.gz | 44.4 kB | Without provenance | Details for scrapxd-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| scrapxd-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for scrapxd-0.1.3-py3-none-any.whl |
Total release size: 82.3 kB
Release files / scrapxd-0.1.3.tar.gz
| Download URL | scrapxd-0.1.3.tar.gz |
|---|---|
| Size | 44.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9efd0b9dca1f3178fcb8928d8f917eee60ff16ab81ebb2b4c3ee400c0130e627
|
|
BLAKE2b-256 checksum How to use checksums |
90990d2c6627e482a701120fdd9342993ebf3f2604c6f78c59418debdad3fcb3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / scrapxd-0.1.3-py3-none-any.whl
| Download URL | scrapxd-0.1.3-py3-none-any.whl |
|---|---|
| Size | 37.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4cd58e4edc0a2a2441d4fa568957152fb764b8d4cd1be701c90d38300410aedd
|
|
BLAKE2b-256 checksum How to use checksums |
74740f8ee38af6c9cd6341d9e59d87371f6c99c9f17630bea72a66817638e688
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Security for scrapxd 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.