GithubHelp home page GithubHelp logo

thepetrmarek / bot_u Goto Github PK

View Code? Open in Web Editor NEW
8.0 3.0 1.0 219 KB

Create chatbot out of your Facebook chat logs.

Home Page: http://petr-marek.com/blog/2017/02/25/create-immortal-copy-of-yourself-with-bot_u/

License: Apache License 2.0

Python 100.00%
chatbot facebook

bot_u's Introduction

Bot_U

Create chatbot out of your Facebook chat logs.

  • Download your Facebook chat logs
  • Put them into Bot_U
  • Enjoy immortal copy of yourself

Bot_U is written in the Python3 with usage of scikit-learn's TF-IDF.

Requirements

  • Python3
    • If you use Windows and you have problem with SciPy, then I recommend Anaconda which contains SciPy
  • scikit_learn
    • scikit_learn itself requires NumPy and SciPy
Warning!

Do not share your bot with anybody unless you are 100% sure that your chat logs don't contain any sensitive informations. Chatbot will use lines from your logs as answers, so it can answer with something which you don't want to share publicly. Clean your chat logs, if you want to share your chatbot. I don't have any responsibilities for problems caused by not following this advice.

USAGE

Facebook chat logs download

Facebook allows you to download your whole history of activities. We are interested in the chat logs. Following steps explains you how to get them.

1) Go to settings

Log into your Facebook account and go to Settings. Settings

2) Get a copy of your Facebook data

Go to General and click on Download a copy down on the page. Download a copy

3) Start the archivation

Click on the Start My Archive button. Confirm your action. Link to your archive will be send to your email. Start archivation

4) Get link to archive from your email

You will receive email with link to your archive after a while. Click on the link in the email. Email link

5) Download archive

Download your archive by clicking on Download Archive button. Download archive

6) Get chat logs

Open the downloaded archive. We are interested in the file html\messages.htm. Copy it somewhere, we will need it later. Logs file

Friendly remainder

You will download files containing your personal informations. Do not share them with anybody!

Running Bot_U

Copy file messages.htm into folder of Bot-u (that containing file main.py).

Install requirements by:

$ pip install -r requirements.txt

Run the Bot_U by:

$ py -3 main.py "John Smith"

Put your Facebook name instead of John Smith. The correct form of your name is the form in the file messages.html (open it and look there). Problem could be, if you have used several names. Choose one of them in such case.

Name

Name is used to parse messages from messages.htm file correctly. Bot-u will create file data.json containing parsed messages (you can use this file as dataset for your own chatbot running on different technology). You can start chatting with yourself right after message "I am ready! Let's chat.".

Possible problems

  • xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 100, column 0

    • This is caused by weird characters in messages.htm. The solution is to open this file in the text editor, go to the line causing error (line 100 in our example) and delete all weird characters.
  • xml.etree.ElementTree.ParseError: mismatched tag: line 100, column 0

    • This is caused by badly formatted tags in messages.htm (tags not in pair for example). The solution is to open this file in the text editor, go to the line causing error (line 100 in our example) and delete all badly formatted tags.

Pull requests adding connection to Facebook messenger are welcomed!

bot_u's People

Contributors

thepetrmarek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

databill86

bot_u's Issues

Parser not working with new messages.htm

Hi, thanks so much for this great tool! I have been doing some research on how to make this work with newly downloaded message archives and it seems Facebook changed the structure from one big messages html file to an index html which points to files 1,2,3.html. So the parser doesn't work with the new structure. Any tips on how to update the code to remedy this?
Thanks

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.