AlexAplin / nndownload

Download and process links from Niconico (nicovideo.jp)
MIT License
213 stars 28 forks source link

Need a good explanation to ELI5 #138

Closed Floydandsome closed 7 months ago

Floydandsome commented 7 months ago

I've been trying this for the past few hours I have installed all the dependencies and requirement to launch this script however when I tried load the script it just pops up a notepad like this:

!C:\Users\user\AppData\Local\Programs\Python\Python310\python.exe

-- coding: utf-8 --

"""Download videos and process other links from Niconico (nicovideo.jp).""" import argparse import asyncio import collections import getpass import json import logging import math import mimetypes import netrc import os import re import sys import threading import time import traceback import xml.dom.minidom from typing import AnyStr, List, Match

import aiohttp import requests from aiohttp_socks import ProxyConnector from bs4 import BeautifulSoup from mutagen.mp4 import MP4, MP4StreamInfoError from requests.adapters import HTTPAdapter from requests.utils import add_dict_to_cookiejar from urllib3.util import Retry

version = "1.14" author = "Alex Aplin" copyright = "Copyright 2023 Alex Aplin" license = "MIT"

MODULE_NAME = "nndownload" HOST = "nicovideo.jp"

MY_URL = "https://www.nicovideo.jp/my"

LOGIN_URL = "https://account.nicovideo.jp/api/v1/login?site=niconico"

LOGIN_URL = "https://account.nicovideo.jp/login/redirector?show_button_twitter=1&site=niconico&show_button_facebook=1&sec=header_pc&next_url=/" VIDEO_URL = "https://nicovideo.jp/watch/{0}" NAMA_URL = "https://live.nicovideo.jp/watch/{0}" SERIES_URL = "https://www.nicovideo.jp/series/{0}" CHANNEL_VIDEOS_URL = "https://ch.nicovideo.jp/{0}/video?page={1}" CHANNEL_LIVES_URL = "https://ch.nicovideo.jp/{0}/live?page={1}" CHANNEL_BLOMAGA_URL = "https://ch.nicovideo.jp/{0}/blomaga?page={1}" CHANNEL_ARTICLE_URL = "https://ch.nicovideo.jp/article/{0}" SEIGA_USER_ILLUST_URL = "https://seiga.nicovideo.jp/user/illust/{0}?page={1}" SEIGA_USER_MANGA_URL = "https://seiga.nicovideo.jp/manga/list?user_id={0}&page={1}" # Not all manga are not listed with /user/manga/{0} SEIGA_IMAGE_URL = "https://seiga.nicovideo.jp/seiga/{0}" SEIGA_MANGA_URL = "https://seiga.nicovideo.jp/comic/{0}" SEIGA_CHAPTER_URL = "https://seiga.nicovideo.jp/watch/{0}" SEIGA_SOURCE_URL = "https://seiga.nicovideo.jp/image/source/{0}" SEIGA_CDN_URL = "https://lohas.nicoseiga.jp/" TIMESHIFT_USE_URL = "https://live.nicovideo.jp/api/timeshift.ticket.use" TIMESHIFT_RESERVE_URL = "https://live.nicovideo.jp/api/timeshift.reservations"

CONTENT_TYPE = r"(watch|mylist|user\/illust|user\/manga|user|comic|seiga|gate|article|channel|manga|illust|series)" VALID_URL_RE = re.compile(r"https?://(?:(?:(?:(ch|sp|www|seiga).)|(?:(live[0-9]?|cas).))?" rf"(?:(?:nicovideo.jp/{CONTENT_TYPE}?)(?(3)/|))|(nico.ms)/)" r"((?:(?:[a-z]{2})?\d+)|[a-zA-Z0-9-]+?)/?(?:/(video|mylist|live|blomaga|list))?" r"(?(6)/((?:[a-z]{2})?\d+))?(?:\?(?:user_id=(.)|.)?)?$") M3U8_STREAM_RE = re.compile(r"(?:(?:#EXT-X-STREAM-INF)|#EXT-X-I-FRAME-STREAM-INF):.(?:BANDWIDTH=(\d+)).\n(.*)") SEIGA_DRM_KEY_RE = re.compile(r"/image/([a-z0-9]+)") SEIGA_USER_ID_RE = re.compile(r"user_id=(\d+)") SEIGA_MANGA_ID_RE = re.compile(r"/comic/(\d+)")

THUMB_INFO_API = "http://ext.nicovideo.jp/api/getthumbinfo/{0}" MYLIST_API = "https://nvapi.nicovideo.jp/v2/mylists/{0}?pageSize=500" # 500 video limit for premium mylists USER_VIDEOS_API = "https://nvapi.nicovideo.jp/v1/users/{0}/videos?sortKey=registeredAt&sortOrder=desc&pageSize={1}&page={2}" USER_MYLISTS_API = "https://nvapi.nicovideo.jp/v1/users/{0}/mylists" SEIGA_MANGA_TAGS_API = "https://seiga.nicovideo.jp/ajax/manga/tag/list?id={0}" COMMENTS_API = "https://nvcomment.nicovideo.jp/v1/threads" COMMENTS_API_POST_DATA = "{{\'params\':{0},\'threadKey\':\'{1}\',\'additionals\':{{}}}}"

REGION_LOCK_ERROR = "お住まいの地域・国からは視聴することができません。"

USER_VIDEOS_API_N = 25 NAMA_HEARTBEAT_INTERVAL_S = 30 NAMA_PLAYLIST_INTERVAL_S = 5 DMC_HEARTBEAT_INTERVAL_S = 15 KILOBYTE = 1024 KILOBIT = 1000 BLOCK_SIZE = 1024 EPSILON = 0.0001 RETRY_ATTEMPTS = 5 BACKOFF_FACTOR = 2 # retry_timeout_s = BACKOFF_FACTOR * (2 ** ({RETRY_ATTEMPTS} - 1))

MIMETYPES = {

AlexAplin commented 7 months ago

This is a command line intrerface (CLI) program. You need to install Python to use the script or use the binaries on the releases page if you are Windows. You can find guides on using command line programs if you search around a little.