Last active
November 28, 2017 05:52
-
-
Save joesonw/8b8f1c654f2322670c87446c15fd3901 to your computer and use it in GitHub Desktop.
垃圾知乎
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
放chrome console里跑, | |
劳烦自己翻个页,然后复制跑一遍 | |
**/ | |
count = 0; | |
total = 0; | |
Array.from(document.getElementsByClassName('ContentItem')).map(item => { | |
var id = item.getAttribute('name'); | |
total++; | |
fetch(`https://www.zhihu.com/api/v4/answers/${id}`, { | |
method: 'PUT', | |
headers: { | |
'Content-Type': 'application/json', | |
}, | |
credentials: 'include', | |
body: JSON.stringify({ | |
content: '<p>哔~知乎, 爷不玩了, <a href="https://gist.github.com/joesonw/8b8f1c654f2322670c87446c15fd3901">chrome代码</a></p>', | |
reward_setting: { | |
can_reward: false, | |
} | |
}), | |
}).then(() => { | |
console.log(`${++count}/${total} done`); | |
}).catch(err => console.error(err.stack || e)); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
放chrome console里跑, | |
劳烦自己翻个页,然后复制跑一遍 | |
**/ | |
count = 0; | |
total = 0; | |
Array.from(document.getElementsByClassName('ContentItem')).map(item => { | |
var id = item.getAttribute('name'); | |
total++; | |
fetch(`https://www.zhihu.com/api/v4/answers/${id}`, { | |
method: 'DELETE', | |
credentials: 'include', | |
}).then(() => { | |
console.log(`${++count}/${total} done`); | |
}).catch(err => console.error(err.stack || e)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment