Print a Twitter feed as a simple HTML blog
10 by 1vuio0pswjnm7 | 1 comments on Hacker News.
needs stunnel, netcat, sed, cat, grep, tr, uniq thats it # 1.sh username > 1.json # 1.sh < 1.json > 1.htm #!/bin/sh case $# in :) ;;1) public_ip=104.244.42.129:443; public_host="Host: twitter.com"; public_token="Authorization: Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA"; printf "%s\n%s\n%s\n%s\n%s\n" "pid=$HOME/1.pid" "[ $$ ]" "client=yes" "accept=127.0.0.7:80" "connect=$public_ip"|stunnel -fd 0; x=$(printf "GET / HTTP/1.1\r\n%s\r\nConnection: close\r\n\r\n" "$public_host"|nc -vvn 127.7 80|grep -o "gt=[^;]*"|sed 's/gt=//'); echo gt $x >/dev/stderr;y=$(printf "GET %s HTTP/1.1\r\n%s\r\n%s\r\n%s\r\nConnection: close\r\n\r\n" \ "/i/api/graphql/Vf8si2dfZ1zmah8ePYPjDQ/UserByScreenNameWithoutResults?variables=%7B%22screen_name%22%3A%22$1%22%2C%22withHighlightedLabel%22%3Atrue%7D" \ "$public_host" "$public_token" "X-Guest-Token: $x"|nc -vvn 127.7 80|grep -o "rest_id\":\"[^\"]*"|sed 's/.*\"//'); echo rest_id $y >/dev/stderr;printf "GET %s HTTP/1.1\r\n%s\r\n%s\r\n%s\r\nConnection: close\r\n\r\n" \ "/i/api/graphql/Bn2jPG0Cy8VAOakAoyV_kA/UserTweets?variables=%7B%22userId%22%3A%22$y%22%2C%22count%22%3A500%2C%22withHighlightedLabel%22%3Atrue%2C%22withTweetQuoteCount%22%3Atrue%2C%22includePromotedContent%22%3Afalse%2C%22withTweetResult%22%3Afalse%2C%22withUserResults%22%3Afalse%2C%22withVoice%22%3Afalse%2C%22withNonLegacyCard%22%3Atrue%2C%22withBirdwatchPivots%22%3Afalse%7D" "$public_host" "$public_token" "X-Guest-Token: $x"|nc -vvn 127.7 80 kill -9 $(cat "$HOME"/1.pid) ;;0) x=$(echo x|exec tr x '\34'); sed -e 's/\\"/\"/g;s/\\n/ /g' -e "s/\"legacy\":/$x/g" \ |exec tr -cd '\34\11\12\40-\176'|exec tr -d '\12'|exec tr '\34' '\12' \ |exec grep -Eo '("created_at":"[^"]*)|("conversation_id_str":"[^"]*)|("url":"[^"]*)|("expanded_url":"[^"]*)|("full_text":"[^"]*)' \ |exec sed '/"created_at":"/s//
/; /"conversation_id_str":"/s///;/"url":"/{s///;s/"//g; s/.*/&<\/a>/;}; /"expanded_url":"/{s///;s/.*/&<\/a>/;};/"full_text":"/s///; s| https://[^ ]*| & |g;s/> />/g; /^RT @/s/$/ (RETWEET)/;s/$/
/;s/\\u.\{4\}//g'|uniq esac
0 Comments