facebook-fetcher


Namefacebook-fetcher JSON
Version 1.0.2 PyPI version JSON
download
home_pagehttps://github.com/Andryerics/facebook_fetcher
SummaryFacebook scraper / Fetcher Unlimited by Andry RL
upload_time2024-08-09 14:11:28
maintainerNone
docs_urlNone
authorAndry RL
requires_python>=3.7
licenseMIT
keywords facebook-scraper facebook-parser facebook-scraper-without-apikey
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <a href="#">
  <div align="center">
    <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/b/b9/2023_Facebook_icon.svg/1024px-2023_Facebook_icon.svg.png" width='154'/>
  </div>
</a>

<div align = "center">
<h1>Facebook FETCHER - SCRAPER</h1>
<h1>Page / Profile, Post, All Recent Post, Group (and Video), Event</h1>
<p align="center">
	<a href="#"><img src="https://img.shields.io/pypi/dm/pytube?style=flat-square" alt="pypi"/></a>
	<a href="#"><img src="https://readthedocs.org/projects/python-pytube/badge/?version=latest&style=flat-square" /></a>
	<a href="#"><img src="https://img.shields.io/badge/any%20text-you%20like-blue" /></a>
  </p>
<p>Maximize your business's potential and gain a competitive edge with our <b>four separate</b> Facebook Scrapers for: <br><b>Profile, Page, Post, All Recent Post and Group (and Video)</b>

Scrape valuable user data for lead generation, research studies, targeted marketing, sentiment analysis, data-driven decision-making, and more. 
</p>
</div>

<hr>

<h3 align="center">🔥 Unlimited Facebook Scraper & Facebook Fetcher for free -> <a href="#price-">Clack 🤝</a></h3>

<hr>


# facebook_fetcher

**facebook_fetcher** is a simple library used for scraping Facebook web pages.

