Last active
August 27, 2023 04:06
-
-
Save kyohsuke/2806ea08aa274431057678f4393b23f6 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
// https://twitter.com/search?q=lang%3Aja%20filter%3Areplies%20(card_domain%3Abnc.lt%EF%BD%9Ccard_domain%3Afanlink.to%20%EF%BD%9Ccard_domain%3An9oi1.app.link)&src=typed_query&f=live | |
// ↑ にアクセスして ↓ をコンソールにこぴぺ | |
const interval = 3000; | |
function delBnc() { | |
let tweets = document.evaluate('//article[@data-testid="tweet"]//div[@aria-label="もっと見る"]', document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); | |
let elem = tweets.snapshotItem(0); | |
if(elem != null) { | |
let targetDOMRect = elem.getBoundingClientRect(); | |
let targetTop = targetDOMRect.top + window.pageYOffset; | |
document.documentElement.scrollTop = targetTop; | |
elem.click(); | |
let belem = document.querySelector("[data-testid=block]"); | |
if(belem != null) { | |
belem.click(); | |
document.querySelector("[data-testid=confirmationSheetConfirm]").click(); | |
setTimeout(delBnc, interval); | |
} else { | |
elem.click(); | |
} | |
} | |
}; | |
setTimeout(delBnc, interval); |
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
// https://twitter.com/search?f=live&q=(from%3Akyohsuke14)%20until%3A2023-07-01&src=typed_query | |
// ↑ な感じで from のあとにある "kyohsuke14" を自分のアカウントIDに変更してアクセスして ↓ をコンソールにこぴぺ | |
const interval = 3000; | |
function delOldTweet() { | |
let tweets = document.evaluate('//article[@data-testid="tweet"]//div[@aria-label="もっと見る"]', document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); | |
let elem = tweets.snapshotItem(0); | |
if(elem != null) { | |
let targetDOMRect = elem.getBoundingClientRect(); | |
let targetTop = targetDOMRect.top + window.pageYOffset; | |
elem.click(); | |
document.documentElement.scrollTop = targetTop; | |
setTimeout(function(){ | |
let belems = document.querySelector("[data-testid=Dropdown]"); | |
let belem = belems.children[0]; | |
if(belem != null) { | |
belem.click(); | |
document.querySelector("[data-testid=confirmationSheetConfirm]").click(); | |
setTimeout(delOldTweet, interval); | |
} else { | |
elem.click(); | |
} | |
}, 300); | |
} | |
}; | |
setTimeout(delOldTweet, interval); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment