Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions searchtweets/search_tweets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -428,15 +428,18 @@ def make_data_request(query, start_time, end_time, since_id, until_id, max_resul

if @write_mode == 'files' #write the file.

#Each 'page' has a start and end time, go get those for generating filename.

filename = ""
#TODO: just pass in first timestamp: results.first['created_at']
filename = get_file_name(query, api_response['data'])

puts "Storing Search API data in file: #{filename}"
File.open("#{@out_box}/#{filename}.json", "w") do |new_file|
new_file.write(api_response.to_json)
if api_response.key?("data")
#Each 'page' has a start and end time, go get those for generating filename.
filename = ""
#TODO: just pass in first timestamp: results.first['created_at']
filename = get_file_name(query, api_response['data'])

puts "Storing Search API data in file: #{filename}"
File.open("#{@out_box}/#{filename}.json", "w") do |new_file|
new_file.write(api_response.to_json)
end
else
puts "No Tweets." if @verbose
end

elsif @write_mode == 'standard_out' #Standard out
Expand Down