Пример #1
0
def v1CommentReply(parentId,titleNo,episodeNo,cookies,text=""):
    path = "/v1/comment_reply"
    titleNo = str(titleNo)
    episodeNo = str(episodeNo)
    text = str(text)
    objectId = "w_"+titleNo+"_"+episodeNo
    # print(objectId)
    time_now = datetime.datetime.now()
    otherStyleTime = time_now.strftime("%Y-%m-%d %H:%M:%S")
    if text:
        contents = text+"_"+str(otherStyleTime)
    else:
        contents = "自动生成回复_"+str(otherStyleTime)

    payload = {
               "contents":contents,
               "parentId":parentId,
               "objectId":objectId}
    payload.update(Config("baseparams"))
    try:
        resp = requests.post(Config("httphost")+path,params=getExpiresMd5(path),data=payload,headers=Config("headers"),cookies=cookies)
        result = resp.json()
        return result
    except Exception:
        logger.info(resp.url)
        logger.exception("v1CommentReply发生异常")
Пример #2
0
def likeComplaint(parentids):
    login(Config("email"),Config("passwd"))
    ###,点赞,举报
    for id,titleinfo in parentids.items():
        titleNo = titleinfo[0]
        episodeNo = titleinfo[1]
        data = postV1CommentLike(id,titleNo,episodeNo)
        checkV1CommentLike(data)
        data = postV1CommentComplaint(id)
        checkV1CommentComplaint(data)
        for replyId in titleinfo[2:]:
            data = postV1CommentReplyLike(replyId,titleNo,episodeNo)
            checkV1CommentLike(data)
            data = postV1CommentReplyComplaint(replyId)
            checkV1CommentComplaint(data)

    ##取消点赞
    for id,titleinfo in parentids.items():
        titleNo = titleinfo[0]
        episodeNo = titleinfo[1]
        data = postV1CommentLike(id,titleNo,episodeNo,flag='cancelLike')
        checkV1CommentLike(data)
        for replyId in titleinfo[2:]:
            data = postV1CommentReplyLike(replyId,titleNo,episodeNo,flag='cancelLike')
            checkV1CommentLike(data)
Пример #3
0
def v2Comment(titleNo,episodeNo,imageNo="",pageNo="",sortBy="",limit=""):
    path = "/v2/comment"
    payload = {"titleNo":titleNo,
               "episodeNo":episodeNo,
               "imageNo":imageNo,
                "pageNo":pageNo,
               "sortBy":sortBy,
               "limit":limit}
    payload.update(Config("baseparams"))
    payload.update(getExpiresMd5(path))
    try:
        resp = requests.get(Config("httphost")+path,params=payload,headers=Config("headers"),cookies=Config("cookies"))
        logger.info(resp.url)
        if resp.ok:
            result = resp.json()
            if result["code"] == 200:
                pass
                # logger.info(result.keys())
                # logger.info(result["data"].keys())
                # logger.info(result["data"]["commentList"][0].keys())
                # logger.info(result["data"]["commentList"][0]["commentReplyList"][0].keys())
                # logger.info(result["data"]["bestList"][0].keys())
                # logger.info(result["data"]["bestList"][0]["commentReplyList"][0].keys())

            return result
    except Exception:
        logger.exception("v2Comment发生异常")
Пример #4
0
def v1CommentDetail(titleNo,episodeNo,commentId,replyCommentId="",commentLimit=20,commentReplyLimit=10,imageNo=""):
    path = "/v1/comment/detail"
    payload = {"titleNo":titleNo,
               "episodeNo":episodeNo,
               "imageNo":imageNo,
                "commentId":commentId,
               "replyCommentId":replyCommentId,
               "commentLimit":commentLimit,
               "commentReplyLimit": commentReplyLimit,}
    payload.update(Config("baseparams"))
    payload.update(getExpiresMd5(path))
    try:
        resp = requests.get(Config("httphost")+path,params=payload,headers=Config("headers"),cookies=Config("cookies"))
        logger.info(resp.url)
        if resp.ok:
            result = resp.json()
            if result["code"] == 200:
                pass
                # logger.info(result.keys())
                # logger.info(result["data"].keys())
                # logger.info(result["data"]["comment"].keys())
                # logger.info(result["data"]["comment"]["commentList"][0].keys())
                # logger.info(result["data"]["comment"]["pageModel"].keys())
                # logger.info(result["data"]["comment"]["bestList"][0].keys())
                # logger.info(result["data"]["replyComment"].keys())
                # logger.info(result["data"]["replyComment"]["commentReplyList"][0].keys())
                # logger.info(result["data"]["replyComment"]["pageModel"].keys())
            return result
    except Exception:
        logger.exception("v1CommentDetail发生异常")
