Skip to main content

nndownload

PyPI

EN | JA | 中文

nndownload allows you to download videos, images, manga, and process other links from Niconico, formerly known as Nico Nico Douga. Unlike other existing downloaders, this program communicates wth DMC (Dwango Media Cluster) and Dwango Media Services (DMS) servers to ensure access to high quality videos.

Disclaimers

  • If you do not have a premium account, you may download low quality videos during economy mode hours (typically 12 PM - 2 AM JST) or during other periods of high traffic.
  • When downloading without a login (using -g/--no-login), some videos may not be available for download or may only be available in a lower quality. Certain premium videos, such as official anime, only support metadata and comments retrieval when logging in and specifying --skip-media (see #142 for more information).
  • Running multiple download sessions on the same connection may lead to temporary blocks or throttling.
  • These functions are not currently supported:
    • Downloading Niconama timeshifts
    • Downloading Seiga comments
    • Downloading channel blog comments

Features

  • Download videos with comments, thumbnails, and metadata
  • Download Seiga images and manga with metadata
  • Download channel videos or blogs with metadata
  • Download mylists
  • Download a user's videos, mylists, illustrations, or manga
  • Generate stream URLs for Niconama broadcasts
  • Download videos faster using multiple threads
  • Process lists of URLs from text files

Requirements

Python version

Python >=3.5.3

Dependencies

See requirements.txt. ffmpeg must also be available on your PATH when requesting videos.

Installation

pip install nndownload

Usage

CLI

usage: nndownload.py [options] input

positional arguments:
  input                 URLs or files

options:
  -h, --help            show this help message and exit
  -u EMAIL/TEL, --username EMAIL/TEL
                        account email address or telephone number (deprecated; use --cookies-from-browser or --session-cookie)
  -p PASSWORD, --password PASSWORD
                        account password (deprecated; use --cookies-from-browser or --session-cookie)
  --session-cookie COOKIE
                        user_session cookie value (string or filepath)
  --cookies-from-browser BROWSER[+KEYRING][:PROFILE][::CONTAINER]
                        browser session to load a user_session cookie from
  -n, --netrc           use .netrc authentication (deprecated; use --cookies-from-browser or --session-cookie)
  -q, --quiet           suppress output to console
  -l [PATH], --log [PATH]
                        log output to file
  -v, --version         show program's version number and exit

download options:
  -y PROXY, --proxy PROXY
                        HTTP or SOCKS proxy
  -o TEMPLATE, --output-path TEMPLATE
                        custom output path (see template options)
  -r N, --threads N     download videos using a specified number of threads
  -g, --no-login        create a download session without logging in
  -f, --force-high-quality
                        only download if the high quality video source is available
  -a, --add-metadata    add metadata to video file (MP4 only)
  -m, --dump-metadata   dump metadata to file
  -t, --download-thumbnail
                        download video thumbnail
  -c, --download-comments
                        download video comments
  --comments-limit N    number of comments to download per thread (default: 1000)
  --comments-from DATETIME_OR_TIMESTAMP
                        only download comments posted before a specified time:
                        - Unix timestamp (e.g., 1686787200)
                        - ISO 8601 date (e.g., '2023-06-15' → sets to 23:59:59)
                        - ISO 8601 datetime (e.g., '2023-06-15T14:30:00' or '2023-06-15 14:30:00')
  --all-comments        request all comments (ignores --comments-limit)
  -e, --english         request video on english site
  --chinese             request video on traditional chinese (taiwan) site
  -aq AUDIO_QUALITY, --audio-quality AUDIO_QUALITY
                        specify audio quality
  -vq VIDEO_QUALITY, --video-quality VIDEO_QUALITY
                        specify video quality
  -an, --no-audio       don't download audio
  -vn, --no-video       don't download video
  -Q, --list-qualities  list video and audio qualities with availability status
  -s, --skip-media      skip downloading media
  --break-on-existing   break after encountering an existing download
  --playlist-start N    specify the index to start a list of items from (begins at 0)
  --user-agent USER_AGENT
                        specify a custom user agent for the download session

Module

import nndownload

url = "https://www.nicovideo.jp/watch/sm35249846"
output_path = "/tmp/{id}.{ext}"
nndownload.execute("-g", "-o", output_path, url)

Custom Output Paths

Custom filepaths are constructed like standard Python template strings, e.g. {uploader} - {title}.{ext}. For Seiga manga, the output path should be the template for a chapter directory, e.g. {manga_id}\{id} - {title}. The available options are:

  • comment_count (videos, images, manga, articles)
  • description (videos, images, manga)
  • document_url (videos, images, manga, articles)
  • ext (videos, images, articles)
  • id (videos, images, manga, articles)
  • published (videos, images, manga, articles)
  • tags (videos, images, manga, articles)
  • title (videos, images, manga, articles)
  • uploader (videos, images, manga, articles)
  • uploader_id (videos, images, manga, articles)
  • url (videos, images)
  • view_count (videos, images, manga)
  • audio_quality (videos)
  • video_quality (videos)
  • article (articles)
  • blog_title (articles)
  • clip_count (images)
  • dms_video_uri (videos)
  • dms_audio_uri (videos)
  • duration (videos)
  • manga_id (manga)
  • manga_title (manga)
  • mylist_count (videos)
  • page_count (manga)
  • size_high (videos)
  • size_low (videos)
  • thread_id (videos)
  • thread_key (videos)
  • thread_params (videos)
  • thumbnail_url (videos)

After generating a stream URL, the program must be kept running to keep the stream active. mpv and streamlink are the best options for playing generated stream URLs. Other programs that use aggressive HLS caching and threading may also work.

mpv https://... streamlink https://... best

Known Bugs

  • Check open issues.

License

This project is licensed under the MIT License.

Metadata

Release files for nndownload 1.21

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nndownload 1.21
File Size Uploaded
nndownload-1.21.tar.gz 35.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nndownload 1.21
File Interpreter ABI Platform
nndownload-1.21-py3-none-any.whl Python 3 none any Details

Total release size: 69.1 kB

Release files / nndownload-1.21.tar.gz

Download URL nndownload-1.21.tar.gz
Size 35.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9963b81c621e9946e0277c3b60bfee736b11212c3165ec2dd643375be77daef8
BLAKE2b-256 checksum
How to use checksums
536c329bc5c24061ffaea7049eab2d426f042fa6d055c539f172b270748701b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / nndownload-1.21-py3-none-any.whl

Download URL nndownload-1.21-py3-none-any.whl
Size 33.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
491f717e30cddce3763519ba7d1728fbd274c8531d25dac2710ca5b4fe25492d
BLAKE2b-256 checksum
How to use checksums
52be151ba98dd6a22be20662eb38c9f3a10338568a3837f0b0ae6eb784725f09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.21 This release

2 release files

1.20

2 release files

1.19.2

2 release files

1.19.1

1 release file

1.19

2 release files

1.18

1 release file

1.17

1 release file

1.16.3

1 release file

1.16.2

1 release file

1.16.1

1 release file

1.16

1 release file

1.15

1 release file

1.14

1 release file

1.12.2

1 release file

1.12

1 release file

1.11.3

1 release file

1.11.2

1 release file

1.11

1 release file

1.9

1 release file

1.8.2

1 release file

1.8.1

1 release file

1.8

1 release file

1.7

1 release file

1.5

1 release file

1.4.2

1 release file

1.4.1

1 release file

1.3

1 release file

1.2

1 release file

1.1

1 release file

0.9

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page