def __get_params_for_comment(self, video_api_info: VideoAPIInfo):
        """make parameters to get comment

        :param video_api_info: VideoAPIInfo
        :return: parameter dict
        """
        video_info = self.get_video_info(video_api_info.video_id)
        commented_point = Util.get_commented_point(video_info.length)
        params = [
            {
                "thread": {
                    "language": 0,
                    "nicoru": 1,
                    "scores": 1,
                    "thread": str(video_api_info.thread_id),
                    "user_id": video_api_info.user_id,
                    "userkey": video_api_info.user_key,
                    "version": '20090904',
                    "with_global": 1,
                }
            }, {
                "thread_leaves": {
                    "content": "{}:100,1000".format(commented_point),
                    "language": 0,
                    "nicoru": 1,
                    "scores": 1,
                    "thread": str(video_api_info.thread_id),
                    "user_id": video_api_info.user_id,
                    "userkey": video_api_info.user_key,
                },
            }
        ]
        thread_key, force_184 = self.__get_thread_key(video_api_info.thread_id)
        if thread_key:
            # for official video and the like
            params.append({
                "thread": {
                    "force_184": force_184,
                    "language": 0,
                    "nicoru": 1,
                    "scores": 1,
                    "thread": str(video_api_info.thread_id),
                    "threadkey": thread_key,
                    "user_id": video_api_info.user_id,
                    "version": '20090904',
                    "with_global": 1,
                }
            })
            params.append({
                "thread_leaves": {
                    "content": "{}:100,1000".format(commented_point),
                    "force_184": force_184,
                    "language": 0,
                    "nicoru": 1,
                    "scores": 1,
                    "thread": str(video_api_info.thread_id),
                    "threadkey": thread_key,
                    "user_id": video_api_info.user_id,
                },
            })
        return params
Esempio n. 2
0
 def test(self):
     assert Util.get_commented_point('1145:14') == '0-1146'