Пример #5
0
def postV1CommentReplyComplaint(id):
    path = "/v1/comment_reply/%s/complaint" % id
    payload = Config("baseparams")
    try:
        resp = requests.post(Config("httphost")+path,params=getExpiresMd5(path),data=payload,headers=Config("headers"),cookies=Config("cookies"))
        return resp.json()
    except Exception:
        logger.exception("postV1CommentReplyComplaint发生异常")
Пример #6
0
def appCommentTitleepisodeinfo2(telist):
    path="/app/comment/titleEpisodeInfo2"
    telist2Json = json.dumps(telist)
    payload = {"objectIdsJson":telist2Json}
    payload.update(Config("baseparams"))
    resp = requests.post(Config("httphost")+path,params=getExpiresMd5(path),data=payload,headers=Config("headers"))
    commentTitleEpisodeInfo = resp.json()["message"]["result"]["commentTitleEpisodeInfo"]
    return commentTitleEpisodeInfo
Пример #7
0
def v1CommentOwnAll(flag="",id="",pageNo=1):
    path="/v1/comment/ownall"
    payload= {"limit":20,"pageNo":pageNo,"flag":flag,"_id":id}
    payload.update(Config("baseparams"))
    payload.update(getExpiresMd5(path))
    resp = requests.get(Config("httphost")+path,params=payload,headers=Config("headers"),cookies=Config("cookies"))
    logger.info(resp.url)
    if resp.ok:
        result= resp.json()
        return result
    else:
        logger.exception("v1CommentOwnAll发生异常")
Пример #8
0
def deleteCommentReply(cookies,id):
    path = "/v1/comment_reply/%s" % id
    payload = Config("baseparams")
    try:
        resp = requests.delete(Config("httphost")+path,params=getExpiresMd5(path),data=payload,headers=Config("headers"),cookies=cookies)
        logger.info(resp.url)
        if resp.ok:
            result = resp.json()
            logger.info(result)
            assert result["code"] == 200
            assert result["message"] == "请求成功!"
    except Exception:
        logger.exception("deleteCommentReply发生异常")
Пример #9
0
def postV1CommentReplyLike(id,titleNo,episodeNo,cookies,flag="like"):
    path = "/v1/comment_reply/%s/like" % id
    titleNo = str(titleNo)
    episodeNo = str(episodeNo)
    payload = {
               "flag":flag,
               "titleNo":titleNo,
               "episodeNo":episodeNo,}
    payload.update(Config("baseparams"))
    try:
        resp = requests.post(Config("httphost")+path,params=getExpiresMd5(path),data=payload,headers=Config("headers"),cookies=cookies)
        result = resp.json()
        return result
    except Exception:
        logger.info(resp.url)
        logger.exception("vpostV1CommentReplyLike发生异常")
