Python library for parsing through facebook messenger data
Project description
zucked: analyze your Facebook Messenger data
What is it?
zucked is a quick and easy way to veiw your facebook messenger data.
Main Features
- Easy viewing of your most used words on Facebook Messenger
- See another facebook users most sent words to you
- Check the amount of messages you have sent a person or group
- Search a word or phrase that you might have sent or recieved to see: The message the word or phrase was in, as well as who sent it and when the message was sent
Install
The source code is currently hosted on GitHub at: https://github.com/Jordan-Milne/zucked
The latest released version is available at the Python package index (PyPI)
pip install zucked
Tutorial
-
Downlaod your Facebook Messenger data (How to)
- When choosing file type make sure it is JSON and not HTML
-
Create a python file in the same directory as the "inbox" folder from your download - not inside the inbox folder
Import
To import zucked, type:
import zucked as zd
read_messages
save read_messages as a variable, which we will be calling methods on later.
Example:
ms = zd.read_messages
top_words()
call top_words(facebook_name, stop_words=True, period='all time') on ms to return an ordered list of the most common words the user sent and how many times they sent it:
This method works for top words you have sent and top words you have recieved from a certain user
Example:
ms.top_words('Jordan Milne')
Returns:
[('I', 3), ('love', 2), ('data', 1)]
If you want stop words filtered out, (what are stop words) and just the top words for a certain year then the method would simply be:
ms.top_words('Jordan Milne', stop_words=False, period='2016')
top_convos
call top_convos(facebook_name) on ms to return an ordered list of the name(s) of the person or group and the amount of messages you sent to that person or group:
Example:
ms.top_convos('Jordan Milne')
Returns:
[('User 1', 33),
('User 2', 21)]
If you want the top conversations for a certain year then the method would simply be:
ms.top_words('Jordan Milne', period='2016')
search_messages()
call search_messages(facebook_name, value) on ms to return a list that has the full message containing the word or phrase input as value, who the message was sent to, and the date and time the message was sent.
Example:
ms.search_messages('Jordan Milne', 'hello')
Returns:
[{'Message': 'I'm sorry but, hello world',
'Sent to': 'Auston Matthews',
'Date': '2019-06-09 11:46:54'}]
This method works for messages you have sent and messages you have recieved from a certain user
format_top_words()
call format_top_words(facebook_name, input_list, year) on ms to return a nested dictionary with the year and counts of the list of words that the user inputs that is specifically formatted for plotting.
Example:
ms.format_top_words('Jordan Milne', ['Matthews','Tavares','Marner','Andersen'], '2019')
Returns:
{'2019': {'Matthews': 75, 'Andersen': 70, 'Marner': 17, 'Tavares': 10}}
Now for the fun part. If you want to see how often you used your top 5 all time words each year it can be done in a few simple steps.
Get all years into the same dictionary using this for loop:
example={}
for i in range(2010,2021):
example.update(ms.format_top_words('Jordan Milne',['Matthews','Tavares','Marner','Andersen'], str(i)))
Now that we have the data collected and organized we are ready to plot:
import matplotlib.pyplot as plt
# get inner keys
inner_keys = list(example.values())[0].keys()
# x-axis is the outer keys
x_axis_values = list(example.keys())
# loop through inner_keys
plt.title("Facebook Messenger Word Count")
plt.xlabel("Year")
plt.ylabel("Count");
for x in inner_keys:
# create a list of values for inner key
y_axis_values = [v[x] for v in example.values()]
# plot each inner key
plt.plot(x_axis_values, y_axis_values, label=x)
plt.legend()
The ouput should look like:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zucked-1.0.0.tar.gz.
File metadata
- Download URL: zucked-1.0.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91cb629c76821f0c6f5fc5417415f643ebb9dd8e33eae35eeaedeeeee6ad8661
|
|
| MD5 |
d2251613e92945aeffa17ea707dd3eab
|
|
| BLAKE2b-256 |
83fdb70c968692886c49df69dfeab3f393b7891c3be335c8dc37da154bb17637
|
File details
Details for the file zucked-1.0.0-py3-none-any.whl.
File metadata
- Download URL: zucked-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5ac6e5d5da2382b0ddf5422a1ba0ddc176e062c2cd37234b20645e7a0bf978c
|
|
| MD5 |
c84528dea10f423b1d7d549f2a5583ff
|
|
| BLAKE2b-256 |
40aa743e7528d858200dac2b407a7025a7dad9825b9fb0fa99154bfbb5abf8ea
|