Python OpenSubtitles.com API Wrapper
A Python wrapper for the OpenSubtitles REST API, providing easy access to subtitle data. This library allows you to interact with OpenSubtitles.com programmatically, making it simple to search for and download subtitles for your favorite movies and TV shows.
Installation
You can install the package using pip directly from PyPI or by cloning the repository from GitHub.
Install from PyPI:
pip install opensubtitlescom
Install from GitHub (latest development version):
pip install git+ssh://git@github.com/dusking/opensubtitles-com.git --upgrade
Usage
Using this wrapper is straightforward. It follows the OpenSubtitles API documentation closely and converts responses into Python objects. Here's an example of how to use it:
from opensubtitlescom import OpenSubtitles
# Initialize the OpenSubtitles client
subtitles = OpenSubtitles(MY_API_KEY, "MyApp v1.0.0")
# Log in (retrieve auth token)
subtitles.login(MY_USERNAME, MY_PASSWORD)
# Search for subtitles
response = subtitles.search(query="breaking bad", season_number=1, episode_number=1, languages="en")
# Convert the response to a Python dictionary
response_dict = response.to_dict()
print(response_dict)
# Get first response subtitles
srt = subtitles.download_and_parse(response.data[0])
Here's another simple example:
# Get latest uploaded subtitles
latest_uploads = subtitles.discover_latest()
# Convert the response to a Python dictionary
latest_uploads_dict = latest_uploads.to_dict()
For more information on available methods and options, refer to the OpenSubtitles API documentation.
Running Tests
To execute the unit tests, use the following command:
$ python -m unittest
Make sure you have the necessary dependencies installed and a valid Python environment set up before running the tests.
Contributing
Contributions to this project are welcome. If you'd like to contribute, please follow these guidelines:
- Open an issue to discuss your proposed changes before submitting a pull request.
- Ensure that your code adheres to the project's coding standards.
- Write tests for your code and make sure existing tests pass.
- Document your changes thoroughly, including updating this README if necessary.
Thank you for your interest in improving this project!
Metadata
Release files for opensubtitlescom 0.1.0
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 |
|---|---|---|---|---|
| opensubtitlescom-0.1.0.tar.gz | 22.5 kB | Without provenance | Details for opensubtitlescom-0.1.0.tar.gz |
Release files / opensubtitlescom-0.1.0.tar.gz
| Download URL | opensubtitlescom-0.1.0.tar.gz |
|---|---|
| Size | 22.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ef478fc823d442057c60f212980eb085a48c774b7ed0964e5fc8cc58ed3702b5
|
|
BLAKE2b-256 checksum How to use checksums |
96c7bb436c5fad32b6ffdce9fd2f807e5adb1bb5cf611a5a0fa497279eca9d63
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.13
|
Security for opensubtitlescom 0.1.0
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.