moda20 / facebook-scraper

Scrape Facebook public pages without an API key
MIT License
60 stars 23 forks source link

A login (cookies) is required to see this page #54

Closed boboliiii closed 2 months ago

boboliiii commented 2 months ago

Hello, I've looked and looked and tried everything I could find and no luck..

No matter what command I send, everything comes back "A login (cookies) is required to see this page".. Regardless of whether I use cookies, headers, or not.. Maybe there is something wrong with the way I've entered the cookies? My most simple example is the following:

from facebook_scraper import get_profile
get_profile("zuck", cookies="cookies.json")
     print(post['text'][:50])
 my cookies look like the following:
{
    "fr": "############",
    "sb": "######",
    "wd": "#####",
    "dpr": "###",
    "datr": "#####",
    "ps_n": "1",
    "ps_l": "1",
    "locale": "en_US",
    "wl_cbv": "################################,
    "vpd": "####################",
    "c_user": "##############",
    "xs": ###############",
    "presence": "#####################",
    "m_page_voice": "#################",
    "fbl_st": "###############"
}

not sure what the problem is! the cookies are fresh and i got them by loading an mbasic version of the website with Galaxy S20 Ultra emulator mode and then copying the cookies into curlconverter and then copied it into the json file above after replacing the ' with ".

Help please! Thanks in advance.

moda20 commented 2 months ago

@boboliiii try to export cookies in txt netscape mode, that is what i use

boboliiii commented 2 months ago

@moda20 amazing thank you so much! i'm not sure if this is documented somewhere but in case this helps others in a similar situation i'll put an example of what it looked like for me:

i used the Export Cookies plugin for firefox. the exported cookies looked like this:

`# Netscape HTTP Cookie File

.facebook.com TRUE / TRUE 17329 datr ########## .facebook.com TRUE / TRUE 175788 sb ### .facebook.com TRUE / TRUE 170521 ps_n 1 .facebook.com TRUE / TRUE 1700521 ps_l 1 .facebook.com TRUE / TRUE 1799700 m_page_voice #### .facebook.com TRUE / TRUE 0 presence ####### .facebook.com TRUE / TRUE 176823 c_user #### .facebook.com TRUE / TRUE 1756823 xs #### .facebook.com TRUE / TRUE 1796823 fr #### facebook.com TRUE / TRUE 1715080 wd #### .facebook.com TRUE / TRUE 175556 dpr ##### `

quite different than the json or dict style i thought the program wanted.

thanks again for your help

moda20 commented 2 months ago

@boboliiii great, i am closing this issue though, people can be sure of the resolution this way