CSDN下载自动评论

在tampermonkey下增加如下脚本:

// ==UserScript==
// @name        CSDN下载自动评论
// @author      N3verL4nd
// @namespace   Sollyu
// @description 自动评论,返还下载积分
// @require     http://code.jquery.com/jquery-1.9.0.min.js
// @include     http://download.csdn.net/my/downloads
// @include     http://download.csdn.net/my/downloads/*
// @icon        http://tb.himg.baidu.com/sys/portrait/item/d92f6fd8ad5265626f726ee90f
// @version     2.1
// ==/UserScript==
// 2015-05-20.2.1    在Chrome中可用
// 2013-01-25.1.0    CSDN自动评论


//多少时间评论一次,单位:秒
var tTime=65;

// 预定义的评论内容,可按照格式自行添加,注意最后一行后面没有逗号
var contentPL=new Array(
    "很全面,很好用,谢谢分享.",
    "挺不错的资料,谢谢分享.",
    "很全,什么都有了,感谢.",
    "比相关书籍介绍的详细,顶一个.",
    "还行,适合于初级入门的学习.",
    "很好的资料,很齐全,谢谢.",
    "还可以,就是感觉有点乱.",
    "感謝LZ收集,用起來挺方便.",
    "感觉还行,只是感觉用着不是特别顺手.",
    "很有学习价值的文档,感谢.",
    "内容很丰富,最可贵的是资源不需要很多积分.",
    "这个真的非常好,借鉴意义蛮大.",
    "有不少例子可以参考,目前正需要.",
    "下载后不能正常使用.",
    "例子简单实用,但如果再全面些就更好了."
);

var queueList = {};

// css
var  csdnHelperCss=document.createElement('style');
csdnHelperCss.type='text/css';
$(csdnHelperCss).html('.popWindow{position:fixed;z-index:10000;top:10px;left:10px;}.popWindow>span{display:block;text-align:left;color:cyan;text-shadow:0 0 2px white;background-color:#555;box-shadow:-1px -1px 4px gray;margin:5px 0 0 0;padding:00 6px 0 6px;cursor:pointer;font-size: 13px;}');

$('body').prepend(csdnHelperCss);
$('body').prepend('<div class="popWindow"></div>');

//将本页待评论资源自动加入评论队列
$("[href$='#comment']").each(function(){
    var reg=/\/([_a-zA-Z0-9]+)\/([0-9]+)#/;
    var src=$(this).attr('href').match(reg);
    addQueue(src[1],src[2],(new Date()).getTime());
    $(this).parent().html("已加入评论队列");
});

// 若待评论数大于0则提示用户滞留在本窗口
console.debug("本次任务总数--->"+getJsonLength(queueList));
if(getJsonLength(queueList) > 0){
    popWindow("待评论任务数:"+getJsonLength(queueList),0);
    popWindow("请保持在本界面,以便进行评价",6000);
    setInterval(searchToPost,tTime*1000);
    searchToPost();
}else{
    popWindow("无待评论任务",0);
    var count = window.location.href.substring(window.location.href.lastIndexOf("/") + 1);
    count++;
    window.location.href="http://download.csdn.net/my/downloads/" + count;
}

function getJsonLength(jsonData){
    var jsonLength = 0;
    for(var item in jsonData){
        jsonLength++;
    }
    return jsonLength;
}

// 添加评论队列
function addQueue(owner,sourceID,stamp){
    queueList[stamp] = {owner, sourceID};
    console.log(stamp, queueList[stamp]);
    popWindow('已添加到任务队列,['+owner+','+sourceID+']',2000);
}

// 显示消息
function popWindow(str,delayTime){
    var obj = $('.popWindow').append('<span>'+str+'</span>').children().last();
    if(delayTime>0)
        obj.delay(delayTime).hide(1500,function(){$(this).remove();});
}

function searchToPost(){
    // 查询有没有可以评论的资源
    for (var stamp in queueList){
        var res = queueList[stamp];
        post(res.owner, res.sourceID, stamp);
        break;
    }
}
// 发送评论
function post(owner,sourceID,stamp){
    $.ajax({
        type:"get",
        url:"http://download.csdn.net/index.php/comment/post_comment",
        headers:{
            "Referer":"http://download.csdn.net/detail/"+owner+"/"+sourceID,
            "Content-type":"application/x-www-form-urlencoded; charset=UTF-8",
            "X-Requested-With":"XMLHttpRequest"
        },
        data:{
            "content":contentPL[Math.round(Math.random()*(contentPL.length-1))],
            "jsonpcallback":"jsonp"+(new Date()).getTime(),
            "rating":"5",
            "sourceid":sourceID,
            "t":(new Date()).getTime()
        },
        success:function(res){
            var index = res.indexOf("({");
            var data = eval(res.substr(index));
            var resMsg="----";
            console.log(data.succ);
            if(data.succ>0){
                delete queueList[stamp];
                resMsg = '任务成功! 已评论['+owner+','+sourceID+']<br/>-----剩余任务数:' + getJsonLength(queueList);
                console.debug(resMsg);
                popWindow(resMsg,(tTime+20)*1000);
                $('.popWindow').children().each(
                    function(){
                        if(this.innerHTML.indexOf("待评论任务数")>=0)
                            this.innerHTML=("待评论任务数:"+getJsonLength(queueList));
                    });
                    location.reload();
            }
            else{
                resMsg = '任务评论失败['+owner+','+sourceID+']'+"<br/>----原因:"+data.msg;
                console.debug(resMsg.replace(/<br\/>/,""));
                popWindow(resMsg,60000);
                if(data.msg.indexOf("您已经发表过评论")>=0){
                    delete queueList[stamp];
                }
            }
        }
    });
}

