Giter Club home page Giter Club logo

nndownload's People

Contributors

alexaplin avatar cxwudi avatar dazeemdas avatar fireattack avatar h4m5ter avatar jaeseopark avatar kagekiyo7 avatar myl7 avatar senneh avatar stakayama avatar taizoayase avatar vineballoon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

nndownload's Issues

Download comments

Retrieve serverUrl from the thread object in data-api-data, which should usually be http://nmsg.nicovideo.jp/api/. POST the default thread ID:

<packet><thread thread="[id]" version="20061206" res_from="-1000" scores="1"/></packet>

This returns an XML document that can be converted to .ass with danmaku2ass.

Custom filename formatting

Allow filenames to be populated with metadata, e.g. -f [%user% (%id%)] %video_id% - %title% (%date%).

Prevent mixing of video qualities on resuming downloads

Having downloaded files without the --force-high-quality during economy hours and then firing up the script with the flag --force-high-quality causes the file to be resumed: "Resuming previous download."

Resulting in "broken" file. The previous, low quality, video can still be played, but other data is lost.

Expected behaviour:
Upon detection of higher quality, the lower quality should be moved or replaced by the newer/better file.

Does not fail gracefully with live URL

After I logged in withpython nndownload.py -u [username] -p [password] -o [output directory] [url], it just showed

Logging in...
Logged in.

and nothing comes out and seems the recorder doesn't work.

After I deleted the -o segement, it comes error like

Traceback (most recent call last):
  File "nndownload.py", line 713, in main
    process_url_mo(session, url_mo)
  File "nndownload.py", line 678, in process_url_mo
    request_rtmp(session, url_id)
  File "nndownload.py", line 176, in request_rtmp
    urls = urllib.parse.unquote(nama_info.getElementsByTagName("contents")[0].firstChild.nodeValue).split(",")
IndexError: list index out of range

How to fix this?

Owner field in video parameters can be null

On at least one video, the script is throwing an error when trying to get uploader and uploader_id here:

        template_params["uploader"] = params["owner"]["nickname"].strip(" さん")
        template_params["uploader_id"] = int(params["owner"]["id"])

It appears that the video has no "owner".

I've modified the script so that section reads:

        if params["owner"]:
            template_params["uploader"] = params["owner"]["nickname"].strip(" さん")
            template_params["uploader_id"] = int(params["owner"]["id"])
        else:
            template_params["uploader"] = ""
            template_params["uploader_id"] = 0

Which seems to solve the issue. Not sure if this can occur in videoDetail (why is that not mutually exclusive with video?)

Also, that strip() is potentially destructive if the nickname has さ or ん at the beginning or end of their real nickname.

Multi-threaded downloading

Because nicovideo is a paid member, single-threaded speed limit, but if you use multi-threading, you can achieve very fast speed.

On error return code 0

Whenever the script meets an exception and exits, the script exits with return code 0.
Example:

...
requests.exceptions.HTTPError: 404 Client Error: Not Found for url:
$ echo $?
0

Expected: Return code 1

Download fails if ID is so.

Python nndownload.py -c -f -u MailAddress -p Password http://www.nicovideo.jp/watch/so22958427

Logging in...
Logged in.
Traceback (most recent call last):
  File "C:\Software\nndownload\nndownload.py", line 697, in main
    process_url_mo(session, url_mo)
  File "C:\Software\nndownload\nndownload.py", line 654, in process_url_mo
    request_video(session, url_id)
  File "C:\Software\nndownload\nndownload.py", line 222, in request_video
    template_params = perform_api_request(session, document)
  File "C:\Software\nndownload\nndownload.py", line 585, in perform_api_request
    template_params = collect_parameters(template_params, params)
  File "C:\Software\nndownload\nndownload.py", line 623, in collect_parameters
    template_params["uploader"] = params["uploaderInfo"]["nickname"].rstrip(" さん") if params["uploaderInfo"] else None
KeyError: 'uploaderInfo'

Flag for only downloading metadata

If I wish to download only the metadata of a niconico video, I have to download the entire video and then delete it afterwards. For some videos this can be very time-consuming, so preferably there should be an argument flag that skips downloading the video.

Maybe something like --no-video or --only-metadata

Filename sanitation

Illegal path characters in the title or username are not substituted or removed and will cause an exception on write.

IndexError: list index out of range

I download this manga get this issue.

