New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plugins.niconicochannelplus: add support for "nicochannel.jp" #4923
Conversation
For VoD on "Niconico Channel Plus" (Japanese: ニコニコチャンネルプラス). https://portal.nicochannel.jp/ Thanks to the following people who provided useful information: - lokilin, raised a request in issue 2537 of yt-dlp/yt-dlp; - 雷兰濑 (railannad), raised a request in issue 4366; - Trung0246, analyzed HTTP data in issue 4366; - Lesmiscore, made cross-reference between the above two issues.
Hi, I'm keeping the two commits separated since there seems to be something wrong with our Windows CI and the developing docs. Please squash all commits when merging this PR, thank you in advance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry, but I'm afraid we're not going to merge this. We've decided a long time ago that we're not going to merge any more VOD-only plugins and we'll only keep those already implemented until they break and require major changes. Please see the contributing guidelines before opening PRs and ask first before writing new plugins, as explained in the PR template, to avoid wasting time on implementing plugins that won't get merged.
https://github.com/streamlink/streamlink/blob/master/CONTRIBUTING.md#plugin-requests
- Sites which don't provide any real live streaming content, eg. only VODs or VODs being rebroadcasted
Since you spent a bit of time implementing this plugin, let me at least give you at least a quick review.
I'll take a look at the metadata decoding error later. Not sure though if it's an actual error and worth fixing, as we want metadata to be in English only.
@bastimeyer , thank you for taking time to review my code. This is very detailed.
OK, I've seen your new PR, and I agree to write only English in metadata.
Well, I've already read the guideline. # live urls (move it to "should_match*" if the plugin supports live-streaming)
'https://nicochannel.jp/example/live/sm3Xample', If possible, I would like to keep this PR open, and:
|
Thank you for your PR. but there are other scripts that can download Vod. eg. Minyami |
- Store all URLs as class members for better human-reading. - Directly use the "HTTPSession" object which is from the Streamlink session instead of passing it from outside. - Use validation schemas instead of "json.loads" and "__getitem__" ([]) for better data decoding, JSON validation and exception handling. - Directly return the result from "HLSStream.parse_variant_playlist" since the plugin does not modify the dictionary of streams.
Both ID and channel name are in the URL, so no need to output them.
It's not informative.
Mission complete. Then, sadly, I found that I'm using single quotes to write the code :-( |
We don't want to merge any new code with strings that use single-quote characters. We don't have a linting rule for that because of old code that would need to be changed first. Otherwise, more sophisticated linting tools would need to be used which only check the diff in PRs. Regarding the plugin implementation itself, this will need a second review. I won't be reviewing this now though, as this won't make it into the 5.1.0 release anyway, and I'm not even sure yet if this plugin can be merged according to the plugin request guidelines. |
I didn't know that. Last I heard, it was "use either, but whichever you choose, use that quoting style consistently". I wonder if the dev doc should be updated to reflect this? |
Fine. The commit is under way.
Indeed, the code has changed a lot so far.
There's no hurry. It doesn't matter if this plugin is not in 5.1.0.
Well, I've implemented the function to fetch both live and VoD. Am I still missing something? |
When Streamlink was forked, the coding style was all over the place, and it pretty much still is. This is because no strict linting tools have been used, and over the time, lots of different people have made contributions to lots of different parts, not just plugins. If we want to change this and have better and consistent code styles via strict code linting tools like
The first solution is a lot of work and it is not ideal either because it would be a giant diff to review, and it also can introduce bugs if you're not careful enough. Not even automated tools can get this right (seriously), so human interactions and human reviews are required for that. Apart from this, there's lots of code which nobody has touched in a long time, like stuff from certain plugins for example, so changing all this, not just strings, is a lot of refactoring work. The second solution however is being applied for a long time already, for the most part at least, just so that no major new code style issues get introduced. If something gets (or has been) missed, then it's usually not a big deal. If you ask though which is the correct style, then I will give you the correct answer. Regarding strings, please read this:
If you want to update the dev docs, then go for it. |
Understood regarding options 1 and 2.
Very informative, thanks. I think I have not asked and not seen any mention of quoting style recently, so my understanding was based on very old information. I'm sure when I first started here I was using single quotes consistently, then changed to double quotes. I'm not sure why, but I think it was probably just because I adapted to the style of other regular contributors over time. I'll have a look at updating the dev doc so that there's something to point to regarding coding style. |
Titles are easy to find in the webpage.
If psf/black#830 gets implemented, we could apply the rules to all changed lines, to make things consistent gradually, by Black. |
Done.
Also done. Now this PR is ready to be reviewed again. For anyone who wants to test this plugin with live eventsHere's a table with all scheduled live for the next 7 days: Table of live events
And the above table is generated by the following script: Script for finding scheduled live events#!/bin/bash
set -e
set -o pipefail
set -u
curl --version >/dev/null
jq --version >/dev/null
sort --version >/dev/null
offset_second=604800 # in one week
now_second=$(date '+%s');
limit_second=$((${now_second} + ${offset_second}));
echo '| START (UTC) | URL |';
echo '| - |:- |';
channel_list="$(curl -sS 'https://nfc-api.nicochannel.jp/fc/content_providers/channels')";
<<<"${channel_list}" jq --compact-output '.data.content_providers | .[]' | \
while read -r channel_info; do
fanclub_site_id="$(jq --raw-output '.id' <<<"${channel_info}")";
domain="$(jq --raw-output '.domain' <<<"${channel_info}")";
live_page_info="$(
curl -sS "https://nfc-api.nicochannel.jp/fc/fanclub_sites/${fanclub_site_id}/live_pages?page=1&live_type=2&per_page=1" | \
jq '.data' \
)";
if [[ "${live_page_info}" != 'null' ]]; then
live_list="$(jq '.video_pages.list' <<<"${live_page_info}")";
if [[ "${live_list}" != '[]' ]]; then
the_live="$(jq --compact-output '.[0]' <<<"${live_list}")";
content_code="$(jq --raw-output '.content_code' <<<"${the_live}")";
live_scheduled_start_at="$(jq --raw-output '.live_scheduled_start_at' <<<"${the_live}")";
live_scheduled_start_at_second=$(date --date="${live_scheduled_start_at}" '+%s');
if [[ ${now_second} -le ${live_scheduled_start_at_second} ]]; then
if [[ ${live_scheduled_start_at_second} -le ${limit_second} ]]; then
echo "| ${live_scheduled_start_at} | [${content_code}](${domain}/live/${content_code}) |";
fi;
fi;
fi;
fi;
done | \
sort;
|
Just had a look at the site and what I'm seeing is lots of borderline NSFW content. While this obviously is not a porn site and there's other content as well, this still very much is in conflict with rule 5. Should we decide to merge a plugin for a site like this, then it'll invite more requests for similar content in the future. We've already rejected and closed similar requests in the past. https://github.com/streamlink/streamlink/blob/master/CONTRIBUTING.md#plugin-requests @gravyboat, opinions? |
…onvert_to_vod_flg" are True The name of those fields is confusing.
Can I ask for a stupid question? I tried the command |
Hi, @railannad !
Well, you didn't install the git revision which points to the branch contains the code in this PR. Please try this: pip install --user --upgrade git+https://github.com/pzhlkj6612/streamlink.git@plugin-nicochannel
# ^^^^^^^^^^^^^^^^^^^ I found this from:
Tested on a Linux: $ docker run --rm -it --entrypoint /bin/bash python:3.10.9-bullseye
# pip install --user --upgrade git+https://github.com/pzhlkj6612/streamlink.git@plugin-nicochannel
Cloning https://github.com/pzhlkj6612/streamlink.git (to revision plugin-nicochannel) to /tmp/...
Running command git clone --filter=blob:none --quiet https://github.com/pzhlkj6612/streamlink.git /tmp/...
Running command git checkout -b plugin-nicochannel --track origin/plugin-nicochannel
Switched to a new branch 'plugin-nicochannel'
Branch 'plugin-nicochannel' set up to track remote branch 'plugin-nicochannel' from 'origin'.
Resolved https://github.com/pzhlkj6612/streamlink.git to commit 9661f970f35d3d405604824dd80d099558c0b15f
...
...
...
...
Successfully installed ... streamlink-4.1.0+275.g9661f970 ...
...
# python -m streamlink 'https://nicochannel.jp/kanase.ito/video/smRkfW4zmgTkr8rPZcQRPZpE' best
[cli][info] streamlink is running as root! Be careful!
[cli][info] Found matching plugin niconicochannelplus for URL https://nicochannel.jp/kanase.ito/video/smRkfW4zmgTkr8rPZcQRPZpE
[cli][info] Available streams: 240p (worst), 360p, 480p, 720p, 1080p (best)
[cli][info] Opening stream: 1080p (hls)
It works. In addition, it would be better if you provide all command lines you executed and execution result as text instead of screenshots. OCRing a long URL is not easy. You can use a code block like this:
It will be rendered as: > streamlink.exe ... best
error: No plugin can handle URL: ... :-) |
Thank you for reply. @pzhlkj6612 I tried like this: it can work when url is
|
The regex is To make it work, try: - python -m streamlink 'https://nicochannel.jp/kanase.ito/video/smRkfW4zmgTkr8rPZcQRPZpE' best
+ python -m streamlink https://nicochannel.jp/kanase.ito/video/smRkfW4zmgTkr8rPZcQRPZpE best Or, - python -m streamlink 'https://nicochannel.jp/kanase.ito/video/smRkfW4zmgTkr8rPZcQRPZpE' best
+ python -m streamlink "https://nicochannel.jp/kanase.ito/video/smRkfW4zmgTkr8rPZcQRPZpE" best See powershell - Differences between single and double quotes in CMD - Stack Overflow. I've applied c91c19e to make the regex less strict just now. You can install the latest version and try to pass in a single-quoted URL in CMD. |
Thank you @pzhlkj6612 |
Going to close this now. As said, there's too much softcore porn on this site, so I'm not willing to merge this, as this would open the door for many more plugin requests of that kind. We explicitly state in the plugin guidelines that NSFW sites won't be included. Thanks for the PR though. |
Hi everyone! I think that the Niconico Channel Plus website does contain NSFW content. To comply with rules of Streamlink, this plugin should not be merged. For audiences of that website, you can find the newest "niconicochannelplus.py" file at https://github.com/pzhlkj6612/streamlink-plugins and try to side-load it. Further issues should be sent to my repository instead. Thanks again for everyone's participation. |
For VoD and live on "Niconico Channel Plus" (Japanese: ニコニコチャンネルプラス).
Thanks to the following people who provided useful information:
closes #4366