Skip to content

Commit c9ae114

Browse files
committed
sha1 email username instead of dropping the field
1 parent fd53d3a commit c9ae114

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

crawler/crawler.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
require 'log4r'
22
require 'yajl'
3+
require 'digest'
34
require 'em-http'
45
require 'em-stathat'
56

@@ -35,7 +36,10 @@
3536
@latest = []
3637
@latest_key = lambda { |e| "#{e['id']}" }
3738
@clean = lambda do |h|
38-
h.delete('email')
39+
if email = h.delete('email')
40+
name, host = email.split("@")
41+
h['email'] = [Digest::SHA1.hexdigest(name), host].compact.join("@")
42+
end
3943
h.each_value do |v|
4044
@clean.call(v) if v.is_a? Hash
4145
v.each {|e| @clean.call(e)} if v.is_a? Array

0 commit comments

Comments
 (0)