I am trying to build a program to scrape some Twitter data and then show them in a user-friendly format on a webpage (title and content). So far I have created the scraper and I have saved the data as a JSON
file.
for tweet in new_tweets:
outtweets=tweet._json
with open('Trumpstweets.json', 'a') as f:
print(outtweets)
f.write(json.dumps(outtweets))
And this is a part of my huge JSON file.
{"id": 1193249691741216768, "created_at": "Sat Nov 09 19:31:10 +0000 2019", "contributors": null, "id_str": "1193249691741216768", "in_reply_to_screen_name": null, "geo": null, "entities": {"user_mentions": [], "symbols": [], "hashtags": [{"text": "MAGA", "indices":
I am not sure how to show this data to a user. I am very new to Python and JSON. I am trying to show it on a webpage.
<head>
<title>askyb - Load JSON File Locally by Javascript Without JQuery</title>
<script type="text/javascript" src="tweets.json"></script>
</head>
function load() {
var mydata = JSON.parse(tweets);
alert(mydata[0]);
alert(mydata[1]);
}
and there is an error:
in tweets.json:1 Uncaught SyntaxError: Unexpected token ':'