facebook-page-post-scraper
facebook-page-post-scraper copied to clipboard
No 'from' key returned for comments
Not sure whether this is an issue with script or whether this just requires specific permissions. Initially had an issue when running get_fb_comments_from_fb.py :
KeyError: 'from'
Pasting the full URL into browser shows the same thing; all other fields/keys return data - cannot seem to get data for 'from'.
Fb documentation still includes 'from' as a field/endpoint - but I was wondering whether a) change or update to Graph API meant this field is not supported (has anybody else seen this?), b) my permissions do not allow access (although I've not read anything on this requirement) c) use of script is wrong, d) other
thought it could be along same lines as https://github.com/minimaxir/facebook-page-post-scraper/pull/71 but doesnt seem to be.
Note; I can get the scraper to work when I hashout the author elements/from parts - so all other parts of the script work fine
Any help would be greatly appreciated - Thanks
Same here, Have you already solved this issue?
i got that problem too, has anyone solved this?
I am having the same,
$python3 get_fb_comments_from_fb.py
Scraping asdfg Comments From Posts: 2018-02-08 11:02:58.329331
Traceback (most recent call last):
File "get_fb_comments_from_fb.py", line 233, in <module>
scrapeFacebookPageFeedComments(file_id, access_token)
File "get_fb_comments_from_fb.py", line 161, in scrapeFacebookPageFeedComments
comment, status['status_id'])
File "get_fb_comments_from_fb.py", line 94, in processFacebookComment
comment_author = unicode_decode(comment['from']['name'])
KeyError: 'from'
me too, could anyone teach us how to solve this problem?
i removed the ['from'] and it worked for me
I am having the same issue, removing [from] doesnt work either.
Has anyone figured this out? Is this due to API changes and privacy issues? I tried to remove the 'from' but then get the following error message:
IndexError Traceback (most recent call last)
IndexError: tuple index out of range
Any fixes yet? I'm running into the same issue!
The error means that it is failing to pull the ['from']['name'] field out of the dictionary. This is failing because that information isn't being returned when you make the request. Why?
Most likely because you are using an application or user access token and not a page access token. Those fields are only returned when you use the page access token.
I switched over to a page access token for a page I am an administrator on and it is working fine for me. Now I need to get a permanent access token to run against. You can find more on access tokens here.
https://developers.facebook.com/docs/facebook-login/access-tokens#pagetokens
Easiest solution is to get a permanent token for your page and create a version of the get_fb_comments_from_fb.py for each page you want to pull comments from (probably do this for get_fb_posts_fb_page.py. too and use the page access token.
If you want comments for a page you don't own, a temporary solution that worked for me was to go to line 91 and switch comment['']['name'] to a temporary value, something like ('unknown')
comment_author = unicode_decode(comment['from']['name'])
comment_author = unicode_decode('test')#(comment['from']['name'])
You won't get the author information but you will get everything else. I need to look more into it and see if there is another way to get the comment author info.
Hi everyone! Getting the same error here and I have the page access token (which has been converted to a never ending access token) that you mention @jcommaroto. Have you had a chance to look more on this? There was no issue running the post scraping script so the access token shouldn't be the problem..?