niconicolibs / niconico.py Goto Github PK
View Code? Open in Web Editor NEWニコニコ動画や生放送等の各種サイトの非公開APIに簡単にアクセスするためのPythonライブラリ
Home Page: https://niconicolibs.github.io/niconico.py/
License: MIT License
ニコニコ動画や生放送等の各種サイトの非公開APIに簡単にアクセスするためのPythonライブラリ
Home Page: https://niconicolibs.github.io/niconico.py/
License: MIT License
コマンドラインツールのログイン方法がクッキ^ファイル指定だけなので他の方法でもできるようにする
大きいプロジェクトになってきたため、examplesなどのフォルダが必要だと思われる。
Use Python's decorating function to distinguish whether it is an authentication-required function.
@auth_required
def get_own_information():
~~do something~~
ニコニコ生放送の各種データにアクセスするclientLiveClient
の作成
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.
API for NicoSeiga to get nickname from user ID
https://seiga.nicovideo.jp/api/user/info?id=2
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
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
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
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
継承して置き換える。
eg: from niconico.aio import NicoNico
(開発優先順位は低い)
Videoオブジェクトからseries、ranking、genre、community、commentとchannelを参照できるようにする
video.get_comments()で公式アニメなどのチャンネルコメント及びコミュニティコメントが絡むものが取得できない。
type="channel"やtype="community"を指定された場合に特殊処理をする
threadidとforce_184をflapiから取得し、それをパラメータに加える。
http://flapi.nicovideo.jp/api/getthreadkey?thread=[threadID]
また、user_idもパラメータに加える。またthreadIDもメインコメントと異なるのでそれも確認。
チャンネルコメント及びコミュニティコメントはuser_sessionがないと確認できない。
本レポジトリにはNicoNicoクラスにlogin()が実装されていますが、pipでインストールできるreleaseにはその実装が抜けております。
login()の実装を含めてreleaseしていただけますでしょうか。
TypedDict
DictFromAttribute
を使用して動画情報の辞書の型を少し作る。動画と同じようにニコニコ静画上の情報を取得する機能や画像・漫画をダウンロードする機能を追加する。
機能自体がたくさんあり、イラストと漫画でAPIが違うためTasksを絞る必要がある。
ニコニコ静画のAPI一覧記事
https://gist.github.com/7cc/c608fe778defd0357d9d1b75d1956816
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.
Comment acquisition is possible with a GET request in the unauthenticated state, so use that.
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.
When authenticating with an email address and password, it is necessary to process when two-step verification is requested.
I just want to let you aware that I found some APIs for modifying MyList
https://documenter.getpostman.com/view/23763145/2s9YsNdqLs
I have created a same issue at niconicolibs/api#2
N/A
N/A
N/A
N/A
Since there is no function to get the ranking, add it
There is no way to get it with API, so get it by scraping.
niconico video <url> download
does not work for certain videos.
See below.
$ python3 ../niconico video https://www.nicovideo.jp/watch/sm43452874 download
[INFO] セッションIDを取得中... (<Video Title=トラップで冒険者を狩るあかりちゃんのDungeon Warfare 2 #15 Heartbeat=False>)
Exception in thread Thread-1 (_heartbeat):
Traceback (most recent call last):
File "/usr/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
self.run()
File "/usr/lib/python3.11/threading.py", line 975, in run
self._target(*self._args, **self._kwargs)
File "/home/josh/apps/niconico.py-1.2.3/downloads/../niconico/video.py", line 260, in _heartbeat
headers=HEADERS["heartbeat"], json=self._make_session_data(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/josh/apps/niconico.py-1.2.3/downloads/../niconico/video.py", line 295, in _make_session_data
session = self.__data__["media"]["delivery"]["movie"]["session"].copy()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable
It should download the video normally.
1.2.3
and 1.2.4
Linux Debian 12 64bit
$ uname -a
Linux framework13 6.1.0-18-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01) x86_64 GNU/Linux
$ python3 --version
Python 3.11.2
None.
ニコニコにゲストまたは渡されたアカウントでリクエストをするためのもの。
ゲストの場合はクッキーは"nicosid": "使用開始時刻のエポック秒"
でよさそう。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.