Skip to main content

A small example package

Project description

Snowfl API Python Wrapper

This is an unofficial Python wrapper for the Snowfl API, inspired by the work of c0dysharma. Snowfl is a platform for searching and accessing torrent files. With this wrapper, you can programmatically search for torrents based on your queries and preferences.

Installation

To use this Snowfl API Python wrapper, you can install it using pip:

pip install snowfl

Usage

Initializing Snowfl

Before making API requests, you need to initialize the Snowfl instance by fetching the API key. This key is required to access the Snowfl API.

from snowfl import Snowfl, ApiError, FetchError

snowfl = Snowfl()
try:
    snowfl.initialize()
except ApiError as e:
    print(f"Error initializing Snowfl: {e}")

Searching Snowfl

You can use the parse method to search the Snowfl site for torrents. You need to provide a search query, and you can optionally specify various parameters to customize your search.

from pprint import pprint


try:
    query = "JoJo"
    sort = "MAX_SEED"  # Sorting by maximum seeders
    include_nsfw = False  # Exclude NSFW content

    result = snowfl.parse(query, sort=sort, include_nsfw=include_nsfw)
    pprint(result)
except FetchError as e:
    print(f"Error searching Snowfl: {e}")

Configuration

You can customize your search by specifying the following parameters:

  • query: The search query you want to use.
  • sort: Sorting method for the search results. Available options:
    • MAX_SEED: Sort by decreasing number of seed counts (default).
    • MAX_LEECH: Sort by decreasing number of leech counts.
    • SIZE_ASC: Sort by increasing size per file.
    • SIZE_DSC: Sort by decreasing size per file.
    • RECENT: Sort by recent torrents first.
    • NONE: No sorting (Snowfl default).
  • include_nsfw: Include NSFW (Not Safe For Work) content in the search results. Set to True to include NSFW content; False by default.

Return Value

The parse method returns a dictionary with the following structure:

{
    "status": <HTTP status code>,
    "message": <status message>,
    "data": [<array of objects>]
}

Example Responses

Found Something

{
    "status": 200,
    "message": "OK",
    "data": [
        {
            "magnet": "magnet:?xt=urn:btih:F3B5014A2E048E9286163B3A6A9D95942F3D8F3B&tr=udp%3A%2F%2Ftracker",
            "age": "12 months",
            "name": "John Coltrane - Ole Coltrane [V0](Big Papi) Jazz Music",
            "size": "86.92 MB",
            "seeder": 2,
            "leecher": 1,
            "type": "Music",
            "site": "****",
            "url": "https://www.*****.info/John-Coltrane--Ole-Coltrane-[V0](Big-Papi)-Jazz-Music-torrent-4500787.html",
            "trusted": False,
            "nsfw": False
        },
        {
            "magnet": "magnet:?xt=urn:btih:6f1fe981ab6624ef5c235278128c00d1c7ff534e&dn",
            "age": "6 years",
            "name": "John Newman Ft. Calvin Harris Ole MP3 Download, 2016",
            "size": "9.41 MB",
            "seeder": 1,
            "leecher": 0,
            "type": "Music",
            "site": "****",
            "url": "https://www.****.com/file/2742569/john-newman-ft.-calvin-harris-ole-mp3-download-2016/",
            "trusted": False,
            "nsfw": False
        }
    ]
}

Nothing Found

{
    "status": 200,
    "message": "OK",
    "data": []
}

Conclusion

This Python wrapper allows you to interact with the Snowfl API easily, making it convenient to search for torrents and customize your search preferences. Remember to handle exceptions and errors gracefully when using this wrapper in your applications.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

snowfl-0.0.1.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

snowfl-0.0.1-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file snowfl-0.0.1.tar.gz.

File metadata

  • Download URL: snowfl-0.0.1.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for snowfl-0.0.1.tar.gz
Algorithm Hash digest
SHA256 31527741fe5fd43f4f1987d46b5a0fc45415e43f3ee857847f363fec2b24a632
MD5 7a70963f1ce6815d26c78659d575bfd1
BLAKE2b-256 0275032f567674230c0d44ebc2f84450384da3cb44bb137ddcbffdd67bb7594f

See more details on using hashes here.

File details

Details for the file snowfl-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: snowfl-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for snowfl-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6e36be1b4ed6d272775858388178556d7229d287e54eb0db3c8375e62feae5a6
MD5 5aacd68e4e05a627cc0c997aa65ed812
BLAKE2b-256 59b3092d4ef1d33c7f475819e2ef8582f27463958369cc92d9ff34e42eae2267

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page