niconico.py
niconico.py copied to clipboard
[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
- [x] Create user information related objects
- [ ] Create a function to get user information during authentication
- [x] 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)
- [x] 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