GithubHelp home page GithubHelp logo

avocadosconstant / fbmsgparse Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 0.0 29 KB

๐Ÿ’ฌ A simple python package to clean, organize, preprocess, and make sense of your entire Facebook message history.

License: MIT License

Python 100.00%
facebook preprocess parse fb-messages-parser python messages fbmessenger beautifulsoup

fbmsgparse's Introduction

FB Messages Parser

A simple python module to clean, organize, preprocess, and make sense of your entire Facebook message history.

This module was originally written to help create a Markov chatbot to emulate our friend Chris after he was kicked from a chat group for excessive crassness. The messages.htm file retreived from the downloadable archive off of Facebook was too unwieldy to work with, and I couldn't find any specific libraries that minimalistically processed the corpus the way I wanted to, so this module was written.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

  • Install python3: Self explanatory.

  • Install BeautifulSoup: Required for HTML parsing.

  • Install the lxml parser: lxml is way faster than html.parser or html5lib.

  • Download an archive of your all your Facebook data.

    1. Log into Facebook.
    2. Navigate to settings.
    3. At the bottom of General Account Settings find the line of text that says "Download a copy of your Facebook data" and click the link.
    4. Follow the instructions on the next page.
    5. After your archive is compiled, you will receive an email with your download link.
    6. Extract your data dump. Your messages.htm file is located in ./html/messages.htm

Example

See examples for more.

Import fbmsgparse

from fbmsgparse import FbMsgParse

Create a FbMsgParse object with the path to your messages.htm document.

messages_path ='html/messages.htm'
fmp = FbMsgParse(messages_path)

Print out some stats

print(fmp.stats())

Use get_user_messages() to extract a list of all of a specified user's messages from threads with a minimum of 3 members.

u_id = '1234567890'
u_name = 'Name Surname'
msgs = fmp.get_user_messages(u_id, u_name, min_size=3)

Built With

License

This project is licensed under the MIT License - see the LICENSE file for details.

fbmsgparse's People

Contributors

avocadosconstant avatar nvander1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.