Created
April 13, 2025 15:17
-
-
Save cmj/8d4dcaedf64be3a66850c161082979e2 to your computer and use it in GitHub Desktop.
Select tweets from user search json files with geolocation enabled
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 | |
# Quick (ugly) way to find and print tweets with place, geolocation turned on from user timeline search json archives | |
# ex: | |
# 1050678488821166082 | Fri Oct 12 09:24:07 +0000 2018 | https://x.com/foxandfriends/status/1050678488821166082 | place:c1ef8962bc0b514d (New Bern, NC) | About 1M without power after Hurricane Michael shreds electric grids; towns flattened https://t.co/k68iyqLqSo | |
user="${1//-latest/}" | |
cat ${user}*/*.json | jq '.data.search_by_raw_query.search_timeline.timeline.instructions[0].entries[].content.itemContent.tweet_results.result | if(.legacy.place) then "\(.legacy.id_str),\(.legacy.created_at),place:\(.legacy.place.id),\"\(.legacy.place.full_name | select(.!=null))\",https://x.com/\(.core.user_results.result.legacy.screen_name)/status/\(.legacy.id_str),\"\(.legacy.full_text | gsub("&";"&") | gsub("\"";"\"\""))" else empty end ' 2> /dev/null | | |
sed 's/\\n\\n/ /g;s/ / /g;s/\\n/ /g;s/ / /g;s/ / /g;s/\\//g;s/^"//' | |
csvtool trim . - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment