Created
September 12, 2019 09:47
-
-
Save nawada/273f4da9f2d0f40487f7130e188c664f to your computer and use it in GitHub Desktop.
Twitterの検索結果の件数数えるやつ
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
javascript:var height=window.innerHeight,rootElement=document.querySelector("div[data-testid=primaryColumn] section[role=region] > div > div > div"),times={};let intervalId=setInterval(()=>{window.scrollBy(0,height);var e=rootElement.style.paddingBottom,t=e.length;if(0===parseInt(e.substring(0,t-2)))return clearInterval(intervalId),void alert(Object.keys(times).length);document.querySelectorAll("article time").forEach(e=>times[e.dateTime]=!0)},350); | |
/***** | |
var height = window.innerHeight; | |
var rootElement = document.querySelector('div[data-testid=primaryColumn] section[role=region] > div > div > div'); | |
var times = {}; | |
let intervalId = setInterval(() => { | |
window.scrollBy(0, height) | |
var paddingBottom = rootElement.style.paddingBottom; | |
var paddingBottomLength = paddingBottom.length; | |
var rest = parseInt(paddingBottom.substring(0, paddingBottomLength - 2)); | |
if(rest === 0) { | |
clearInterval(intervalId); | |
alert(Object.keys(times).length); | |
return; | |
} | |
document.querySelectorAll('article time').forEach((el) => times[el.dateTime] = true); | |
}, 350); | |
*****/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment