Giter Site home page Giter Site logo

simonwongwong / facebook-messenger-statistics Goto Github PK

View Code? Open in Web Editor NEW
85.0 8.0 16.0 9.6 MB

Discover fun stats about your Facebook Messenger usage such as: most used words, most active year, most active hours, etc. using this Jupyter Notebook

Home Page: https://simonwong.io/sample_report.html

Python 84.94% Jupyter Notebook 15.06%
facebook-messenger facebook metrics statistics jupyter-notebook python analytics

facebook-messenger-statistics's People

Contributors

nacimgoura avatar simonwongwong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

facebook-messenger-statistics's Issues

Support for other languages? Specifically Greek.

Tried using this on my facebook messanges and some statistics work, like most used words, but names display weirdly, for example "Παναγι��η� �αο��η�" , they show up like that and I'm not sure if there's a way to decode that somehow

Number of words metric

Would it be possible to get the number of words for each sender in a group chat? To more accurately convey who might be the most active participant of a chat if they happen to send larger messages?

Extract.py not behaving as expected

Not that I know exactly how the folders structure should turn out, but, I don't think this is it...

image

And all the folders not prefaced by "./archive" just have a "message.json" in them.
None of the JSONs were extracted out to the inbox folder (which is the folder in which I ran extract.py).

Update sample report

sample report is out of date -- report now displays the days with the most messages and day-of-week with most messages

Couldn't load messenger data

Can you please tell me what am I missing here?

C:\Users\User\Facebook-Messenger-Statistics>generate_report.py
Parsing data from D:/facebook/messages/inbox/ash_c6esfrteiq
Could not load messenger data
Exception caught: [WinError 267] The directory name is invalid: 'D:\facebook\messages\inbox\ashiqulhabib_c6esfrteiq\message_1.json'

generate_report.py throwing KeyError

I am running this on a Windows 10 laptop against recently downloaded facebook files. It throws the exception below. Any ideas what the issue here might be? Thanks!

Traceback (most recent call last):
File "\Facebook-Messenger-Statistics-master\generate_report.py", line 51, in
yearly_graph, monthly_graph, hourly_graph, minutely_graph, daily_graph, weekday_graph = cs.time_stats(show=False)
File "\Facebook-Messenger-Statistics-master\chatstat.py", line 15, in wrapper
fig, graph = graph_func(*args, **kwargs)
File "\Facebook-Messenger-Statistics-master\chatstat.py", line 427, in time_stats
time_indexed = self.generate_time_indexed_df(messages)
File "\Facebook-Messenger-Statistics-master\chatstat.py", line 281, in generate_time_indexed_df
time_indexed = messages.set_index('timestamp_ms')
File "\AppData\Local\Programs\Python\Python39\lib\site-packages\pandas\core\frame.py", line 4727, in set_index
raise KeyError(f"None of {missing} are in the columns")
KeyError: "None of ['timestamp_ms'] are in the columns"

Generate Report not working

When I try to run the generate_report.py script I get the following:
Traceback (most recent call last):
File "generate_report.py", line 6, in
import chatstat
File "/Users/lawrence/Facebook-Messenger-Statistics/chatstat.py", line 2, in
from plotly.subplots import make_subplots
ImportError: No module named plotly.subplots

I do have plotly installed and it works fine on Jupyter Notebook. I'm using Mac OSX by the way.

Chats not loading properly

Hi! I've been trying to import my own chats into the program using the Jupyter notebook but it no longer works anymore.

It throws up an error in the Load your Chats section:


NotADirectoryError Traceback (most recent call last)
in
----> 1 cs = chatstat.ChatStat(*loader.parse_from_json('/Users/lawrence/Desktop/inbox'))

~/Facebook-Messenger-Statistics/loader.py in parse_from_json(path)
39 raise NotADirectoryError("{path} is not a directory")
40 messages_dir = [path / mdir for mdir in os.listdir(path)]
---> 41 all_files = [msg_dir / json_file for msg_dir in messages_dir for json_file in os.listdir(msg_dir) if json_file.startswith(JSON_FILENAME)]
42
43 chat_data = []

~/Facebook-Messenger-Statistics/loader.py in (.0)
39 raise NotADirectoryError("{path} is not a directory")
40 messages_dir = [path / mdir for mdir in os.listdir(path)]
---> 41 all_files = [msg_dir / json_file for msg_dir in messages_dir for json_file in os.listdir(msg_dir) if json_file.startswith(JSON_FILENAME)]
42
43 chat_data = []

NotADirectoryError: [Errno 20] Not a directory: '/Users/lawrence/Desktop/inbox/.DS_Store'

It appears that a .DS_Store hidden file (Mac OS X system file for folders, cannot be deleted) is interfering and causing the folder not to be classed as a directory. I've tried with an empty folder that appears not to have the file and the code works, but it looks like the system file is created soon after any folder is transferred inside it.

Is there any workaround for this?

Attribute 'msg' is missing

Error while generating report :

Parsing data from C:/Users/xxx/Desktop/messages
Traceback (most recent call last):
File "generate_report.py", line 45, in
how.add_trace(cs.msg_types(show=False), row=1, col=1)
File "C:\Users\xxx\Desktop\Facebook-Messenger-Statistics-master\chatstat.py", line 15, in wrapper
fig, graph = graph_func(*args, **kwargs)
File "C:\Users\xxx\Desktop\Facebook-Messenger-Statistics-master\chatstat.py", line 149, in msg_types
type_dict = {"type": {"stickers": chat.sticker.count(), "photos": chat.photos.count(), "videos": chat.videos.count(), "links": chat[[("http" in str(msg)) for msg in chat.msg]].msg.count()}}
File "C:\Users\xxx\AppData\Local\Programs\Python\Python38\lib\site-packages\pandas\core\generic.py", line 5465, in getattr
return object.getattribute(self, name)
AttributeError: 'DataFrame' object has no attribute 'msg'

extract.py throws SyntaxError

When trying to run extract.py I get this error:
$ python extract.py File "extract.py", line 12 files = [x for x in files if not ".py" in x] ^ SyntaxError: invalid syntax

More stat ideas

  • Top X days with the most messages sent
  • Messages by day of the week (Monday, Tuesday, etc.)
  • Largest chats by number of words, rather than messages

Use plotly for plots

plotly will allow for more interactive plots with the ability to hover and resize plots

Getting error while cloning

Hi, Every time I try to clone the git I am getting this error, what should I do? Thanks

$ git clone [email protected]:simonwongwong/Facebook-Messenger-Statistics.git
Cloning into 'Facebook-Messenger-Statistics'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.