-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNoList.sh
executable file
·75 lines (63 loc) · 2.15 KB
/
NoList.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
set -uo pipefail
IFS=$'\n\t'
# Basically makes a list of users who have "No lists" in their bio.
# https://twitter.com/DLStauffer/status/937511654777954304
SCRIPTDIR=$(dirname $0)
TEMP=$(mktemp)
TEMPUSER=$(mktemp)
SOURCE=$(mktemp)
SCRIPT=$(mktemp)
URL="https://mobile.twitter.com/search/users?q=NO%20LISTS&s=typd"
COUNT="0"
# https://developer.mozilla.org/en-US/Firefox/Headless_mode#Automated_testing_with_headless_mode
cat <<EOF > $SCRIPT
import sys
import codecs
from selenium.webdriver import Firefox
from selenium.webdriver import FirefoxProfile
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.support import expected_conditions as expected
from selenium.webdriver.support.wait import WebDriverWait
if __name__ == "__main__":
f = codecs.open(sys.argv[2], "w", "utf-8")
options = Options()
options.add_argument('-headless')
profile = FirefoxProfile("/home/orange/.mozilla/firefox/7qefm09p.default")
driver = Firefox(executable_path='./geckodriver', firefox_options=options, firefox_profile=profile)
wait = WebDriverWait(driver, timeout=1)
driver.get(sys.argv[1])
f.write(driver.page_source)
f.close()
driver.quit()
EOF
pushd $SCRIPTDIR
while true; do
echo "[*]: Getting search $(( COUNT += 1))"
python $SCRIPT "$URL" "$SOURCE"
grep href $SOURCE | cut -d'"' -f 2 | grep "^/" | uniq > $TEMP
while read USER; do
if ! grep "^${USER}$" .USERS; then
echo "[*]: Getting User"
wget -qO- "https://twitter.com${USER}" |\
grep "\"description\" content=" |\
sed -e "s/ <meta name=\"description\" content=\"//g" -e "s/\">$//g" |\
grep -i "no lists"
if [ "0" -eq "$?" ]; then
echo $USER | tee -a .USERS
fi
fi
done < <(grep "?p=" $TEMP | sed -e "s/?.*//g")
if grep -q "search" $TEMP; then
URL="https://mobile.twitter.com$(grep "search" $TEMP)"
else
cat $TEMP
echo $URL
exit 0
fi
echo "[*]: Waiting 3s"
sleep 3s
done
popd