打开
http://download.csdn.net/my/downloads/1
就可以自动回复了,但是有1分钟的限制。

这里写图片描述

艹,不返积分了。妈蛋。。

博客自动评论脚本:

// ==UserScript==
// @name        CSDN博客自动评论
// @author      N3verL4nd
// @require     http://code.jquery.com/jquery-1.9.0.min.js
// @include     http://blog.csdn.net/*/article/details/*
// @version     1.0
// ==/UserScript==
// 2017-12-22    在Chrome中可用


// 预定义的评论内容,可按照格式自行添加,注意最后一行后面没有逗号
var contentPL=new Array(
    "谢谢分享.欢迎回访:http://blog.csdn.net/x_iya",
    "挺不错的资料,谢谢分享.欢迎回访:http://blog.csdn.net/x_iya",
    "很全,什么都有了,感谢.欢迎回访:http://blog.csdn.net/x_iya",
    "比相关书籍介绍的详细,顶一个.欢迎回访:http://blog.csdn.net/x_iya",
    "还行,适合于初级入门的学习.欢迎回访:http://blog.csdn.net/x_iya",
    "很好的资料,很齐全,谢谢.欢迎回访:http://blog.csdn.net/x_iya",
    "还可以,就是感觉有点乱.欢迎回访:http://blog.csdn.net/x_iya",
    "感謝LZ收集,用起來挺方便.欢迎回访:http://blog.csdn.net/x_iya",
    "感觉还行,只是感觉用着不是特别顺手.欢迎回访:http://blog.csdn.net/x_iya",
    "很有学习价值的文档,感谢.欢迎回访:http://blog.csdn.net/x_iya",
    "内容很丰富.欢迎回访:http://blog.csdn.net/x_iya",
    "这个真的非常好,借鉴意义蛮大.欢迎回访:http://blog.csdn.net/x_iya",
    "有不少例子可以参考,目前正需要.欢迎回访:http://blog.csdn.net/x_iya",
    "下载后不能正常使用.欢迎回访:http://blog.csdn.net/x_iya",
    "例子简单实用,但如果再全面些就更好了.欢迎回访:http://blog.csdn.net/x_iya"
);


// css
var  csdnHelperCss=document.createElement('style');
csdnHelperCss.type='text/css';
$(csdnHelperCss).html('.popWindow{position:fixed;z-index:10000;top:10px;left:10px;}.popWindow>span{display:block;text-align:left;color:cyan;text-shadow:0 0 2px white;background-color:#555;box-shadow:-1px -1px 4px gray;margin:5px 0 0 0;padding:00 6px 0 6px;cursor:pointer;font-size: 13px;}');

$('body').prepend(csdnHelperCss);
$('body').prepend('<div class="popWindow"></div>');

var flag = false;
check(location.href.split("/")[3], location.href.split("/")[6]);
if(!flag) {
    post(location.href.split("/")[3], location.href.split("/")[6]);
}


// 显示消息
function popWindow(str, delayTime){
    var obj = $('.popWindow').append('<span>'+str+'</span>').children().last();
    if(delayTime > 0)
        obj.delay(delayTime).hide(1500,function(){$(this).remove();});
}

function check(user, id){
    $.ajax({
        type:"get",
        url:"http://blog.csdn.net/" + user + "/comment/list/" + id,
        success:function(res){
            //flag = true;
            var lists = eval(res).list;
            for(var i in lists) {
                if(lists[i].UserName == "你的用户名") {
                    flag = true;
                    break;
                }
            }
        }
    });
}

// 发送评论
function post(user, id){
    $.ajax({
        type:"post",
        url:"http://blog.csdn.net/" + user + "/comment/submit?id=" + id,
        headers:{
            "Content-type":"application/x-www-form-urlencoded; charset=UTF-8",
            "X-Requested-With":"XMLHttpRequest"
        },
        data:{
            "content":contentPL[Math.round(Math.random()*(contentPL.length-1))],
        },
        success:function(res){
            console.info(res);
            popWindow("评论成功", 3000);
        }
    });
}
评论 20
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

N3verL4nd

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值