I took the following code from the book "Mastering social media mining with python", which saves all the tweets of a user in the JSON format. But I'd like it saved in json only tweets of a certain date. How to do?
This is the code that saves all tweets:
fname2=dirname
fname2+= "/user_timeline.jsonl"
with open(fname2, 'w') as f:
for page in Cursor(client.user_timeline, screen_name=screen_name, count=200).pages(16):
for status in page:
f.write(json.dumps(status._json)+"\n")
This is the structure of JSON: link
How can I make this filter? Another detail is that in JSON comes a tweet after the other between {} but there is no key for it (without "Tweet": {.....})
Thank you!