Skip to content

Latest commit

 

History

History
85 lines (60 loc) · 2.44 KB

README.md

File metadata and controls

85 lines (60 loc) · 2.44 KB

python-nozomi

Build Status Codacy Badge Codacy Badge PyPI version Python version

nozomi.la API in Python.

Features

  • Retrieving media posts
  • Downloading media

Installation

$ pip install python-nozomi

Upgrade

$ pip install python-nozomi --upgrade

Example Usage

Retrieve and download a single post provided a URL

from pathlib import Path
from nozomi import api

url = 'https://nozomi.la/post/26905532.html#veigar'

# Retrieve post metadata using the URL
post = api.get_post(url)

# Download the post
api.download_media(post, Path.cwd())

Retrieve and download multiple posts provided a list of URLs

from pathlib import Path
from nozomi import api

urls = [
    'https://nozomi.la/post/26905532.html#veigar',
    "https://nozomi.la/post/26932594.html#cho'gath",
    'https://nozomi.la/post/25802243.html#nautilus'
]

# Retrieve all of the post metadata using the URLs
posts = api.get_posts(urls)

# Download the posts
for post in posts:
    api.download_media(post, Path.cwd())

Retrieve and download all posts containing certain tags

# The tags that the posts retrieved must contain
positive_tags = ['veigar', 'wallpaper']

# Gets all posts with the tags 'veigar', 'wallpaper'
for post in api.get_posts_with_tags(positive_tags):
    api.download_media(post, Path.cwd())

Retrieve all posts containing certain tags, ignoring blacklisted tags

# The blacklisted tags
negative_tags = ['chogath']

# Gets all posts with the tags 'veigar' and 'wallpaper' without the 'chogath' tag.
for post in api.get_posts_with_tags(positive_tags, negative_tags):
    api.download_media(post, Path.cwd())