Giter Club home page Giter Club logo

niconico.py's Introduction

PyPI PyPI - Python Version PyPI - Downloads PyPI - License Website

Test Test Test

niconico.py(β)

niconico.pyはニコニコにあるコンテンツを取得するためのPythonのライブラリです。
これを使うことでニコニコ動画の動画のダウンロードができます。
また、自分のアカウントを使用して動画情報の取得も可能です。

Warning!

ベータ版のため予期できない変更やバグがある可能性があります。

Installation

pipを使用してインストールすることができます。

pip install niconico.py

Example

ニコニコ動画

動画ダウンロード

from niconico import NicoNico

client = NicoNico()

with client.video.get_video("https://www.nicovideo.jp/watch/sm37658498") as video:
    video.download(f"{video.video.id}.mp4")

マイリスト取得

from niconico import NicoNico

URL = "https://www.nicovideo.jp/user/85641805/mylist/63403141"

client = NicoNico()
for mylist in client.video.get_mylist(URL):
    print(f"取り出したマイリスト: %s (%s)" % (mylist.name, mylist.id))

コンソールからの使用

niconico helpで使用方法を確認可能です。
注意:コマンドの使用方法は後日変更される予定です。

ToDo

  • 動画のダウンロード
  • マイリストの読み込み
  • 検索
  • ニコニコ大百科
  • ニコニコ静画
  • 非同期版 (できれば)
  • etc

Contributing

リポジトリ内のcontributing.mdをご覧ください。

License

MITライセンスの下で使用が可能です。

niconico.py's People

Contributors

github-actions[bot] avatar negima1072 avatar tasuren avatar tuna2134 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

Watchers

 avatar  avatar  avatar

niconico.py's Issues

[Feature] Add some authentication methods

Overview

Currently, the only account verification method for Nicovideo that can be used with this library is to read an externally generated cookie file. Therefore, we suggest adding multiple authentication methods to improve user accessibility.

Example of authentication method

  • By specifying the single "user_session" in the cookie as text.
  • By logging in by specifying your email address and password.

Obstacle

When authenticating with an email address and password, it is necessary to process when two-step verification is requested.

[Feature] Add a function to get the ranking on nicovideo

Overview

Since there is no function to get the ranking, add it

Tasks

  • Add ranking related objects
  • Add a function to get the ranking
  • Add parameters to the above function to specify the genre, tag and aggregation period

Remarks

There is no way to get it with API, so get it by scraping.

実行例の追加

大きいプロジェクトになってきたため、examplesなどのフォルダが必要だと思われる。

[追加機能] ニコニコ生放送への対応 / Support for NicoLive

概要

ニコニコ生放送の各種データにアクセスするclientLiveClientの作成

要素

  • 生放送のデータ
  • 番組の検索
  • フォロー中の番組の取得
  • 放送中の番組に対する処理
    • 放送データのストリーミング取得
    • コメントのストリーミング取得
    • 放送ネタ・ギフト・広告の操作(放送主判定あり)
  • 放送が終了した番組に対する処理
    • タイムシフトのダウンロード
    • タイムシフトのコメント取得
    • タイムシフトのギフト履歴・広告履歴取得

Todo

  • Objectの作成
  • 関数の作成
  • デバッグ作業

[Feature]1.2.3のReleaseにログイン機能がない

本レポジトリにはNicoNicoクラスにlogin()が実装されていますが、pipでインストールできるreleaseにはその実装が抜けております。
login()の実装を含めてreleaseしていただけますでしょうか。

クッキー管理クラスを作る。

ニコニコにゲストまたは渡されたアカウントでリクエストをするためのもの。
ゲストの場合はクッキーは"nicosid": "使用開始時刻のエポック秒"でよさそう。

[Feature] Add a function to get comments

Overview

Currently, there is a function to download the video, but there is no function to get the comment of the video, so I suggest adding it.

Required functions

  • Create an object to store comment data
  • Create a function to get the information needed to get a comment. Or get it at the same time as getting the video information (need to edit the video object)
  • Create a function to get the latest 1000 normal comments
  • Create a function to get the latest 1000 normal comments at that time using the past log function.
    By using the above function, create a function to get all the comments in the past (asynchronous function is recommended because it may take time).
  • Create a function to get poster comments
  • Create a function to get the latest simple comment

Remarks

Comment acquisition is possible with a GET request in the unauthenticated state, so use that.

非同期版を作る。

継承して置き換える。
eg: from niconico.aio import NicoNico
(開発優先順位は低い)

[不具合] get_commentsで公式アニメなどのコメントを取得できない

概要

video.get_comments()で公式アニメなどのチャンネルコメント及びコミュニティコメントが絡むものが取得できない。

対処法

type="channel"やtype="community"を指定された場合に特殊処理をする

特殊処理

threadidとforce_184をflapiから取得し、それをパラメータに加える。
http://flapi.nicovideo.jp/api/getthreadkey?thread=[threadID]
また、user_idもパラメータに加える。またthreadIDもメインコメントと異なるのでそれも確認。

備考

チャンネルコメント及びコミュニティコメントはuser_sessionがないと確認できない。

[Feature] Add a system for user information

Overview

Currently, even if video information can be acquired, user information cannot be acquired. Therefore, it is recommended to add the object related to user information and the function of information acquisition.

