zhihu icon indicating copy to clipboard operation
zhihu copied to clipboard

知乎收藏夹批量更改公开私密

Open freemedom opened this issue 3 years ago • 0 comments

//https://www.zhihu.com/people/。。。/collections?page=1运行
var flag=0//0是改为公开,1是改为私密
const sleep = (delay) => new Promise((resolve) => setTimeout(resolve, delay))
const change = async () => {
    var col = document.getElementsByClassName("Button Button--plain Button--withIcon Button--withLabel")
    for (let i = 1; i <= col.length; i += 3) {
        col[i].click();
        var gongkaisimi = document.getElementsByClassName("Favlists-privacyOptionRadio")
        gongkaisimi[flag].click()
        var queren = document.getElementsByClassName("Button Button--primary Button--blue")
        queren[1].click()
        await sleep(1000)
    }
}
const main=async () => {
    var nextpage= document.getElementsByClassName("Button PaginationButton PaginationButton-next Button--plain")
    while(1){
        await change()
        if(nextpage.length==0){
            break
        }
        nextpage[0].click()
        await sleep(1500)
    }
}
main()

freemedom avatar Oct 31 '21 03:10 freemedom