Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single url does not return comments, reactions and reactors #64

Open
talatoncu opened this issue Sep 12, 2024 · 4 comments
Open

Single url does not return comments, reactions and reactors #64

talatoncu opened this issue Sep 12, 2024 · 4 comments

Comments

@talatoncu
Copy link

talatoncu commented Sep 12, 2024

When I get posts by specifying a user account, I get the comments, reactions and reactors perfectly.

But, when I use a single url, no comments, reactions and reactors are returned.

(
This is the code for user account (returns comments, reactions and reactors):

#coding:utf8
import sys
import os
if os.path.exists("G:/facebook-scraper-python/filename.txt"):
  os.remove("G:/facebook-scraper-python/filename.txt")
from json import dumps
import json
from facebook_scraper import get_posts,_scraper

xposturl=["https://www.facebook.com/talat.oncu/posts/10225784508541143"] #amerikan mandası

with open('G:/facebook-scraper-python/mbasicHeaders.json', 'r') as file:
    _scraper.mbasic_headers = json.load(file)

for post in get_posts( \
            "talatoncu",
            start_url="https://mbasic.facebook.com/talat.oncu", \
            base_url="https://mbasic.facebook.com", \
            cookies='from_browser', \
            extra_requests=True,
            #post_urls=xposturl, \
            options={"comments": True,"reactors": True,"reactions":True,\
                     "allow_extra_requests": True, \
                     "progress": True,"extra_info":True}):
        xstring = str(post)
        xstring=dumps(post,skipkeys=True,indent=5, default=str,ensure_ascii=False)
        f = open('G:/facebook-scraper-python/filename.txt', 'w', encoding='utf-8')
        f.write(xstring)
        f.close()

This is the code for single url (does not return comments, reactions and reactors):

#coding:utf8
import sys
import os
if os.path.exists("G:/facebook-scraper-python/filename.txt"):
  os.remove("G:/facebook-scraper-python/filename.txt")
from json import dumps
import json
from facebook_scraper import get_posts,_scraper

xposturl=["https://www.facebook.com/talat.oncu/posts/10225784508541143"] #amerikan mandası

with open('G:/facebook-scraper-python/mbasicHeaders.json', 'r') as file:
    _scraper.mbasic_headers = json.load(file)

for post in get_posts( \
            #"talatoncu",
            start_url="https://mbasic.facebook.com/talat.oncu", \
            base_url="https://mbasic.facebook.com", \
            cookies='from_browser', \
            extra_requests=True,
            post_urls=xposturl, \
            options={"comments": True,"reactors": True,"reactions":True,\
                     "allow_extra_requests": True, \
                     "progress": True,"extra_info":True}):
        #print(post['text'])
        xstring = str(post)
        xstring=dumps(post,skipkeys=True,indent=5, default=str,ensure_ascii=False)
        f = open('G:/facebook-scraper-python/filename.txt', 'w', encoding='utf-8')
        f.write(xstring)
        f.close()

I tried with

start_url="https://mbasic.facebook.com/talat.oncu/posts/10225784508541143"

and again nothing returned.

The returned json for a single url is as follows:

{
     "original_request_url": "https://www.facebook.com/talat.oncu/posts/10225784508541143",
     "post_url": "https://mbasic.facebook.com/talat.oncu/posts/10225784508541143",
     "post_id": null,
     "text": "Türkiye'de Amerikan Mandası Meselesi (1919-1920) ; Dr. Mine Erol; 1972, XII+163 S.; İleri Basımevi, Giresun; [45238]",
     "post_text": "Türkiye'de Amerikan Mandası Meselesi (1919-1920) ; Dr. Mine Erol; 1972, XII+163 S.; İleri Basımevi, Giresun; [45238]",
     "shared_text": "",
     "original_text": null,
     "time": "2024-05-28 10:14:00",
     "timestamp": null,
     "image": "https://scontent.fesb4-4.fna.fbcdn.net/v/t39.30808-6/443839769_10225784508341138_202164743398653783_n.jpg?stp=cp0_dst-jpg_e15_fr_q65&_nc_cat=108&ccb=1-7&_nc_sid=e5c1b6&efg=eyJpIjoiYiJ9&_nc_ohc=A_u9ype1O1wQ7kNvgFM-95I&_nc_ht=scontent.fesb4-4.fna&_nc_gid=AIVktrLisnDTrU8dXy81Fer&oh=00_AYATeCV6Z-KO-a7TQaE91bE8_wlx2yZjfCXeg8DWSp1EWQ&oe=66E8A121",
     "image_lowquality": "https://scontent.fesb4-4.fna.fbcdn.net/v/t39.30808-6/443839769_10225784508341138_202164743398653783_n.jpg?stp=cp0_dst-jpg_e15_p600x600_q65&_nc_cat=108&ccb=1-7&_nc_sid=e5c1b6&efg=eyJpIjoiYiJ9&_nc_ohc=A_u9ype1O1wQ7kNvgFM-95I&_nc_ht=scontent.fesb4-4.fna&_nc_gid=A451oQeetT4cH2Vx4PfbMGx&oh=00_AYCGzyUhK3cuuzQk84ydjrvWZN1-j6pdtB_sIaSIiGsBUg&oe=66E8A121",
     "images": [
          "https://scontent.fesb4-4.fna.fbcdn.net/v/t39.30808-6/443839769_10225784508341138_202164743398653783_n.jpg?stp=cp0_dst-jpg_e15_fr_q65&_nc_cat=108&ccb=1-7&_nc_sid=e5c1b6&efg=eyJpIjoiYiJ9&_nc_ohc=A_u9ype1O1wQ7kNvgFM-95I&_nc_ht=scontent.fesb4-4.fna&_nc_gid=AIVktrLisnDTrU8dXy81Fer&oh=00_AYATeCV6Z-KO-a7TQaE91bE8_wlx2yZjfCXeg8DWSp1EWQ&oe=66E8A121",
          "https://scontent.fesb3-2.fna.fbcdn.net/v/t39.30808-6/441902118_10225751509436186_4634580799677439445_n.jpg?stp=cp0_dst-jpg_e15_fr_q65&_nc_cat=102&ccb=1-7&_nc_sid=e5c1b6&efg=eyJpIjoiYiJ9&_nc_ohc=PG2cWGE6sEQQ7kNvgGjg7Ov&tn=Eu6n6RS_teB-1Fo6&_nc_ht=scontent.fesb3-2.fna&_nc_gid=AixuH7DLs48VUuZfNVhATgE&oh=00_AYDQfla2Q36c_vh3Hg18U9qxCwNkrcrgRlKwGp2Xabl3uw&oe=66E8755B"
     ],
     "images_description": [],
     "images_lowquality": [
          "https://scontent.fesb4-4.fna.fbcdn.net/v/t39.30808-6/443839769_10225784508341138_202164743398653783_n.jpg?stp=cp0_dst-jpg_e15_p600x600_q65&_nc_cat=108&ccb=1-7&_nc_sid=e5c1b6&efg=eyJpIjoiYiJ9&_nc_ohc=A_u9ype1O1wQ7kNvgFM-95I&_nc_ht=scontent.fesb4-4.fna&_nc_gid=A451oQeetT4cH2Vx4PfbMGx&oh=00_AYCGzyUhK3cuuzQk84ydjrvWZN1-j6pdtB_sIaSIiGsBUg&oe=66E8A121"
     ],
     "images_lowquality_description": [
          null
     ],
     "video": null,
     "video_duration_seconds": null,
     "video_height": null,
     "video_id": null,
     "video_quality": null,
     "video_size_MB": null,
     "video_thumbnail": null,
     "video_watches": null,
     "video_width": null,
     "likes": 0,
     "comments": 0,
     "shares": 0,
     "link": null,
     "links": [],
     "user_id": null,
     "username": "Talat Öncü",
     "user_url": "https://facebook.com/talat.oncu?eav=AfbA2IwkKHkzER_mdszBmZsRIhwcnY1uVNwBM8PPbbA_SARBOHMGT_GSdAdTAbN-khs&__tn__=C-R&paipv=0",
     "is_live": false,
     "factcheck": null,
     "shared_post_id": null,
     "shared_time": null,
     "shared_user_id": null,
     "shared_username": null,
     "shared_user_url": null,
     "shared_post_url": null,
     "available": true,
     "comments_full": [],
     "reactors": null,
     "w3_fb_url": null,
     "reactions": null,
     "reaction_count": 0,
     "with": null,
     "page_id": null,
     "sharers": null,
     "translated_text": "",
     "image_id": null,
     "image_ids": []
}
@kbalicki
Copy link

kbalicki commented Oct 16, 2024

I have the same problem. Scraping single posts gives nothing but NULL values, eg:
"is_live": false,
"factcheck": null,
"shared_post_id": null,
"shared_time": null,
"shared_user_id": null,
"shared_username": null,
"shared_user_url": null,
"shared_post_url": null,
"available": true,
"comments_full": [],
"reactors": null,
"w3_fb_url": null,
"reactions": null,

So far, I have not found any solution for that...

@kbalicki
Copy link

@moda20 do you plan to push any update to fix this? Every menthod I used, failed...

@moda20
Copy link
Owner

moda20 commented Oct 23, 2024

@kbalicki i am not working on this library, at this moment, i never needed to scrap comments and reactions so i never tried to fix them. If you can work on it i can help in some way

@kbalicki
Copy link

@kbalicki i am not working on this library, at this moment, i never needed to scrap comments and reactions so i never tried to fix them. If you can work on it i can help in some way

I am trying to work on it, but every attempt feels like a dead end. Could you email me at balicki1981ATgmail.com and maybe provide some tips or guidance so I can handle this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants