• This repository has been archived on 26/Jul/2023
  • Stars
    star
    189
  • Rank 204,649 (Top 5 %)
  • Language
    Python
  • Created about 10 years ago
  • Updated over 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A python script to download facebook chats

Facebook Message Scraper

A simple python script to download the entire conversation from Facebook, not limited like the one in the data dump provided by Facebook

Outputs the conversation in a JSON format, as well as the JSON for each individual chunk.

Initial Setup

Run for both dumper.py and group_dumper.py

  1. In Chrome, open facebook.com/messages and open any conversation with a fair number of messages
  2. Open the network tab of the Chrome Developer tools
  3. Scroll up in the conversation until the page attempts to load previous messages
  4. Look for the POST request to thread_info.php
  5. You need to copy certain parameters from this request into the python script to complete the setup:
  6. Set the cookie value to the value you see in Chrome under Request Headers
  7. Set the __user value to the value you see in Chrome under Form Data
  8. Set the __a value to the value you see in Chrome under Form Data
  9. Set the __dyn value to the value you see in Chrome under Form Data
  10. Set the __req value to the value you see in Chrome under Form Data
  11. Set the fb_dtsg value to the value you see in Chrome under Form Data
  12. Set the ttstamp value to the value you see in Chrome under Form Data
  13. Set the __rev value to the value you see in Chrome under Form Data

You're now all set to start downloading messages.

Downloading Messages

  1. Get the conversation ID for those messages by opening http://graph.facebook.com/{username-of-chat-partner}
  2. Copy the id value from there
  3. For group conversations, the ID can be retrieved from the messages tab, as part of the URL. You must use group_dumper.py instead.
  4. Run the command python dumper.py {id} 2000, and put the value you retrieved for ID earlier

Messages are saved by default to Messages/{id}/

Known Issues

The script sometimes has trouble with very large conversations (>100k messages). Facebook seems to rate limit this, and returns empty responses. In such cases, the script will retry after 30s until it gets a valid response.

It may take the script several tries to get a valid response. DO NOT PANIC.

Interrupting the execution before completion only leaves the JSON chunks, not the stitched file.

More Repositories

1

AndroidCircularSeekBar

A circular seek bar for Android
Java
285
star
2

ProAndroidAugmentedReality

Official repository for Pro Android Augmented Reality (http://www.apress.com/9781430239451)
Java
154
star
3

AppaholicsUpdateChecker

A free and open source library to check for and install updates for non app store apps.
Java
47
star
4

CompilingLauncher2

A compiling version of Launcher 2 from the Android ICS source code
Java
21
star
5

CompilingAndroidMail

Android mail client from AOSP modified to compile
Java
18
star
6

bitpeers

Go
13
star
7

UserManagement

A GUI app for Android 4.1 users to create and manage multiple accounts on rooted devices
Java
8
star
8

blockutils

A generic blockchain parsing utility package for golang
Go
5
star
9

ListViewFont

Sample project demonstrating how to use a custom font in all TextViews in a ListView.
Java
4
star
10

AppaholicsAndroid

Source code for the tutorials at appaholics.in
Java
3
star
11

GroupsPlus

A Facebook Group Enhancement Suite
JavaScript
3
star
12

IndianGeneralElections2014

Python
2
star
13

recovermykeystore

HTML
1
star
14

GeneralSnippetsJava

General snippets and full programs
Java
1
star
15

btcsupply

Tracks reductions in Bitcoin's supply through burns and bugs
Go
1
star
16

isbtc1m

Is BTC $1M yet?
Go
1
star
17

NeatMenu

Simple example code for a screen independant game level select menu
Java
1
star
18

LearnAndroid

Java
1
star
19

postmaster

A simple dashboard to track mail events from AWS SES
Go
1
star
20

taskmail

A golang program to email taskwarrior tasks
Go
1
star
21

spn2

Go
1
star
22

blockreward

A self contained, zero-dependency package to compute block rewards and supply for Bitcoin and Bitcoin-like chains
Go
1
star
23

raghavsood.github.io

HTML
1
star