# Library Information
*Author:* [**Ă…ndry RL**](https://facebook.com/Andryerics)\
*Library:* [**facebook_fetcher**](https://github.com/MR-X-Junior/fbthon)\
*License:* [**MIT License**](https://github.com/Andryerics/facebook_fetcher/LICENSE)\
*Release:* **09**/08/20**24**\
*Version:* **0.0.2**

Since this library is still in its early version, it is likely to have many errors/bugs. If you encounter any errors/bugs in this library, feel free to post them on my [GitHub Issues](https://github.com/Andryerics/facebook_fetcher/issues) page :)

## Example of How to Use

```console
$ python -m pip install facebook_fetcher
```

### First, create a `Facebook` object

```python
>>> from facebook_fetcher import Facebook
>>> cookie = Facebook_account_cookie
>>> fb = Facebook(cookie)
```

```python
>>> from facebook_fetcher import Facebook
>>> from facebook_fetcher import Web_Login
>>> email = "example@gmail.com" # Replace this email with your Facebook account email
>>> password = "RedBullNoCounter321" # Replace this password with your Facebook account password
>>> login = Web_Login(email, password)
>>> cookie = login.get_cookie_str() # This is your Facebook account cookie
>>> fb = Facebook(cookie)
```

The method [above](#If-you-dont-have-a-Facebook-account-cookie-you-can-try-the-method-below) will log in to your Facebook account. This method may cause your Facebook account to encounter a checkpoint.

To reduce the risk of your account encountering a checkpoint, you just need to use the same user-agent as the device you last used to log in to your Facebook account.

```python
>>> from facebook_fetcher import Facebook
>>> from facebook_fetcher import Web_Login
>>> user_agent = {'User-Agent':'Mozilla/5.0 (Linux; Android 6.0.1; SM-J510GN Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.111 Mobile Safari/537.36'}
>>> email = "example@gmail.com" # Replace this email with your Facebook account email
>>> password = "RedBullNoCounter321" # Replace this password with your Facebook account password
>>> login = Web_Login(email, password, headers=user_agent)
>>> cookie = login.get_cookie_str() # This is your Facebook account cookie
>>> fb = Facebook(cookie)
```

#### Optional Parameters
*(For the `Web_Login` class)*.

- **email**: Facebook account email; you can also use an ID or username instead of an email
- **password**: Facebook account password
- **save_login**: Saves login information; the default value for this argument is `True`
- **free_facebook**: Use `True` if you want to use the [free.facebook.com](https://free.facebook.com) website; the default value for this argument is `False`
- **headers**: This is what will be used for the `requests` headers

### Extract Profile

The `get_profile` method can extract information from a Facebook account. This method will return a `User` object.


```python
>>> zuck = fb.get_profile('zuck')
>>> zuck.name
'Mark Zuckerberg'
>>> zuck.id
4
>>> zuck._user_info
{'name': 'Mark Zuckerberg', 'first_name': 'Mark', 'middle_name': '', 'last_name': 'Zuckerberg', 'alternate_name': '', 'about': "I'm trying to make the world a more open place.", 'username': '/zuck', 'id': '4', 'contact_info': {'Facebook': '/zuck'}, 'profile_pict': 'https://z-m-scontent.fsri1-1.fna.fbcdn.net/v/t39.30808-1/312257846_10114737758665291_6588360857015169674_n.jpg?stp=cp0_dst-jpg_e15_q65_s480x480&_nc_cat=1&ccb=1-7&_nc_sid=dbb9e7&efg=eyJpIjoiYiJ9&_nc_eui2=AeFzbmHFWdaxFtpefl6HFZsab3tzEriMmA5ve3MSuIyYDvNS3CLUOOX_Yzt_U3wSA0jeUIi3OK41Qr4CDF_Yeuxd&_nc_ohc=_tOCG5VpSrsAX8FPoj-&_nc_ad=z-m&_nc_cid=1225&_nc_eh=4613fe15e78ad080e57d79ac328ba3a7&_nc_rml=0&_nc_ht=z-m-scontent.fsri1-1.fna&oh=00_AfDS8wxbStTclGwnoPxoTGde0VDzjBQPguHMx3zTJulmkw&oe=6412E91E', 'basic_info': {'Tanggal Lahir': '14 Mei 1984', 'Jenis Kelamin': 'Laki-laki', 'Bahasa': 'English language dan Mandarin Chinese'}, 'education': [{'name': 'Harvard University', 'type': 'Computer Science and Psychology', 'study': '', 'time': '30 Agustus 2002 - 30 April 2004'}, {'name': 'Phillips Exeter Academy', 'type': 'Classics', 'study': '', 'time': 'Angkatan 2002'}, {'name': 'Ardsley High School', 'type': 'SMA', 'study': '', 'time': 'September 1998 - Juni 2000'}], 'work': [{'name': 'Chan Zuckerberg Initiative', 'time': '1 Desember 2015 - Sekarang'}, {'name': 'Meta', 'time': '4 Februari 2004 - Sekarang'}], 'living': [{'Kota Saat Ini': 'Palo Alto, California', 'Kota asal': 'Dobbs Ferry, New York'}], 'relationship': 'Berkeluarga dengan  Priscilla Chan  sejak 19 Mei 2012', 'other_name': [], 'family': [], 'year_overviews': [{'year': '2017', 'overviews': ['August Was Born', 'Harvard Degree']}, {'year': '2015', 'overviews': ['Memulai Pekerjaan Baru di Chan Zuckerberg Initiative', 'Max Lahir']}, {'year': '2012', 'overviews': ['Menikah dengan Priscilla Chan', 'Peristiwa Hidup Lain']}, {'year': '2011', 'overviews': ['Menjadi Vegetarian']}, {'year': '2010', 'overviews': ['Mulai Belajar Mandarin Chinese']}, {'year': '2009', 'overviews': ['Wore a Tie for a Whole Year']}, {'year': '2006', 'overviews': ['Launched News Feed']}, {'year': '2004', 'overviews': ['Launched the Wall', 'Memulai Pekerjaan Baru di Meta', 'Keluar dari Harvard University']}, {'year': '2002', 'overviews': ['Mulai Kuliah di Harvard University', 'Lulus dari Phillips Exeter Academy']}, {'year': '2000', 'overviews': ['Mulai Kuliah di Phillips Exeter Academy', 'Keluar dari Ardsley High School']}, {'year': '1998', 'overviews': ['Mulai Kuliah di Ardsley High School']}], 'quote': '"Fortune favors the bold."\n - Virgil, Aeneid X.284\n \n "All children are artists. The problem is how to remain an artist once you grow up." \n - Pablo Picasso\n \n "Make things as simple as possible but no simpler."\n - Albert Einstein'}
```

**Use `me` if you want to extract information from your own account**\
**Example**:


```python
>>> my_profile = fb.get_profile('me')
>>> my_profile.name
Rahmat
>>> my_profile.id
100053033144051
>>> my_profile.username
/Anjay.pro098
>>> my_profile._user_info
{'name': 'Rahmat', 'first_name': 'Rahmat', 'middle_name': '', 'last_name': '', 'alternate_name': 'Mat', 'about': '', 'username': '/Anjay.pro098', 'id': '100053033144051', 'contact_info': {'Ponsel': '0857-5462-9509', 'Facebook': '/Anjay.pro098', 'GitHub': 'MR-X-Junior', 'LinkedIn': 'rahmat-adha', 'Email': 'rahmadadha11@gmail.com'}, 'profile_pict': 'https://z-m-scontent.fsri1-1.fna.fbcdn.net/v/t39.30808-1/279908382_524601785984255_7727931677642432211_n.jpg?stp=cp0_dst-jpg_e15_p480x480_q65&_nc_cat=109&ccb=1-7&_nc_sid=dbb9e7&efg=eyJpIjoiYiJ9&_nc_eui2=AeEUCqxtmlmkSmx4EruhJj1ZoWFvcSuRApChYW9xK5ECkKEzjdDols3I7WDmPnas34nC8SsOQFYFy3zM38AIJfS1&_nc_ohc=XqfoPIkQwfkAX9oxiI4&tn=CoPUyHV9TcgsBjnY&_nc_ad=z-m&_nc_cid=1225&_nc_eh=4613fe15e78ad080e57d79ac328ba3a7&_nc_rml=0&_nc_ht=z-m-scontent.fsri1-1.fna&oh=00_AfByqAVLNVMSOfwr6pe43Iwr3HpWeVg0qImeiROkpw53rw&oe=63FCE8CF', 'basic_info': {'Tanggal Lahir': '13 Januari 2006', 'Jenis Kelamin': 'Laki-laki'}, 'education': [{'name': '', 'type': '', 'study': '', 'time': ''}], 'work': [], 'living': [{'Kota Saat Ini': 'Muaraancalung, Kalimantan Timur, Indonesia', 'Kota asal': 'Muaraancalung, Kalimantan Timur, Indonesia'}], 'relationship': 'Lajang', 'other_name': {'Nama panggilan': 'Met'}, 'family': [{'name': 'Pahrul Aguspriana XD.', 'username': '/PahrulXD', 'designation': 'Adik laki-laki', 'profile_pict': 'https://z-m-scontent.fsri1-1.fna.fbcdn.net/v/t39.30808-1/331028920_3040847712882567_3539568768564278719_n.jpg?stp=c0.0.320.320a_cp0_dst-jpg_e15_p320x320_q65&_nc_cat=101&ccb=1-7&_nc_sid=dbb9e7&efg=eyJpIjoiYiJ9&_nc_eui2=AeEW2pBM_jo0ZzypEALp1QB7eG7Nm80Gj5J4bs2bzQaPkmGYk_gZVtPSzsrb1SX796_BwslIoWRa_4yIuFC3x1Fh&_nc_ohc=NjtS1hHD7GcAX9Sp4HY&_nc_ad=z-m&_nc_cid=1225&_nc_eh=4613fe15e78ad080e57d79ac328ba3a7&_nc_rml=0&_nc_ht=z-m-scontent.fsri1-1.fna&oh=00_AfBGUpSnDzv3tHfsng6gWLn2ZGjNwSaFXzDLeCnlWv9Lsg&oe=63FDEBC2'}], 'year_overviews': [], 'quote': "i know i'm not alone"}
```

### Update Profile Picture
You can use the `UpdateProfilePicture` function to change your Facebook account's profile picture.

**Example:**

```python
from facebook_fetcher import settings
from facebook_fetcher import Facebook

fb = Facebook("datr=klr23aug21xxxxxxx") # Facebook Account Cookie 

settings.UpdateProfilePicture(fb, photo='/sdcard/DCIM/Orang-Susah.jpg')
```

#### Result

##### Before 

![Before Update Profile Picture](https://i.ibb.co/tzpq34P/IMG-20230419-202908.jpg)

##### After

![After Update Profile Picture](https://i.ibb.co/wJCp0HD/IMG-20230419-203029.jpg)

### Get Notifications
You can use the `get_notifications` method to retrieve the latest notifications from your Facebook account.

**Example:**


```python
no = fb.get_notifications(limit = 2)

for chaa in no:
  print ("Message : "+ chaa['message'])
  print ("Time : "+ chaa['time'])
  print ("Redirect URL : "+ chaa['redirect_url'] + "\n")
```

**Output:**

```
Message: Based on pages that interact with you, you might like Meme Upin Ipin Comic Lucu.                               
Time: April 11                                                         
Redirect URL: https://mbasic.facebook.com/a/notifications.php?redir=%2Fgroups%2F426298749190770%2F&seennotification=1681152051803754&eav=AfbWn5_N4XPZ0dL2bdBlHmCJIqmlGanPyx8_K3EuoQ47EREpeYdQtHn-1DmRfQaTNE0&gfid=AQDZ4pcYOl5JlPJd0uw&paipv=0&refid=48                                 

Message: Based on pages that interact with you, you might like Mukbang Yummy Food.
                                
Time : 8 Apr
Redirect URL : https://mbasic.facebook.com/a/notifications.php?redir=%2Fgroups%2F340989278132975%2F&seennotification=1680900355646527&eav=AfZlnRarakilRKNOhz6fPULFLUjDyccZvOhpJFhWEAy2un9H6EbgdPZ7Zii39UuMazc&gfid=AQBuf1_B6NbYKhXjCv8&paipv=0&refid=48
```

### Get Posts

The `get_posts` method will collect and extract posts, and this method will return a `list` containing a collection of `Posts` objects.

**NOTE: THIS METHOD CAN ONLY COLLECT POSTS FROM USER ACCOUNTS, IT CANNOT COLLECT POSTS FROM GROUPS OR PAGES.**

```python
for x in fb.get_posts('zuck', limit = 2):
   print("Author : "+x.author)
   print("Caption: "+x.caption)
   print("Upload Time "+ x.upload_time + "\n\n")
```

#### Output
```python
Author : Mark Zuckerberg
Caption: When Priscilla and I started working on the Chan Zuckerberg Initiative's science mission to help cure, prevent or manage all diseases, our first major project was launching the Biohub. It has been very successful, so today we're launching a second Biohub in Chicago that will engineer miniaturized sensors to instrument living tissues to help scientists see and understand how cells work together. We're going to start by instrumenting skin and heart tissues with an initial focus on measuring inflammation. About 50% of deaths are caused by diseases related to inflammation, like cancer and heart disease, so we're hopeful the technology created at the Chicago Biohub will have broad applications for science and health similar to the San Francisco Biohub.
Upload Time 2 Maret pukul 16.00


Author : Mark Zuckerberg
Caption: We're creating a new top-level product group at Meta focused on generative AI to turbocharge our work in this area. We're starting by pulling together a lot of the teams working on generative AI across the company into one group focused on building delightful experiences around this technology into all of our different products. In the short term, we'll focus on building creative and expressive tools. Over the longer term, we'll focus on developing AI personas that can help people in a variety of ways. We're exploring experiences with text (like chat in WhatsApp and Messenger), with images (like creative Instagram filters and ad formats), and with video and multi-modal experiences. We have a lot of foundational work to do before getting to the really futuristic experiences, but I'm excited about all of the new things we'll build along the way.
Upload Time 27 Februari pukul 20.50
```

### Post Parser

The `post_parser` method is used to extract posts, and this method will return a `Posts` object.


```python
>>> post = fb.post_parser("https://m.facebook.com/story.php?story_fbid=pfbid02kbL4vnSF4Ex88nBQrMZdvjUoWV7hhznHZ8BpMcFAJzjL2CEoBCAHeHEk4Y8DLAQ5l&id=100053033144051&mibextid=Nif5oz")
>>> post.author
Rahmat
>>> post.caption
Hello World 🌍
>>> post.post_file
{'image': [{'link': 'https://z-m-scontent.fsri1-1.fna.fbcdn.net/v/t39.30808-6/241434705_371774571266978_6844800659294160676_n.jpg?stp=cp0_dst-jpg_e15_fr_q65&_nc_cat=104&ccb=1-7&_nc_sid=110474&efg=eyJpIjoiYiJ9&_nc_eui2=AeE-bGgqsChJWa0bm9hnBZ-c9HuYP8xaWmP0e5g_zFpaYypDCKSWUSxTvpaIdTGIXCGEzD4653spgkhYVI1L37UK&_nc_ohc=3B_9FgPbsqgAX_k1QAl&_nc_ad=z-m&_nc_cid=1225&_nc_eh=4613fe15e78ad080e57d79ac328ba3a7&_nc_zt=23&_nc_rml=0&_nc_ht=z-m-scontent.fsri1-1.fna&oh=00_AfB8x_I9eObguAKc3CVt2A1dYWAYrLDpzMOnD3CnvfM4wg&oe=641513CF', 'id': '241434705_371774571266978_6844800659294160676', 'preview': 'https://z-m-scontent.fsri1-1.fna.fbcdn.net/v/t39.30808-6/241434705_371774571266978_6844800659294160676_n.jpg?stp=cp0_dst-jpg_e15_p526x296_q65&_nc_cat=104&ccb=1-7&_nc_sid=110474&efg=eyJpIjoiYiJ9&_nc_eui2=AeE-bGgqsChJWa0bm9hnBZ-c9HuYP8xaWmP0e5g_zFpaYypDCKSWUSxTvpaIdTGIXCGEzD4653spgkhYVI1L37UK&_nc_ohc=3B_9FgPbsqgAX_k1QAl&_nc_ad=z-m&_nc_cid=1225&_nc_eh=4613fe15e78ad080e57d79ac328ba3a7&_nc_zt=23&_nc_rml=0&_nc_ht=z-m-scontent.fsri1-1.fna&oh=00_AfD3FkrA5grtqsZFr7LoQKSVpQToVBhEXRqC3ntmUjB5Hw&oe=641513CF', 'content-type': 'image/jpeg'}], 'video': []}
>>> post.upload_time
17 Mei 2021 pukul 13.15
>>> post.post_datetime
datetime.datetime(2021, 5, 17, 21, 15, 17)
>>> post.get_react()
{'like': 5652, 'love': 310, 'care': 9, 'haha': 6, 'wow': 252, 'sad': 0, 'angry': 1}
```

#### Sending Comments

You can use the `send_comment` method to post a comment.
The `send_comment` method will return `True` if the comment is successfully sent.

**Example:**


```python
>>> post = fb.post_parser('https://m.facebook.com/story.php?story_fbid=pfbid0h1BPgqZsa4seKWoqn7c6GqDyAD3vKUePuasDRHuZCyN46M4uuAVy4m4fAukRvaojl&id=100053033144051&mibextid=Nif5oz')
>>> post.send_comment('Hallo kak '+post.author +'\n\nKomentar ini di tulis menggunakan library fbthon :)')
True
```

##### Result
**See the comment at the bottom**

![Example of how to send a comment](https://i.ibb.co/QFDpnw9/Screenshot-20230322-064024.jpg)

To add a photo to the comment, you can use the `file` argument.

**Example:**


```python
>>> post = fb.post_parser('https://m.facebook.com/story.php?story_fbid=pfbid02kTobxSiD9buMUEjrq57FFnhQ6FJyGnafmNhMimoaamoAwuECAjboYaB6mE7C7pPZl&id=100053033144051&mibextid=Nif5oz')
>>> post.send_comment("Komentar ini tidak di sertai dengan foto!")
True
>>> post.send_comment("Komentar ini di sertai dengan foto!", file = "/sdcard/DCIM/Facebook/FB_IMG_1681559707400.jpg")
True
```

##### Result

![Example of sending a comment with a photo](https://i.ibb.co/6vd6BQc/IMG-20230418-110223.jpg)

#### Reacting to Posts

You can use the `send_react` method to react to a post.
This method will return `True` if the reaction is successfully applied to the post.


```python
>>> post = fb.post_parser(Link_post_facebook)
>>> post.send_react(react_type)
True
```

There are 7 reaction types, including:
- Like
- Love
- Care
- Haha
- Wow
- Sad
- Angry

**Example of how to send a reaction:**

```python
>>> post = fb.post_parser('https://m.facebook.com/story.php?story_fbid=pfbid0h1BPgqZsa4seKWoqn7c6GqDyAD3vKUePuasDRHuZCyN46M4uuAVy4m4fAukRvaojl&id=100053033144051&mibextid=Nif5oz')
>>> post.send_react('Wow')
True
```

##### Result
![Example of reacting to a post](https://i.ibb.co/SPXGWJJ/Screenshot-2023-0322-065521.png)

##### Sharing a Post
You can use the `share_post` method to share someone else's post to your Facebook account.

**Example (1):**


```python
post = fb.post_parser("https://m.facebook.com/story.php?story_fbid=pfbid0gxnxN5dZDDA93S2GveyxqgSzEdYdAtdE32PYyAd7iftDS7yBHprBACc9VcFXDoPtl&id=100053033144051&mibextid=Nif5oz")
post.share_post()
```

##### Result

![Example of sharing a post](https://i.ibb.co/F39c30w/IMG-20230419-064244.jpg)

**Example (2):**

You can also add `message`, `location`, and `feeling` to the shared post.


```python
post = fb.post_parser("https://m.facebook.com/story.php?story_fbid=pfbid0gxnxN5dZDDA93S2GveyxqgSzEdYdAtdE32PYyAd7iftDS7yBHprBACc9VcFXDoPtl&id=100053033144051&mibextid=Nif5oz")
post.share_post(message = "Postingan ini di bagikan menggunakan library fbthon", location = "Kuningan Timur", feeling = "Happy")
```

##### Result
![Example of sharing a post with message, location, and feeling](https://i.ibb.co/7J1wzB2/IMG-20230419-070541.jpg)

### Messenger

The `Messenger` object can be used to send/receive chats.\
There are 2 ways to create a `Messenger` object:

**Method 1**

```python
>>> msg = fb.Messenger()
```
**Method 2**

```python
>>> from facebook_fetcher import Messenger
>>> msg = Messenger(Your_Facebook_Account_Cookie)
```


#### Getting New Messages
The `get_new_message` method can be used to retrieve new messages :)

```python
for x in msg.get_new_message(limit=3):
   print("Name: " + x['name'])
   print("Account ID: " + x['id'])
   print("Last Chat: " + x['last_chat'])
   print("Time: " + x['time'] + "\n\n")


```

##### Output

```python
Name: Khaneysia                        
Account ID: 1000xxxxxxxxxxx
Last Chat: Good Night sayang :)
Time: 5 minutes ago

Name: Rahmat
Account ID: 100053033144051
Last Chat: Hallo Kak Rahmat :)
Time: 11 minutes ago

Name: Mark Zuckerberg
Account ID: 4
Last Chat: Ban my account, please                          
Time: March 4

```

The `get_new_chat` method can also be used to retrieve new messages, but this method is different from the `get_new_message` method.

```python
>>> msg.get_new_message(limit = 3)
[{'name': 'Khaneysia', 'id': '1000xxxxxxxxxxx', 'last_chat': 'Good Night sayang :)', 'time': '23 menit lalu'}, {'name': 'Rahmat', 'id': '100053033144051', 'last_chat': 'Hallo Kak Rahmat:)', 'time': '34 menit lalu'}, {'name': 'Mark Zuckerberg', 'id': '4', 'last_chat': 'Hello Mark Zuckerberg', 'time': '4 Mar'}]
>>> msg.get_new_chat(limit = 3)
[Facebook Chats : name='Mark Zuckerberg' id=4 chat_id=4:100090156622219 type='user', Facebook Chats : name='Khaneysia' id=1000xxxxxxxxxxx chat_id=1000xxxxxxxxxxx:100090156622219 type='user', Facebook Chats : name='Rahmat' id=100053033144051 chat_id=100053033144051:100090156622219 type='user']
```

From the code above, we can conclude the difference between the `get_new_message` and `get_new_chat` methods.

The `get_new_message` method returns a `list` containing a collection of `dict` objects, whereas the `get_new_chat` method returns a `list` containing a collection of `Chats` objects.

#### Sending Messages

You can use the `new_chat` method to send messages. This method will return a `Chats` object.


```python
with msg.new_chat('zuck') as chat:
  chat.send_text('Assalamualaikum')
  chat.send_text('Hallo om '+ chat.name)
  chat.send_text('Apa kabar?')
  chat.send_text('Pesan ini di kirim menggunakan library fbthon:)\n\nTerima kasih Sudah membaca chat saya.')
```

##### Result
![Example of Sending a Message](https://i.ibb.co/fQHtDmb/Screenshot-20230317-222932.jpg)

You can use the `send_image` method to send a chat with a photo.

**Example:**


```python
with msg.new_chat("Anjay.pro098") as chat:
  chat.send_text("Hallo kak "+chat.name)
  chat.send_text("Pesan ini di kirim menggunakan library fbthon :)")
  chat.send_image(file = "/sdcard/DCIM/Facebook/FB_IMG_1681559707400.jpg",message = "Aku ketika nunggu buka puasa : ")
  chat.send_like_stiker()
```

##### Result
![Example of sending a chat with a photo](https://i.ibb.co/FVgZ7Mf/IMG-20230418-184806.jpg)

## Creating Posts
The `create_timeline` method can be used to create posts. This method will return `True` if the post is successfully created.

### Creating a Post (Caption Only)

```python
>>> fb.create_timeline(target='me', message='This post was created using the fbthon library\n\nHehe :>')
True
```

#### Result
![Creating a Post (Caption Only)](https://i.ibb.co/wB998Yd/Screenshot-2023-0317-224853.png)

### Creating a Post on a Friend's Account
To create a post on a friend's account, you just need to change the `target` parameter to the ID or username of your friend :)

**Example:**

```python
>>> fb.create_timeline(target='Friend’s ID or username', message='This post was created using the fbthon library\n\nHehe :>')
True
```

#### Result
![Creating a Post (Caption Only) on a Friend’s Facebook Account](https://i.ibb.co/cTwRYDh/IMG-20230318-181857.jpg)

### Creating a Post (Tagging Friends)
To tag friends in a post, you can use the `users_with` argument.

```python
>>> fb.create_timeline(target='me', message='This post was created using the fbthon library\n\nHehe :>', users_with='friend’s Facebook ID')
True
```

#### Result
![Creating a Post (Tagging Friends)](https://i.ibb.co/tbHKb0x/IMG-20230322-072612.jpg)

### Creating a Post (With Photo)
You can use the `file` argument to add a photo to your post :)

```python
>>> fb.create_timeline(target='me', message='Alhamdulillah :)', file='/sdcard/Pictures/Certificate/mimo-certificates-125_page-0001.jpg')
True
```

#### Result
![Creating a Post (With Photo)](https://i.ibb.co/d4nKvVr/Screenshot-2023-0318-151426.png)

Also, you can use the `filter_type` argument to apply a filter to the photo you are uploading.

```python
>>> fb.create_timeline(target='me', message='Alhamdulillah :)', file='/sdcard/Pictures/Certificate/mimo-certificates-125_page-0001.jpg', filter_type='1')
True
```

And here is the result:

![Applying a Filter to a Photo](https://i.ibb.co/twf0tnc/Screenshot-2023-0323-082948.png)

**There are several filter types you can try, including:**
- No Filter = -1
- Black and White = 1
- Retro = 2

### Creating a Post (With Location)
You can use the `location` argument to add a location to your post.

```python
>>> fb.create_timeline(target='me', message='This post was created using the fbthon library\n\nHehe :>', location='Muaraancalung, Kalimantan Timur')
True
```

#### Result
![Creating a Post (With Location)](https://i.ibb.co/vh5zh05/Screenshot-2023-0318-145829.png)

### Creating a Post (With Feeling)
You can use the `feeling` argument to add a feeling to your post.

```python
>>> fb.create_timeline(target='me', message='This post was created using the fbthon library\n\nHehe :>', feeling='Happy')
True
```

#### Result
![Creating a Post (With Feeling)](https://i.ibb.co/n7yp62b/Screenshot-2023-0318-152335.png)

### Create a Facebook Account
You can use the `CreateAccount` class to create a Facebook account.

**NOTE: This feature is still experimental, so it may not work reliably.**

#### Example:

Below is a simple program to create a Facebook account.

```python
import sys
from facebook_fetcher import CreateAccount

print("[+] Create Facebook Account [+]\n")

firstname = input("[?] First Name: ") # First Name
lastname = input("[?] Last Name: ") # Last Name
email = input("[?] Email/Phone: ") # Email Address / Phone Number
gender = input("[?] Gender (Male/Female): ") # Gender
birthday = input("[?] Date of Birth (DD/MM/YYYY): ") # Date of Birth
password = input("[?] Password: ") # Password

new_account = CreateAccount(firstname=firstname, lastname=lastname, email=email, gender=gender, date_of_birth=birthday, password=password)

print("\n[+] Enter the verification code sent to " + email)
verification_code = input("[?] Verification Code: ")

# The `confirm_account` method will return `True` if the account is successfully confirmed.
confirmation = new_account.confirm_account(verification_code)

if confirmation:
    print("[âś“] Successfully Created Facebook Account :)\n")
    print("[+] Account Name: %s %s" % (firstname, lastname))
    print("[+] Account ID: %s" % (new_account.get_cookie_dict()['c_user']))
    print("[+] Email/Phone: %s" % (email))
    print("[+] Gender: %s" % (gender))
    print("[+] Date of Birth: %s" % (birthday))
    print("[+] Password: %s" % (password))
    print("[+] Account Cookie: %s" % (new_account.get_cookie_str()))
    print("[+] Account Token: %s" % (new_account.get_token()))
    sys.exit(0)
else:
    print("[!] Failed to Create Facebook Account")
    sys.exit(1)
```

##### Running the Program
![Running the script to create a Facebook account using the fbthon library](https://i.ibb.co/2Sd19Wc/Screenshot-2023-0420-093249.png)

###### Result
This is the account created using the fbthon library :)

![This is a Facebook account created using the fbthon library](https://i.ibb.co/7K3q3hj/Screenshot-20230420-093826.jpg)

#### Optional Parameters
*(For the `CreateAccount` class)*

- **firstname**: First Name
- **lastname**: Last Name
- **email**: Email address to be used for registering a Facebook account. You can also use a phone number instead of an email address.
- **gender**: Gender (Male/Female)
- **date_of_birth**: Date of birth in the format DD/MM/YYYY, Example: 13/01/2006
- **password**: Password to be used for creating the Facebook account.

# Installation

**fbthon** is available on PyPi.


```console
$ python -m pip install facebook_fetcher
```

**fbthon** can be installed on Python version 3.7+.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Andryerics/facebook_fetcher",
    "name": "facebook-fetcher",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "facebook-scraper, facebook-parser, facebook-scraper-without-apikey",
    "author": "Andry RL",
    "author_email": "andryerics@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/36/75/d8f01f1f870ffde5fc86c6b3a942da1fed592cd897e73a8d41bcf5fbb3aa/facebook_fetcher-1.0.2.tar.gz",
    "platform": null,
    "description": "<a href=\"#\">\n  <div align=\"center\">\n    <img src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/b/b9/2023_Facebook_icon.svg/1024px-2023_Facebook_icon.svg.png\" width='154'/>\n  </div>\n</a>\n\n<div align = \"center\">\n<h1>Facebook FETCHER - SCRAPER</h1>\n<h1>Page / Profile, Post, All Recent Post, Group (and Video), Event</h1>\n<p align=\"center\">\n\t<a href=\"#\"><img src=\"https://img.shields.io/pypi/dm/pytube?style=flat-square\" alt=\"pypi\"/></a>\n\t<a href=\"#\"><img src=\"https://readthedocs.org/projects/python-pytube/badge/?version=latest&style=flat-square\" /></a>\n\t<a href=\"#\"><img src=\"https://img.shields.io/badge/any%20text-you%20like-blue\" /></a>\n  </p>\n<p>Maximize your business's potential and gain a competitive edge with our <b>four separate</b> Facebook Scrapers for: <br><b>Profile, Page, Post, All Recent Post and Group (and Video)</b>\n\nScrape valuable user data for lead generation, research studies, targeted marketing, sentiment analysis, data-driven decision-making, and more. \n</p>\n</div>\n\n<hr>\n\n<h3 align=\"center\">\ud83d\udd25 Unlimited Facebook Scraper & Facebook Fetcher for free -> <a href=\"#price-\">Clack \ud83e\udd1d</a></h3>\n\n<hr>\n\n\n# facebook_fetcher\n\n**facebook_fetcher** is a simple library used for scraping Facebook web pages.\n\n# Library Information\n*Author:* [**\u00c5ndry RL**](https://facebook.com/Andryerics)\\\n*Library:* [**facebook_fetcher**](https://github.com/MR-X-Junior/fbthon)\\\n*License:* [**MIT License**](https://github.com/Andryerics/facebook_fetcher/LICENSE)\\\n*Release:* **09**/08/20**24**\\\n*Version:* **0.0.2**\n\nSince this library is still in its early version, it is likely to have many errors/bugs. If you encounter any errors/bugs in this library, feel free to post them on my [GitHub Issues](https://github.com/Andryerics/facebook_fetcher/issues) page :)\n\n## Example of How to Use\n\n```console\n$ python -m pip install facebook_fetcher\n```\n\n### First, create a `Facebook` object\n\n```python\n>>> from facebook_fetcher import Facebook\n>>> cookie = Facebook_account_cookie\n>>> fb = Facebook(cookie)\n```\n\n```python\n>>> from facebook_fetcher import Facebook\n>>> from facebook_fetcher import Web_Login\n>>> email = \"example@gmail.com\" # Replace this email with your Facebook account email\n>>> password = \"RedBullNoCounter321\" # Replace this password with your Facebook account password\n>>> login = Web_Login(email, password)\n>>> cookie = login.get_cookie_str() # This is your Facebook account cookie\n>>> fb = Facebook(cookie)\n```\n\nThe method [above](#If-you-dont-have-a-Facebook-account-cookie-you-can-try-the-method-below) will log in to your Facebook account. This method may cause your Facebook account to encounter a checkpoint.\n\nTo reduce the risk of your account encountering a checkpoint, you just need to use the same user-agent as the device you last used to log in to your Facebook account.\n\n```python\n>>> from facebook_fetcher import Facebook\n>>> from facebook_fetcher import Web_Login\n>>> user_agent = {'User-Agent':'Mozilla/5.0 (Linux; Android 6.0.1; SM-J510GN Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.111 Mobile Safari/537.36'}\n>>> email = \"example@gmail.com\" # Replace this email with your Facebook account email\n>>> password = \"RedBullNoCounter321\" # Replace this password with your Facebook account password\n>>> login = Web_Login(email, password, headers=user_agent)\n>>> cookie = login.get_cookie_str() # This is your Facebook account cookie\n>>> fb = Facebook(cookie)\n```\n\n#### Optional Parameters\n*(For the `Web_Login` class)*.\n\n- **email**: Facebook account email; you can also use an ID or username instead of an email\n- **password**: Facebook account password\n- **save_login**: Saves login information; the default value for this argument is `True`\n- **free_facebook**: Use `True` if you want to use the [free.facebook.com](https://free.facebook.com) website; the default value for this argument is `False`\n- **headers**: This is what will be used for the `requests` headers\n\n### Extract Profile\n\nThe `get_profile` method can extract information from a Facebook account. This method will return a `User` object.\n\n\n```python\n>>> zuck = fb.get_profile('zuck')\n>>> zuck.name\n'Mark Zuckerberg'\n>>> zuck.id\n4\n>>> zuck._user_info\n{'name': 'Mark Zuckerberg', 'first_name': 'Mark', 'middle_name': '', 'last_name': 'Zuckerberg', 'alternate_name': '', 'about': \"I'm trying to make the world a more open place.\", 'username': '/zuck', 'id': '4', 'contact_info': {'Facebook': '/zuck'}, 'profile_pict': 'https://z-m-scontent.fsri1-1.fna.fbcdn.net/v/t39.30808-1/312257846_10114737758665291_6588360857015169674_n.jpg?stp=cp0_dst-jpg_e15_q65_s480x480&_nc_cat=1&ccb=1-7&_nc_sid=dbb9e7&efg=eyJpIjoiYiJ9&_nc_eui2=AeFzbmHFWdaxFtpefl6HFZsab3tzEriMmA5ve3MSuIyYDvNS3CLUOOX_Yzt_U3wSA0jeUIi3OK41Qr4CDF_Yeuxd&_nc_ohc=_tOCG5VpSrsAX8FPoj-&_nc_ad=z-m&_nc_cid=1225&_nc_eh=4613fe15e78ad080e57d79ac328ba3a7&_nc_rml=0&_nc_ht=z-m-scontent.fsri1-1.fna&oh=00_AfDS8wxbStTclGwnoPxoTGde0VDzjBQPguHMx3zTJulmkw&oe=6412E91E', 'basic_info': {'Tanggal Lahir': '14 Mei 1984', 'Jenis Kelamin': 'Laki-laki', 'Bahasa': 'English language dan Mandarin Chinese'}, 'education': [{'name': 'Harvard University', 'type': 'Computer Science and Psychology', 'study': '', 'time': '30 Agustus 2002 - 30 April 2004'}, {'name': 'Phillips Exeter Academy', 'type': 'Classics', 'study': '', 'time': 'Angkatan 2002'}, {'name': 'Ardsley High School', 'type': 'SMA', 'study': '', 'time': 'September 1998 - Juni 2000'}], 'work': [{'name': 'Chan Zuckerberg Initiative', 'time': '1 Desember 2015 - Sekarang'}, {'name': 'Meta', 'time': '4 Februari 2004 - Sekarang'}], 'living': [{'Kota Saat Ini': 'Palo Alto, California', 'Kota asal': 'Dobbs Ferry, New York'}], 'relationship': 'Berkeluarga dengan  Priscilla Chan  sejak 19 Mei 2012', 'other_name': [], 'family': [], 'year_overviews': [{'year': '2017', 'overviews': ['August Was Born', 'Harvard Degree']}, {'year': '2015', 'overviews': ['Memulai Pekerjaan Baru di Chan Zuckerberg Initiative', 'Max Lahir']}, {'year': '2012', 'overviews': ['Menikah dengan Priscilla Chan', 'Peristiwa Hidup Lain']}, {'year': '2011', 'overviews': ['Menjadi Vegetarian']}, {'year': '2010', 'overviews': ['Mulai Belajar Mandarin Chinese']}, {'year': '2009', 'overviews': ['Wore a Tie for a Whole Year']}, {'year': '2006', 'overviews': ['Launched News Feed']}, {'year': '2004', 'overviews': ['Launched the Wall', 'Memulai Pekerjaan Baru di Meta', 'Keluar dari Harvard University']}, {'year': '2002', 'overviews': ['Mulai Kuliah di Harvard University', 'Lulus dari Phillips Exeter Academy']}, {'year': '2000', 'overviews': ['Mulai Kuliah di Phillips Exeter Academy', 'Keluar dari Ardsley High School']}, {'year': '1998', 'overviews': ['Mulai Kuliah di Ardsley High School']}], 'quote': '\"Fortune favors the bold.\"\\n - Virgil, Aeneid X.284\\n \\n \"All children are artists. The problem is how to remain an artist once you grow up.\" \\n - Pablo Picasso\\n \\n \"Make things as simple as possible but no simpler.\"\\n - Albert Einstein'}\n```\n\n**Use `me` if you want to extract information from your own account**\\\n**Example**:\n\n\n```python\n>>> my_profile = fb.get_profile('me')\n>>> my_profile.name\nRahmat\n>>> my_profile.id\n100053033144051\n>>> my_profile.username\n/Anjay.pro098\n>>> my_profile._user_info\n{'name': 'Rahmat', 'first_name': 'Rahmat', 'middle_name': '', 'last_name': '', 'alternate_name': 'Mat', 'about': '', 'username': '/Anjay.pro098', 'id': '100053033144051', 'contact_info': {'Ponsel': '0857-5462-9509', 'Facebook': '/Anjay.pro098', 'GitHub': 'MR-X-Junior', 'LinkedIn': 'rahmat-adha', 'Email': 'rahmadadha11@gmail.com'}, 'profile_pict': 'https://z-m-scontent.fsri1-1.fna.fbcdn.net/v/t39.30808-1/279908382_524601785984255_7727931677642432211_n.jpg?stp=cp0_dst-jpg_e15_p480x480_q65&_nc_cat=109&ccb=1-7&_nc_sid=dbb9e7&efg=eyJpIjoiYiJ9&_nc_eui2=AeEUCqxtmlmkSmx4EruhJj1ZoWFvcSuRApChYW9xK5ECkKEzjdDols3I7WDmPnas34nC8SsOQFYFy3zM38AIJfS1&_nc_ohc=XqfoPIkQwfkAX9oxiI4&tn=CoPUyHV9TcgsBjnY&_nc_ad=z-m&_nc_cid=1225&_nc_eh=4613fe15e78ad080e57d79ac328ba3a7&_nc_rml=0&_nc_ht=z-m-scontent.fsri1-1.fna&oh=00_AfByqAVLNVMSOfwr6pe43Iwr3HpWeVg0qImeiROkpw53rw&oe=63FCE8CF', 'basic_info': {'Tanggal Lahir': '13 Januari 2006', 'Jenis Kelamin': 'Laki-laki'}, 'education': [{'name': '', 'type': '', 'study': '', 'time': ''}], 'work': [], 'living': [{'Kota Saat Ini': 'Muaraancalung, Kalimantan Timur, Indonesia', 'Kota asal': 'Muaraancalung, Kalimantan Timur, Indonesia'}], 'relationship': 'Lajang', 'other_name': {'Nama panggilan': 'Met'}, 'family': [{'name': 'Pahrul Aguspriana XD.', 'username': '/PahrulXD', 'designation': 'Adik laki-laki', 'profile_pict': 'https://z-m-scontent.fsri1-1.fna.fbcdn.net/v/t39.30808-1/331028920_3040847712882567_3539568768564278719_n.jpg?stp=c0.0.320.320a_cp0_dst-jpg_e15_p320x320_q65&_nc_cat=101&ccb=1-7&_nc_sid=dbb9e7&efg=eyJpIjoiYiJ9&_nc_eui2=AeEW2pBM_jo0ZzypEALp1QB7eG7Nm80Gj5J4bs2bzQaPkmGYk_gZVtPSzsrb1SX796_BwslIoWRa_4yIuFC3x1Fh&_nc_ohc=NjtS1hHD7GcAX9Sp4HY&_nc_ad=z-m&_nc_cid=1225&_nc_eh=4613fe15e78ad080e57d79ac328ba3a7&_nc_rml=0&_nc_ht=z-m-scontent.fsri1-1.fna&oh=00_AfBGUpSnDzv3tHfsng6gWLn2ZGjNwSaFXzDLeCnlWv9Lsg&oe=63FDEBC2'}], 'year_overviews': [], 'quote': \"i know i'm not alone\"}\n```\n\n### Update Profile Picture\nYou can use the `UpdateProfilePicture` function to change your Facebook account's profile picture.\n\n**Example:**\n\n```python\nfrom facebook_fetcher import settings\nfrom facebook_fetcher import Facebook\n\nfb = Facebook(\"datr=klr23aug21xxxxxxx\") # Facebook Account Cookie \n\nsettings.UpdateProfilePicture(fb, photo='/sdcard/DCIM/Orang-Susah.jpg')\n```\n\n#### Result\n\n##### Before \n\n![Before Update Profile Picture](https://i.ibb.co/tzpq34P/IMG-20230419-202908.jpg)\n\n##### After\n\n![After Update Profile Picture](https://i.ibb.co/wJCp0HD/IMG-20230419-203029.jpg)\n\n### Get Notifications\nYou can use the `get_notifications` method to retrieve the latest notifications from your Facebook account.\n\n**Example:**\n\n\n```python\nno = fb.get_notifications(limit = 2)\n\nfor chaa in no:\n  print (\"Message : \"+ chaa['message'])\n  print (\"Time : \"+ chaa['time'])\n  print (\"Redirect URL : \"+ chaa['redirect_url'] + \"\\n\")\n```\n\n**Output:**\n\n```\nMessage: Based on pages that interact with you, you might like Meme Upin Ipin Comic Lucu.                               \nTime: April 11                                                         \nRedirect URL: https://mbasic.facebook.com/a/notifications.php?redir=%2Fgroups%2F426298749190770%2F&seennotification=1681152051803754&eav=AfbWn5_N4XPZ0dL2bdBlHmCJIqmlGanPyx8_K3EuoQ47EREpeYdQtHn-1DmRfQaTNE0&gfid=AQDZ4pcYOl5JlPJd0uw&paipv=0&refid=48                                 \n\nMessage: Based on pages that interact with you, you might like Mukbang Yummy Food.\n                                \nTime : 8 Apr\nRedirect URL : https://mbasic.facebook.com/a/notifications.php?redir=%2Fgroups%2F340989278132975%2F&seennotification=1680900355646527&eav=AfZlnRarakilRKNOhz6fPULFLUjDyccZvOhpJFhWEAy2un9H6EbgdPZ7Zii39UuMazc&gfid=AQBuf1_B6NbYKhXjCv8&paipv=0&refid=48\n```\n\n### Get Posts\n\nThe `get_posts` method will collect and extract posts, and this method will return a `list` containing a collection of `Posts` objects.\n\n**NOTE: THIS METHOD CAN ONLY COLLECT POSTS FROM USER ACCOUNTS, IT CANNOT COLLECT POSTS FROM GROUPS OR PAGES.**\n\n```python\nfor x in fb.get_posts('zuck', limit = 2):\n   print(\"Author : \"+x.author)\n   print(\"Caption: \"+x.caption)\n   print(\"Upload Time \"+ x.upload_time + \"\\n\\n\")\n```\n\n#### Output\n```python\nAuthor : Mark Zuckerberg\nCaption: When Priscilla and I started working on the Chan Zuckerberg Initiative's science mission to help cure, prevent or manage all diseases, our first major project was launching the Biohub. It has been very successful, so today we're launching a second Biohub in Chicago that will engineer miniaturized sensors to instrument living tissues to help scientists see and understand how cells work together. We're going to start by instrumenting skin and heart tissues with an initial focus on measuring inflammation. About 50% of deaths are caused by diseases related to inflammation, like cancer and heart disease, so we're hopeful the technology created at the Chicago Biohub will have broad applications for science and health similar to the San Francisco Biohub.\nUpload Time 2 Maret pukul 16.00\n\n\nAuthor : Mark Zuckerberg\nCaption: We're creating a new top-level product group at Meta focused on generative AI to turbocharge our work in this area. We're starting by pulling together a lot of the teams working on generative AI across the company into one group focused on building delightful experiences around this technology into all of our different products. In the short term, we'll focus on building creative and expressive tools. Over the longer term, we'll focus on developing AI personas that can help people in a variety of ways. We're exploring experiences with text (like chat in WhatsApp and Messenger), with images (like creative Instagram filters and ad formats), and with video and multi-modal experiences. We have a lot of foundational work to do before getting to the really futuristic experiences, but I'm excited about all of the new things we'll build along the way.\nUpload Time 27 Februari pukul 20.50\n```\n\n### Post Parser\n\nThe `post_parser` method is used to extract posts, and this method will return a `Posts` object.\n\n\n```python\n>>> post = fb.post_parser(\"https://m.facebook.com/story.php?story_fbid=pfbid02kbL4vnSF4Ex88nBQrMZdvjUoWV7hhznHZ8BpMcFAJzjL2CEoBCAHeHEk4Y8DLAQ5l&id=100053033144051&mibextid=Nif5oz\")\n>>> post.author\nRahmat\n>>> post.caption\nHello World \ud83c\udf0d\n>>> post.post_file\n{'image': [{'link': 'https://z-m-scontent.fsri1-1.fna.fbcdn.net/v/t39.30808-6/241434705_371774571266978_6844800659294160676_n.jpg?stp=cp0_dst-jpg_e15_fr_q65&_nc_cat=104&ccb=1-7&_nc_sid=110474&efg=eyJpIjoiYiJ9&_nc_eui2=AeE-bGgqsChJWa0bm9hnBZ-c9HuYP8xaWmP0e5g_zFpaYypDCKSWUSxTvpaIdTGIXCGEzD4653spgkhYVI1L37UK&_nc_ohc=3B_9FgPbsqgAX_k1QAl&_nc_ad=z-m&_nc_cid=1225&_nc_eh=4613fe15e78ad080e57d79ac328ba3a7&_nc_zt=23&_nc_rml=0&_nc_ht=z-m-scontent.fsri1-1.fna&oh=00_AfB8x_I9eObguAKc3CVt2A1dYWAYrLDpzMOnD3CnvfM4wg&oe=641513CF', 'id': '241434705_371774571266978_6844800659294160676', 'preview': 'https://z-m-scontent.fsri1-1.fna.fbcdn.net/v/t39.30808-6/241434705_371774571266978_6844800659294160676_n.jpg?stp=cp0_dst-jpg_e15_p526x296_q65&_nc_cat=104&ccb=1-7&_nc_sid=110474&efg=eyJpIjoiYiJ9&_nc_eui2=AeE-bGgqsChJWa0bm9hnBZ-c9HuYP8xaWmP0e5g_zFpaYypDCKSWUSxTvpaIdTGIXCGEzD4653spgkhYVI1L37UK&_nc_ohc=3B_9FgPbsqgAX_k1QAl&_nc_ad=z-m&_nc_cid=1225&_nc_eh=4613fe15e78ad080e57d79ac328ba3a7&_nc_zt=23&_nc_rml=0&_nc_ht=z-m-scontent.fsri1-1.fna&oh=00_AfD3FkrA5grtqsZFr7LoQKSVpQToVBhEXRqC3ntmUjB5Hw&oe=641513CF', 'content-type': 'image/jpeg'}], 'video': []}\n>>> post.upload_time\n17 Mei 2021 pukul 13.15\n>>> post.post_datetime\ndatetime.datetime(2021, 5, 17, 21, 15, 17)\n>>> post.get_react()\n{'like': 5652, 'love': 310, 'care': 9, 'haha': 6, 'wow': 252, 'sad': 0, 'angry': 1}\n```\n\n#### Sending Comments\n\nYou can use the `send_comment` method to post a comment.\nThe `send_comment` method will return `True` if the comment is successfully sent.\n\n**Example:**\n\n\n```python\n>>> post = fb.post_parser('https://m.facebook.com/story.php?story_fbid=pfbid0h1BPgqZsa4seKWoqn7c6GqDyAD3vKUePuasDRHuZCyN46M4uuAVy4m4fAukRvaojl&id=100053033144051&mibextid=Nif5oz')\n>>> post.send_comment('Hallo kak '+post.author +'\\n\\nKomentar ini di tulis menggunakan library fbthon :)')\nTrue\n```\n\n##### Result\n**See the comment at the bottom**\n\n![Example of how to send a comment](https://i.ibb.co/QFDpnw9/Screenshot-20230322-064024.jpg)\n\nTo add a photo to the comment, you can use the `file` argument.\n\n**Example:**\n\n\n```python\n>>> post = fb.post_parser('https://m.facebook.com/story.php?story_fbid=pfbid02kTobxSiD9buMUEjrq57FFnhQ6FJyGnafmNhMimoaamoAwuECAjboYaB6mE7C7pPZl&id=100053033144051&mibextid=Nif5oz')\n>>> post.send_comment(\"Komentar ini tidak di sertai dengan foto!\")\nTrue\n>>> post.send_comment(\"Komentar ini di sertai dengan foto!\", file = \"/sdcard/DCIM/Facebook/FB_IMG_1681559707400.jpg\")\nTrue\n```\n\n##### Result\n\n![Example of sending a comment with a photo](https://i.ibb.co/6vd6BQc/IMG-20230418-110223.jpg)\n\n#### Reacting to Posts\n\nYou can use the `send_react` method to react to a post.\nThis method will return `True` if the reaction is successfully applied to the post.\n\n\n```python\n>>> post = fb.post_parser(Link_post_facebook)\n>>> post.send_react(react_type)\nTrue\n```\n\nThere are 7 reaction types, including:\n- Like\n- Love\n- Care\n- Haha\n- Wow\n- Sad\n- Angry\n\n**Example of how to send a reaction:**\n\n```python\n>>> post = fb.post_parser('https://m.facebook.com/story.php?story_fbid=pfbid0h1BPgqZsa4seKWoqn7c6GqDyAD3vKUePuasDRHuZCyN46M4uuAVy4m4fAukRvaojl&id=100053033144051&mibextid=Nif5oz')\n>>> post.send_react('Wow')\nTrue\n```\n\n##### Result\n![Example of reacting to a post](https://i.ibb.co/SPXGWJJ/Screenshot-2023-0322-065521.png)\n\n##### Sharing a Post\nYou can use the `share_post` method to share someone else's post to your Facebook account.\n\n**Example (1):**\n\n\n```python\npost = fb.post_parser(\"https://m.facebook.com/story.php?story_fbid=pfbid0gxnxN5dZDDA93S2GveyxqgSzEdYdAtdE32PYyAd7iftDS7yBHprBACc9VcFXDoPtl&id=100053033144051&mibextid=Nif5oz\")\npost.share_post()\n```\n\n##### Result\n\n![Example of sharing a post](https://i.ibb.co/F39c30w/IMG-20230419-064244.jpg)\n\n**Example (2):**\n\nYou can also add `message`, `location`, and `feeling` to the shared post.\n\n\n```python\npost = fb.post_parser(\"https://m.facebook.com/story.php?story_fbid=pfbid0gxnxN5dZDDA93S2GveyxqgSzEdYdAtdE32PYyAd7iftDS7yBHprBACc9VcFXDoPtl&id=100053033144051&mibextid=Nif5oz\")\npost.share_post(message = \"Postingan ini di bagikan menggunakan library fbthon\", location = \"Kuningan Timur\", feeling = \"Happy\")\n```\n\n##### Result\n![Example of sharing a post with message, location, and feeling](https://i.ibb.co/7J1wzB2/IMG-20230419-070541.jpg)\n\n### Messenger\n\nThe `Messenger` object can be used to send/receive chats.\\\nThere are 2 ways to create a `Messenger` object:\n\n**Method 1**\n\n```python\n>>> msg = fb.Messenger()\n```\n**Method 2**\n\n```python\n>>> from facebook_fetcher import Messenger\n>>> msg = Messenger(Your_Facebook_Account_Cookie)\n```\n\n\n#### Getting New Messages\nThe `get_new_message` method can be used to retrieve new messages :)\n\n```python\nfor x in msg.get_new_message(limit=3):\n   print(\"Name: \" + x['name'])\n   print(\"Account ID: \" + x['id'])\n   print(\"Last Chat: \" + x['last_chat'])\n   print(\"Time: \" + x['time'] + \"\\n\\n\")\n\n\n```\n\n##### Output\n\n```python\nName: Khaneysia                        \nAccount ID: 1000xxxxxxxxxxx\nLast Chat: Good Night sayang :)\nTime: 5 minutes ago\n\nName: Rahmat\nAccount ID: 100053033144051\nLast Chat: Hallo Kak Rahmat :)\nTime: 11 minutes ago\n\nName: Mark Zuckerberg\nAccount ID: 4\nLast Chat: Ban my account, please                          \nTime: March 4\n\n```\n\nThe `get_new_chat` method can also be used to retrieve new messages, but this method is different from the `get_new_message` method.\n\n```python\n>>> msg.get_new_message(limit = 3)\n[{'name': 'Khaneysia', 'id': '1000xxxxxxxxxxx', 'last_chat': 'Good Night sayang :)', 'time': '23 menit lalu'}, {'name': 'Rahmat', 'id': '100053033144051', 'last_chat': 'Hallo Kak Rahmat:)', 'time': '34 menit lalu'}, {'name': 'Mark Zuckerberg', 'id': '4', 'last_chat': 'Hello Mark Zuckerberg', 'time': '4 Mar'}]\n>>> msg.get_new_chat(limit = 3)\n[Facebook Chats : name='Mark Zuckerberg' id=4 chat_id=4:100090156622219 type='user', Facebook Chats : name='Khaneysia' id=1000xxxxxxxxxxx chat_id=1000xxxxxxxxxxx:100090156622219 type='user', Facebook Chats : name='Rahmat' id=100053033144051 chat_id=100053033144051:100090156622219 type='user']\n```\n\nFrom the code above, we can conclude the difference between the `get_new_message` and `get_new_chat` methods.\n\nThe `get_new_message` method returns a `list` containing a collection of `dict` objects, whereas the `get_new_chat` method returns a `list` containing a collection of `Chats` objects.\n\n#### Sending Messages\n\nYou can use the `new_chat` method to send messages. This method will return a `Chats` object.\n\n\n```python\nwith msg.new_chat('zuck') as chat:\n  chat.send_text('Assalamualaikum')\n  chat.send_text('Hallo om '+ chat.name)\n  chat.send_text('Apa kabar?')\n  chat.send_text('Pesan ini di kirim menggunakan library fbthon:)\\n\\nTerima kasih Sudah membaca chat saya.')\n```\n\n##### Result\n![Example of Sending a Message](https://i.ibb.co/fQHtDmb/Screenshot-20230317-222932.jpg)\n\nYou can use the `send_image` method to send a chat with a photo.\n\n**Example:**\n\n\n```python\nwith msg.new_chat(\"Anjay.pro098\") as chat:\n  chat.send_text(\"Hallo kak \"+chat.name)\n  chat.send_text(\"Pesan ini di kirim menggunakan library fbthon :)\")\n  chat.send_image(file = \"/sdcard/DCIM/Facebook/FB_IMG_1681559707400.jpg\",message = \"Aku ketika nunggu buka puasa : \")\n  chat.send_like_stiker()\n```\n\n##### Result\n![Example of sending a chat with a photo](https://i.ibb.co/FVgZ7Mf/IMG-20230418-184806.jpg)\n\n## Creating Posts\nThe `create_timeline` method can be used to create posts. This method will return `True` if the post is successfully created.\n\n### Creating a Post (Caption Only)\n\n```python\n>>> fb.create_timeline(target='me', message='This post was created using the fbthon library\\n\\nHehe :>')\nTrue\n```\n\n#### Result\n![Creating a Post (Caption Only)](https://i.ibb.co/wB998Yd/Screenshot-2023-0317-224853.png)\n\n### Creating a Post on a Friend's Account\nTo create a post on a friend's account, you just need to change the `target` parameter to the ID or username of your friend :)\n\n**Example:**\n\n```python\n>>> fb.create_timeline(target='Friend\u2019s ID or username', message='This post was created using the fbthon library\\n\\nHehe :>')\nTrue\n```\n\n#### Result\n![Creating a Post (Caption Only) on a Friend\u2019s Facebook Account](https://i.ibb.co/cTwRYDh/IMG-20230318-181857.jpg)\n\n### Creating a Post (Tagging Friends)\nTo tag friends in a post, you can use the `users_with` argument.\n\n```python\n>>> fb.create_timeline(target='me', message='This post was created using the fbthon library\\n\\nHehe :>', users_with='friend\u2019s Facebook ID')\nTrue\n```\n\n#### Result\n![Creating a Post (Tagging Friends)](https://i.ibb.co/tbHKb0x/IMG-20230322-072612.jpg)\n\n### Creating a Post (With Photo)\nYou can use the `file` argument to add a photo to your post :)\n\n```python\n>>> fb.create_timeline(target='me', message='Alhamdulillah :)', file='/sdcard/Pictures/Certificate/mimo-certificates-125_page-0001.jpg')\nTrue\n```\n\n#### Result\n![Creating a Post (With Photo)](https://i.ibb.co/d4nKvVr/Screenshot-2023-0318-151426.png)\n\nAlso, you can use the `filter_type` argument to apply a filter to the photo you are uploading.\n\n```python\n>>> fb.create_timeline(target='me', message='Alhamdulillah :)', file='/sdcard/Pictures/Certificate/mimo-certificates-125_page-0001.jpg', filter_type='1')\nTrue\n```\n\nAnd here is the result:\n\n![Applying a Filter to a Photo](https://i.ibb.co/twf0tnc/Screenshot-2023-0323-082948.png)\n\n**There are several filter types you can try, including:**\n- No Filter = -1\n- Black and White = 1\n- Retro = 2\n\n### Creating a Post (With Location)\nYou can use the `location` argument to add a location to your post.\n\n```python\n>>> fb.create_timeline(target='me', message='This post was created using the fbthon library\\n\\nHehe :>', location='Muaraancalung, Kalimantan Timur')\nTrue\n```\n\n#### Result\n![Creating a Post (With Location)](https://i.ibb.co/vh5zh05/Screenshot-2023-0318-145829.png)\n\n### Creating a Post (With Feeling)\nYou can use the `feeling` argument to add a feeling to your post.\n\n```python\n>>> fb.create_timeline(target='me', message='This post was created using the fbthon library\\n\\nHehe :>', feeling='Happy')\nTrue\n```\n\n#### Result\n![Creating a Post (With Feeling)](https://i.ibb.co/n7yp62b/Screenshot-2023-0318-152335.png)\n\n### Create a Facebook Account\nYou can use the `CreateAccount` class to create a Facebook account.\n\n**NOTE: This feature is still experimental, so it may not work reliably.**\n\n#### Example:\n\nBelow is a simple program to create a Facebook account.\n\n```python\nimport sys\nfrom facebook_fetcher import CreateAccount\n\nprint(\"[+] Create Facebook Account [+]\\n\")\n\nfirstname = input(\"[?] First Name: \") # First Name\nlastname = input(\"[?] Last Name: \") # Last Name\nemail = input(\"[?] Email/Phone: \") # Email Address / Phone Number\ngender = input(\"[?] Gender (Male/Female): \") # Gender\nbirthday = input(\"[?] Date of Birth (DD/MM/YYYY): \") # Date of Birth\npassword = input(\"[?] Password: \") # Password\n\nnew_account = CreateAccount(firstname=firstname, lastname=lastname, email=email, gender=gender, date_of_birth=birthday, password=password)\n\nprint(\"\\n[+] Enter the verification code sent to \" + email)\nverification_code = input(\"[?] Verification Code: \")\n\n# The `confirm_account` method will return `True` if the account is successfully confirmed.\nconfirmation = new_account.confirm_account(verification_code)\n\nif confirmation:\n    print(\"[\u2713] Successfully Created Facebook Account :)\\n\")\n    print(\"[+] Account Name: %s %s\" % (firstname, lastname))\n    print(\"[+] Account ID: %s\" % (new_account.get_cookie_dict()['c_user']))\n    print(\"[+] Email/Phone: %s\" % (email))\n    print(\"[+] Gender: %s\" % (gender))\n    print(\"[+] Date of Birth: %s\" % (birthday))\n    print(\"[+] Password: %s\" % (password))\n    print(\"[+] Account Cookie: %s\" % (new_account.get_cookie_str()))\n    print(\"[+] Account Token: %s\" % (new_account.get_token()))\n    sys.exit(0)\nelse:\n    print(\"[!] Failed to Create Facebook Account\")\n    sys.exit(1)\n```\n\n##### Running the Program\n![Running the script to create a Facebook account using the fbthon library](https://i.ibb.co/2Sd19Wc/Screenshot-2023-0420-093249.png)\n\n###### Result\nThis is the account created using the fbthon library :)\n\n![This is a Facebook account created using the fbthon library](https://i.ibb.co/7K3q3hj/Screenshot-20230420-093826.jpg)\n\n#### Optional Parameters\n*(For the `CreateAccount` class)*\n\n- **firstname**: First Name\n- **lastname**: Last Name\n- **email**: Email address to be used for registering a Facebook account. You can also use a phone number instead of an email address.\n- **gender**: Gender (Male/Female)\n- **date_of_birth**: Date of birth in the format DD/MM/YYYY, Example: 13/01/2006\n- **password**: Password to be used for creating the Facebook account.\n\n# Installation\n\n**fbthon** is available on PyPi.\n\n\n```console\n$ python -m pip install facebook_fetcher\n```\n\n**fbthon** can be installed on Python version 3.7+.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Facebook scraper / Fetcher Unlimited by Andry RL",
    "version": "1.0.2",
    "project_urls": {
        "Homepage": "https://github.com/Andryerics/facebook_fetcher"
    },
    "split_keywords": [
        "facebook-scraper",
        " facebook-parser",
        " facebook-scraper-without-apikey"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2d315c9a4612413cdc8ff719d9d754052dfd4c44fd2545fb7ba2b5ad262311bb",
                "md5": "12c716542d0ef9e34655ca4fd7f34d90",
                "sha256": "2f1c19f1a61fcca1dea294fc9939e65925befc25f3f35814b5219eeadbb6f5b6"
            },
            "downloads": -1,
            "filename": "facebook_fetcher-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "12c716542d0ef9e34655ca4fd7f34d90",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 48889,
            "upload_time": "2024-08-09T14:11:27",
            "upload_time_iso_8601": "2024-08-09T14:11:27.278972Z",
            "url": "https://files.pythonhosted.org/packages/2d/31/5c9a4612413cdc8ff719d9d754052dfd4c44fd2545fb7ba2b5ad262311bb/facebook_fetcher-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3675d8f01f1f870ffde5fc86c6b3a942da1fed592cd897e73a8d41bcf5fbb3aa",
                "md5": "976ecefba32572491d3d684d60262422",
                "sha256": "74eb107fea0adf9964b73394934c3461a25d7350c96461a273e8057c98301df5"
            },
            "downloads": -1,
            "filename": "facebook_fetcher-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "976ecefba32572491d3d684d60262422",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 53098,
            "upload_time": "2024-08-09T14:11:28",
            "upload_time_iso_8601": "2024-08-09T14:11:28.423961Z",
            "url": "https://files.pythonhosted.org/packages/36/75/d8f01f1f870ffde5fc86c6b3a942da1fed592cd897e73a8d41bcf5fbb3aa/facebook_fetcher-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-09 14:11:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Andryerics",
    "github_project": "facebook_fetcher",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "facebook-fetcher"
}
        
Elapsed time: 0.27429s