I am using twitter and downloaded a sample code from:" https://stream.twitter.com/1.1/statuses/sample.json"
I used pretty printing but it doesn't print like how I want it.
I only need the user "name" or "screen_name", "user_mention", and "retweeted". I need this to draw a tree with nodes (names) and edges (retweets or mentions with sentimate value (+/-).
first: I dont know how to remove everything from json to just print the 3 things.
Code:
with open (fname) as json_file:
for line in json_file.readlines():
type(line)
f_contents = json_file.read()
keywords = ["id","screen_name","retweeted", "user_mention" ]
keywords =set(keywords)
print(keywords)
pprint.pprint(line, indent = 4 , width=5)