Пример #10
0
def v1Comment(titleNo,episodeNo,cookies,categoryImage="",categoryId="",imageNo="",text="",userType=""):
    path = "/v1/comment"
    titleNo = str(titleNo)
    episodeNo = str(episodeNo)
    text = str(text)
    objectId = "w_"+titleNo+"_"+episodeNo
    time_now = datetime.datetime.now()
    otherStyleTime = time_now.strftime("%Y-%m-%d %H:%M:%S")
    if not text:
        text = "自动生成评论_"+str(otherStyleTime)
    if userType:
        payload = {"categoryId":categoryId,
                   "categoryImage":categoryImage,
                   "contents":text,
                   "episodeNo":episodeNo,
                   "imageNo":imageNo,
                   "objectId":objectId,
                   "titleNo":titleNo,
                   "userType":userType}
    else:
        payload = {"categoryId":categoryId,
                   "categoryImage":categoryImage,
                   "contents":text,
                   "episodeNo":episodeNo,
                   "imageNo":imageNo,
                   "objectId":objectId,
                   "titleNo":titleNo,}
    payload.update(Config("baseparams"))
    try:
        resp = requests.post(Config("httphost")+path,params=getExpiresMd5(path),data=payload,headers=Config("headers"),cookies=cookies)
        if resp.ok:
            result = resp.json()
            return result
        else:
            logger.error(resp.url)
            logger.error(resp.request.body)
            logger.error(resp.text)
            logger.error(resp.status_code)
            logger.error(resp.headers)
            logger.error(resp.request.headers)

    except Exception:
        logger.exception("v1Comment出现异常")
        logger.error(resp.text)
        logger.error(resp.request.body)
        logger.error(resp.status_code)
Пример #11
0
def v1CommentReplyGet(commentId,pageNo=1,limit=10):
    path = "/v1/comment_reply"
    payload = {
               "commentId":commentId,
               "pageNo":pageNo,
               "limit":limit}
    payload.update(Config("baseparams"))
    payload.update(getExpiresMd5(path))
    try:
        resp = requests.get(Config("httphost")+path,params=payload,headers=Config("headers"))
        # logger.info(resp.url)
        result = resp.json()
        if result["code"] == 200:
            # logger.info(result['data']["commentReplyList"][0].keys())
            return result
    except Exception:
        logger.exception("v1CommentReplyGet发生异常")
Пример #12
0
def v1CommentImageCount(titleNo,episodeNo,ids):
    path = "/v1/comment/image/count"
    payload = {"titleNo":titleNo,
               "episodeNo":episodeNo,
               "ids":ids,
               "v":1}
    payload.update(Config("baseparams"))
    payload.update(getExpiresMd5(path))
    try:
        resp = requests.get(Config("httphost")+path,params=payload,headers=Config("headers"))
        if resp.ok:
            result = resp.json()
            if result["code"] == 200:
                return result
    except Exception:
        logger.info(resp.url)
        logger.exception("v1CommentImageCountt发生异常")
Пример #13
0
def replyComplaint(cookies,id):
    path = "/v1/comment_reply/%s/complaint" % id
    try:
        resp = requests.post(Config("httphost")+path,params=getExpiresMd5(path),headers=Config("headers"),cookies=cookies)
        # logger.info(resp.url)
        result = resp.json()
        return result
    except Exception:
        logger.exception("replyComplaint发生异常")
Пример #14
0
def likeAndCount(cookies, titleNo, episodeNo):
    path = "/v1/title/%s/episode/likeAndCount" % titleNo
    payload = {"episodeNos": episodeNo}
    payload.update(Config("baseparams"))
    payload.update(getExpiresMd5(path))
    try:
        resp = requests.get(Config("httphost") + path,
                            params=payload,
                            headers=Config("headers"),
                            cookies=cookies)
        if resp.ok:
            resp_json = resp.json()
            return resp_json["data"][0]
        else:
            logger.error("点赞章节错误")
            logger.info(resp.text)
    except Exception:
        logger.exception("点赞章节异常")
        logger.info(resp.text)
Пример #15
0
def likeIt(cookies, titleNo, episodeNo, like=True):
    path = "/v1/title/%s/episode/%s/like" % (titleNo, episodeNo)
    if like:
        flag = "like"
    else:
        # print("取消点赞%s-%s" % (titleNo,episodeNo))
        flag = "cancelLike"

    payload = {"flag": flag}
    payload.update(Config("baseparams"))
    try:
        resp = requests.post(Config("httphost") + path,
                             params=getExpiresMd5(path),
                             data=payload,
                             headers=Config("headers"),
                             cookies=cookies)
        return resp.json()
    except Exception:
        logger.info(resp.text)
        logger.exception("点赞章节异常")