-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathupdate.rb
44 lines (39 loc) · 992 Bytes
/
update.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
require 'fileutils'
def update(limit)
list = Dir.entries('.')
puts 'Updating all already downloaded users and hashtags'
list.each do |filename|
next if filename[0] == '.'
if File.directory?(filename)
if filename[0] == '#'
download_hashtag(filename[1..-1], limit)
else
update_user(filename)
end
end
end
end
def update_hashtags(limit)
list = Dir.entries('.')
puts 'Updating all already downloaded hashtags'
list.each do |filename|
next if filename[0] != '#'
if File.directory?(filename)
download_hashtag(filename[1..-1], limit)
end
end
end
def update_users
list = Dir.entries('.')
puts 'Updating all already downloaded users'
users_list = []
list.each do |filename|
next if filename[0] == '.' || filename[0] == '#' || filename[0] == '_'
if File.directory?(filename)
users_list << filename
end
end
users_list.shuffle.each do |username|
download_user(username, true)
end
end