Lackoftactics/facebook_data_analyzer

Breaking error while analyzing

Closed this issue ยท 12 comments

Analyzing conversation with: Kevin and Michael
/Users/nate/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/axlsx-2.0.1/lib/axlsx/util/validators.rb:88: warning: constant ::Fixnum is deprecated
/Users/nate/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/axlsx-2.0.1/lib/axlsx/util/validators.rb:110: warning: constant ::Fixnum is deprecated
/Users/nate/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/axlsx-2.0.1/lib/axlsx/util/simple_typed_list.rb:146: warning: constant ::Fixnum is deprecated
analyze_facebook_data.rb:277:in parse': invalid date (ArgumentError) from analyze_facebook_data.rb:277:in block (2 levels) in

'
from /Users/nate/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/nokogiri-1.8.2/lib/nokogiri/xml/node_set.rb:190:in block in each' from /Users/nate/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/nokogiri-1.8.2/lib/nokogiri/xml/node_set.rb:189:in upto'
from /Users/nate/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/nokogiri-1.8.2/lib/nokogiri/xml/node_set.rb:189:in each' from analyze_facebook_data.rb:270:in block in '
from analyze_facebook_data.rb:265:in chdir' from analyze_facebook_data.rb:265:in '

I can confirm that the same thing happens with Ruby v2.5 (2.5.1p57 to be exact):

$ bundle exec ruby analyze_facebook_data.rb /path/to/dump/
Analyzing conversation with: Jon Doe
/var/lib/gems/2.5.0/gems/axlsx-2.0.1/lib/axlsx/util/validators.rb:88: warning: constant ::Fixnum is deprecated
/var/lib/gems/2.5.0/gems/axlsx-2.0.1/lib/axlsx/util/validators.rb:110: warning: constant ::Fixnum is deprecated
/var/lib/gems/2.5.0/gems/axlsx-2.0.1/lib/axlsx/util/simple_typed_list.rb:146: warning: constant ::Fixnum is deprecated
Traceback (most recent call last):
	7: from analyze_facebook_data.rb:265:in `<main>'
	6: from analyze_facebook_data.rb:265:in `chdir'
	5: from analyze_facebook_data.rb:270:in `block in <main>'
	4: from /var/lib/gems/2.5.0/gems/nokogiri-1.8.2/lib/nokogiri/xml/node_set.rb:189:in `each'
	3: from /var/lib/gems/2.5.0/gems/nokogiri-1.8.2/lib/nokogiri/xml/node_set.rb:189:in `upto'
	2: from /var/lib/gems/2.5.0/gems/nokogiri-1.8.2/lib/nokogiri/xml/node_set.rb:190:in `block in each'
	1: from analyze_facebook_data.rb:277:in `block (2 levels) in <main>'
analyze_facebook_data.rb:277:in `parse': invalid date (ArgumentError)

@natethinks @Aleksandar-Todorovic looking into that. Are you guys sure, you were downloading with English(US) as zip file. That really impacts and I use parsing of date from ruby and it works like a charm with English(US).

Some bit of html with metadata would be helpful, as I see it's stopped on first step, so can you check what you have there.

When I open manually conversation date is shown next as Monday, May 1, 2017 at 5:20am UTC+02. Can you validate that is the same for you?

In my case, on line 277 where it has Date.parse(date_added), it tried to parse an email instead of a date. Hence, the failure.

debug with:

    else
      puts "Date: #{date_added}"
      Date.parse(date_added)
    end

@handonam can you give some html, make your data anonymous. Probably it's happening on span class="meta". Just this one div with message will be ok, I will try to fix your issue.

one of my particular entries for html/friends.htm is formatted like this (removing HTML to make it easier to see what's going on):

Friend One (Apr 4)
Friend Two (Mar 9)
Friend Three (Feb 9) (friendEmail&#064;email.com)

last entry adds a separate parenthesis for email

oh, that's interesting. Can you find this bit with email and paste html code, there will be span class="meta" and inside there will be date and email probably?

Fixed it in #4

@handonam I just merged @pawelgut PR. Can you confirm that it works now?

Confirmed, at least the error going away.

@natethinks @Aleksandar-Todorovic I need also confirmation from you guys or we will debug further.

This fixed it for me