nndownload.py https://seiga.nicovideo.jp/comic/33772
Logging in...
Logged in.
Downloading comic 33772...
1/17
Traceback (most recent call last):
File "D:\C_Drive\Users\usr\AppData\local\Programs\Python\Python37-32\Scripts\nndownload.py", line 1330, in
main()
File "D:\C_Drive\Users\usr\AppData\local\Programs\Python\Python37-32\Scripts\nndownload.py", line 1318, in main
process_url_mo(session, url_mo)
File "D:\C_Drive\Users\usr\AppData\local\Programs\Python\Python37-32\Scripts\nndownload.py", line 1280, in process_url_mo
download_manga(session, url_id)
File "D:\C_Drive\Users\usr\AppData\local\Programs\Python\Python37-32\Scripts\nndownload.py", line 564, in download_manga
download_manga_chapter(session, chapter_id)
File "D:\C_Drive\Users\usr\AppData\local\Programs\Python\Python37-32\Scripts\nndownload.py", line 510, in download_manga_chapter
template_params = collect_seiga_manga_parameters(document, template_params)
File "D:\C_Drive\Users\usr\AppData\local\Programs\Python\Python37-32\Scripts\nndownload.py", line 496, in collect_seiga_manga_parameters
template_params["uploader_id"] = SEIGA_USER_ID_RE.search(document.select("dd.user_name a")[0]["href"]).group(1)
IndexError: list index out of range

Use proxy for WSS

websockets doesn't currently support this, but it's pending inclusion upstream. There are hacky ways to include this. I'm not entirely sure how this affects region locked streams, but I was able to generate a working stream through a proxy.

Add CLI script to package

So after installing it from pip, users can call it globally as a CLI tool (if they added /Scripts/ to their path).

I'm not very familiar in this area but I think it should be something covered here.

Video page rate limiting

Restarting the script on user/mylist that has more than 50 entries, will cause the script to run into rate limit that is imposed on the video pages. The reported error is: requests.exceptions.HTTPError: 503 Server Error: Service Unavailable for url: https://www.nicovideo.jp/watch/sm...
The options used to run the script are: --dump-metadata --download-thumbnail --download-comments --force-high-quality

Example:
I archive a user that has exactly 50 entries. After all videos are archived, I restart the script with the same parameters.
Depending on the mood of NND after approximately 3 minutes and 30 second, and between fetching the 43rd-47th video, NND will respond with a 503 error.

The video page will be available after 30-60 seconds.

Suggestion:
If the script encounters a 503 error, catch that exception and wait 60 seconds before restarting the download, is possible multiple(3) retries.
Optionally, have a flag that allows to define wait time, otherwise a global variable that the user can edit inside the script.

Load login credentials from file

Add an option to load a user's credentials (username, password) from a file, rather than supplying them both on the commandline. This improves security on Linux, where command line arguments are visible to anyone who can view running processes; and also makes it slightly easier to use generated passwords.

RTMP deprecated for official streams

From what I've seen the nama API reports all RTMP stream URLS as invalid now. Channel and community streams continue to offer RTMP, likely for older devices, but on browsers the HLS stream is what's actually served.

Stream from experimental Niconama

http://site.nicovideo.jp/nicocas/pc/
https://live.nicovideo.jp/recent?tab=nicocas

Nico is experimenting with additional live features. As part of this, the live infrastructure seems to have moved to DMC.

Page URL: https://cas.nicovideo.jp/user/[user_id]/[live_id]
API root URL: https://api.cas.nicovideo.jp/v1/services/live/programs/[live_id]

  • OPTIONS /watching-qualities
    • GET /watching-qualities
      • Available qualities (superhigh, high, middle, low)
  • OPTIONS /watching
    • POST /watching
      • 201 Created
      • Program metadata, commenting WebScoket server and threads, master stream URL
    • PUT /watching
      • 200 OK
      • Stream URL

General flow seems to be:

  • OPTIONS to /watching-qualities

    • Access-Control-Request-Method: GET
    • Access-Control-Request-Headers: x-connection-environment,x-frontend-id
    • Origin: https://cas.nicovideo.jp
  • GET to /watching-qualities

    • X-Frontend-Id: 91
    • X-Connection-Environment: ethernet
  • OPTIONS to /watching

    • Access-Control-Request-Method: GET
    • Access-Control-Request-Headers: content-type,x-connection-environment,x-frontend-id
    • Origin: https://cas.nicovideo.jp
  • POST to /watching

  • PUT to /watching every 20 seconds

    • Master and playlist URLs will change and must be updated

Clean up NicoMovieMaker videos for external players

NicoMovieMaker videos (nm#) may not be viewable in an external player. Videos with still images (e.g. nm11960162) will play fine with a pass through ffmpeg. Slideshows and GIFs (e.g. nm2829323) may play with improper frame timings or loops. Flash animations (e.g. nm4809023) will likely not play at all and may require other libraries or solutions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.