Like chéo, cày rank 11/3

  • Người tạo chủ đề Người tạo chủ đề vitamin.d
  • Ngày bắt đầu Ngày bắt đầu
Trạng thái
Không mở để trả lời thêm.
Chạy code đi ae
IPMM3cD.gif

JavaScript:
(function(){
/* Tùy chọn reaction, các bạn thay các số tương ứng vào là được (vd: REACTION = 2)
     0 : Random
1 : Like
2 : Love
3 : Haha
4 : Wow
5 : Sad
6 : Angry
*/
const REACTION = 1;

/* Tùy chọn trang bắt đầu (khỏi phải scan lại từ đầu =]]) */
const START_PAGE = 1;

/* Tùy chọn like cho Top reaction (https://next.voz.vn/members/?key=highest_reaction_score.
    Set bằng 'true' nếu muốn like cho top.
Vì một voz tân có like bằng nhau
*/

const LIKE_HIGHEST_REACTION = true;
 
/*
    Like theo id người post (https://next.voz.vn/members/{id}/)
ex: const WHITE_LIST = ["id1", "id2", "id3", "id...N"]
*/
const WHITE_LIST = [];

/*
    Không Like theo id người post
ex: const BLACK_LIST = ["id1", "id2", "id3", "id...N"]
*/

const BLACK_LIST = [];

function getHttpRequest() {
  try {return new XMLHttpRequest();}
  catch (error) {}
  try {return new ActiveXObject("Msxml2.XMLHTTP");}
  catch (error) {}
  try {return new ActiveXObject("Microsoft.XMLHTTP");}
  catch (error) {}

  throw new Error("Could not create HTTP request object.");
}

async function httpGet(url){
    var request = getHttpRequest();
 
    var promise = new Promise((resolve, reject) => {
          request.onreadystatechange = function() {
             if (request.readyState==4 && request.status==200)
                {
                    resolve(request.responseText);
                }
          }
    });

    request.open("GET", url, true);
    request.send(null);

    return await promise;
}

async function httpPost(url, data){
    var request = getHttpRequest();
    var promise = new Promise((resolve, reject) => {
          request.onreadystatechange = function() {
             if (request.readyState==4 && request.status==200)
                {
                    resolve(request.responseText);
                }
          }
    });

    request.open("POST", url, true);
    request.setRequestHeader('Accept', 'application/json, text/javascript, */*; q=0.01');
    request.setRequestHeader('content-type', 'application/x-www-form-urlencoded; charset=UTF-8');
    request.send(data);

    return await promise;
}

function sleep (time) {
  return new Promise((resolve) => setTimeout(resolve, time));
}
/*------------------------------------------*/

function querySelectorAll(element, query){
    return Array.from(element.querySelectorAll(query));
}

async function getDocument(url){
    var text = await httpGet(url);
    var parser = new DOMParser();
 
    return parser.parseFromString(text, 'text/html');
}

async function getHighestReactionMembers(){
    var doc = await getDocument("/members/?key=highest_reaction_score");

    return querySelectorAll(doc, ".username").map(item=> /members\/(.*)\//gm.exec(item.href)[1]);
}

async function autoLike(reaction=1){
    var url = /(.*)\/(page)?/gm.exec(window.location.href)[1];
    var totalPage = 1;
    var pageNav = querySelectorAll(document, ".pageNav-page").pop();
    pageNav = pageNav ? pageNav.querySelector("a") : null;
 
    if(pageNav!=null){
        totalPage = /\/page-(.*)/gm.exec(pageNav.href)[1];
    }
    var pathName = /(.*)\/(page)?/gm.exec(window.location.pathname)+ "/";
 
    var highestReactionMembers = await getHighestReactionMembers();
 
    for(var i=START_PAGE;i<=totalPage;i++){
        console.log("-------- Like page: " + i + "--------");
        var htmlDoc = await getDocument(url+"/page-"+i);
        var token = htmlDoc.documentElement.getAttribute("data-csrf");
      
        querySelectorAll(htmlDoc, ".message.message--post").forEach(item=>{
            var postId = /js-post-(.*)/gm.exec(item.id)[1];
            var userId =  /members\/(.*)\//gm.exec(item.querySelector(".username").href)[1];
          
            if(WHITE_LIST!=null && WHITE_LIST.length > 0){
                if(WHITE_LIST.findIndex(item=>item==userId) == -1){
                    console.log("Ignore " + userId);
                    return;
                }
            }
          
            if(BLACK_LIST!=null && BLACK_LIST.length > 0){
                if(BLACK_LIST.findIndex(item=>item==userId) >= 0){
                    console.log("Ignore " + userId);
                  
                    return;
                }
            }
          
            if(!LIKE_HIGHEST_REACTION){
                if(highestReactionMembers.findIndex(item=>item==userId) >= 0){
                    console.log("Ignore " + userId);
                    return;
                }
            }
          
            if(item.querySelector("a.reaction.reaction--imageHidden")){
                 console.log("Like post: "+ postId);
                var r = reaction || Math.floor(Math.random() * 6)+1;
                httpPost("/posts/"+postId+"/react?reaction_id="+r, "_xfRequestUri="+pathName+"page-"+i+"&_xfWithData=1&_xfToken="+token+"&_xfResponseType=json");
            }
        });
      
        sleep(500);
    }
 
    console.log("done");
}
    
    autoLike(REACTION);
})();
 
Tôi muốn tắt nắng đi
Cho màu đừng nhạt mất;
Tôi muốn buộc gió lại
Cho hương đừng bay đi.

Của ong bướm này đây tuần trăng mật;
Này đây hoa của đồng nội xanh rì;
Này đây lá của cành tơ phơ phất;
Của yến anh này đây khúc tình si.
Và này đây ánh sáng chớp hàng mi;
Mỗi sáng sớm, thần vui hằng gõ cửa;
Tháng giêng ngon như một cặp môi gần;
Tôi sung sướng. Nhưng vội vàng một nửa:
Tôi không chờ nắng hạ mới hoài xuân.
Xuân đang tới, nghĩa là xuân đang qua,
Xuân còn non, nghĩa là xuân sẽ già,
Mà xuân hết, nghĩa là tôi cũng mất.
Lòng tôi rộng, nhưng lượng trời cứ chật,
Không cho dài thời trẻ của nhân gian,
Nói làm chi rằng xuân vẫn tuần hoàn,
Nếu đến nữa không phải rằng gặp lại.
Còn trời đất, nhưng chẳng còn tôi mãi,
Nên bâng khuâng tôi tiếc cả đất trời;
Mùi tháng, năm đều rớm vị chia phôi,
Khắp sông, núi vẫn than thầm tiễn biệt...
Cơn gió xinh thì thào trong lá biếc,
Phải chăng hờn vì nỗi phải bay đi?
Chim rộn ràng bỗng đứt tiếng reo thi,
Phải chăng sợ độ phai tàn sắp sửa?
Chẳng bao giờ, ôi! Chẳng bao giờ nữa...

Mau đi thôi! Mùa chưa ngả chiều hôm,
Ta muốn ôm
Cả sự sống mới bắt đầu mơn mởn;
Ta muốn riết mây đưa và gió lượn,
Ta muốn say cánh bướm với tình yêu,
Ta muốn thâu trong một cái hôn nhiều
Và non nước, và cây, và cỏ rạng,
Cho chếnh choáng mùi thơm, cho đã đầy ánh sáng
Cho no nê thanh sắc của thời tươi;
- Hỡi xuân hồng, ta muốn cắn vào ngươi!
 
Trạng thái
Không mở để trả lời thêm.

Thống kê chủ đề

Ngày tạo
vitamin.d,
Người trả lời cuối
chanvuong,
Trả lời
25.281
Lượt xem
466.158
Quay lại
Lên đầu trang