Tasks

  • Create user information related objects
  • Create a function to get user information during authentication
  • Acquisition of user information from user ID (scraping or API acquisition)
  • Create a function to link with video information (such as executing a function such as "video.getOwnerUserInformation()" from a video object), (so that it can be linked to still images, encyclopedias, live broadcasts, etc. in the future)
  • Create a function that can get a list of my list, a list of posted videos, a list of followers and users who are following from user information.

Remarks (APIs)

API for NicoSeiga to get nickname from user ID
https://seiga.nicovideo.jp/api/user/info?id=2

API on own profile (Authentication required)

Get own user information
https://public.api.nicovideo.jp/v1/user.json
https://nvapi.nicovideo.jp/v1/users/me
https://account.nicovideo.jp/api/public/v2/user.json?_service_frontend_id=87
Get own Recommendations
https://public.api.nicovideo.jp/v1/personal-frames.json?responseType=pc
Get own movies
https://nvapi.nicovideo.jp/v2/users/me/videos?q=&sortKey=registeredAt&sortOrder=desc&pageSize=20&page=1
Get own Nicorepo
https://public.api.nicovideo.jp/v1/timelines/nicorepo/last-1-month/my/pc/entries.json?object%5Btype%5D=video&type=upload
Get users I'm following
https://nvapi.nicovideo.jp/v1/users/me/following/users?pageSize=100
Get follower users
https://nvapi.nicovideo.jp/v1/users/me/followed-by/users?pageSize=100
Get own viewing history
https://nvapi.nicovideo.jp/v1/users/me/watch/history?page=1&pageSize=100
Get own list of MyLists
https://nvapi.nicovideo.jp/v1/users/me/mylists?sampleItemCount=3
Get if I am following the specified user ID
https://user-follow-api.nicovideo.jp/v1/user/followees/bulk/niconico-users.json?targetIds=56907032%2C121068283
Recommended video list API for myself
https://nvapi.nicovideo.jp/v1/recommend?recipeId=video_recommendation_recommend&site=nicovideo&_frontendId=6&_frontendVersion=0
Notification list API to myself
https://public.api.nicovideo.jp/v1/user/oshirasebox/box.json?offset=0&importantOnly=false

Analytics API for my posted videos

API for acquiring 30-day comparison information (increase / decrease information every other day) of views, comments, likes, and mylists
https://nvapi.nicovideo.jp/v1/users/me/analytics/stats?_frontendId=23&_frontendVersion=1.0.0&term=month&metrics=viewCount%2CcommentCount%2ClikeCount%2CmylistCount&dimensions=date
※In addition to date, device, referer, gender, and age can be specified for dimensions. In that case, you can get the ratio for each.
API for acquiring 30-day comparison information (total increase / decrease information) of the number of posts, the number of views, the number of comments, the number of "likes", and the number of mylists (Team can also specify day etc.)
https://nvapi.nicovideo.jp/v1/users/me/analytics/topics/essential-facts-diff?_frontendId=23&_frontendVersion=1.0.0&term=month
API to get the increase / decrease in the number of views of the video whose number of views is increasing and the transition for 30 days
https://nvapi.nicovideo.jp/v1/users/me/analytics/topics/popular-videos?_frontendId=23&_frontendVersion=1.0.0&term=month
API to get 30-day increase / decrease information of each uploaded video, the number of views, the number of comments, the number of "likes", and the number of mylists
https://nvapi.nicovideo.jp/v2/users/me/analytics/topics/uploaded-videos?q=&sortKey=registeredAt&sortOrder=desc&sortTerm=all&pageSize=20&page=1
API to get 30-day increase / decrease information of the number of views, comments, likes, and mylists of the latest posted videos
https://nvapi.nicovideo.jp/v2/users/me/analytics/topics/within-term-uploaded?_frontendId=23&_frontendVersion=1.0.0&term=month

Profile of others

The user information of others is in JSON format on the "data-initial-data" attribute of "div [id = js-initial-userpage-data]" on the HTML of the user page.
Can be obtained with "https://nvapi.nicovideo.jp/v1/users/{ID}/~~~"
~ are [following followed-by mylists]
Get others' Profile
https://embed.nicovideo.jp/users/4
Get others' Nicorepo
https://public.api.nicovideo.jp/v1/timelines/nicorepo/last-6-months/users/4739587/pc/entries.json?object%5Btype%5D=video&type=upload
Get others' movies published
https://nvapi.nicovideo.jp/v3/users/4739587/videos?sortKey=registeredAt&sortOrder=desc&pageSize=100&page=1
Get others' series published
https://nvapi.nicovideo.jp/v1/users/4739587/series?page=1&pageSize=100
指定したIDのユーザーをフォローしているかを取得するAPI
https://user-follow-api.nicovideo.jp/v1/user/followees/niconico-users/4.json

Other API

API to display a summary of a specific word on the Nicodic
https://api.nicodic.jp/page.summary/json/a/VOICEVOX
API to search channels by keywords
https://public.api.nicovideo.jp/v1/search/channels.json?query=apc&searchType=keyword&limit=3&responseGroup=detail
API to search communities by keywords
https://public.api.nicovideo.jp/v1/search/communities.json?query=apc&searchType=keyword&limit=3
API to get ad decorations for videos with specified ID
https://api.nicoad.nicovideo.jp/v1/contents/video/decoration?ids=sm439021,sm37562894

The iOS version of Nico Nico Live Broadcasting App had a function to search for users by user name, so I wonder if I can do something about it.

備考
指定した動画のコンテンツツリー一覧
https://nvapi.nicovideo.jp/v2/videos/sm9/contents-tree

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.