Last active
October 31, 2024 14:42
-
-
Save shinokada/120df13971c58ca812c4577489ba5982 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash | |
# Source: https://raintrees.net/projects/a-painter-and-a-black-cat/wiki/OwnTweetSearch | |
# this script search your own tweets from tweet.js | |
MY_NAME="shinokada" #change to your twitter id | |
HIT_LIST=$(cat tweets.js |sed -e 's/window.YTD.tweets.part0 = //'|jq -r -c '.[]'|grep "$1") | |
HIT_COUNT=$(echo "${HIT_LIST}"|wc -l) | |
COUNT="1" | |
for RECORD in $HIT_LIST | |
do | |
echo $RECORD | |
ID=$(echo $RECORD|grep -o "\"id\":\".*\""|tr ',' '\n'|grep "\"id\":\".*\""|tail -1|awk -F'"' '{print $4}') | |
SCREEN_NAME=$(echo $RECORD|grep -o "screen_name\":\".*\","|awk -F'"' '{print $3}') | |
if [ -z "$SCREEN_NAME" ] | |
then | |
SCREEN_NAME=$MY_NAME | |
fi | |
echo "https://twitter.com/${SCREEN_NAME}/status/${ID}" | |
if [ "$HIT_COUNT" -gt 1 ] | |
then | |
echo "-------------------- [$HIT_COUNT] --------------------" | |
: $((HIT_COUNT--)) | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment