tommorris (owner)

Revisions

gist: 132574 Download_button fork
public
Public Clone URL: git://gist.github.com/132574.git
Embed All Files: show embed
Ruby #
1
2
3
4
5
# i had a bunch of twitter XML archive files. I wanted a hash of all the
# usernames mentioned therein.
 
hash3 = Hash.new
(1..159).collect {|i| Nokogiri::XML(open("/home/tom/twitter_archive2/#{i}.xml").readlines.join) }.collect {|twt| twt.search("status").collect {|i| [i.search("in_reply_to_user_id")[0].content, i.search("in_reply_to_screen_name")[0].content] }.delete_if {|i| i == ["", ""] }.uniq }.each {|arr| arr.each {|item| hash3[item[0]] = item[1] } }