Skip to content
This repository has been archived by the owner on Jul 14, 2020. It is now read-only.

HTTP Error 400: Bad Request #115

Open
dbsbookg opened this issue Jun 8, 2018 · 10 comments
Open

HTTP Error 400: Bad Request #115

dbsbookg opened this issue Jun 8, 2018 · 10 comments

Comments

@dbsbookg
Copy link

dbsbookg commented Jun 8, 2018

I have registered my facebook developer account and get my app id and app secret. I have a Facebook page to scrape, and I fill in my app id, app secret and the page id.

But I get the following error:

Scraping xx Facebook Page: 2018-06-08 18:18:57.668779

HTTP Error 400: Bad Request

Any idea?

@SebMenozzi
Copy link

I had this error when on fb developper > Settings > Advanced : "Native or desktop app?" was checked. Thus, if it's checked, uncheck it and it should work.

@jthieleruiz
Copy link

Having the same issue, and trying the above didn't work.

@kelvintiger
Copy link

As stated in #104

Try:

mw0000 commented on Apr 17

the code still works, but you need to make some changes

log in to fb
go to https://developers.facebook.com/tools/explorer/
copy the access token value
edit a *.py file you want use in your project (e.g. get_fb_posts_fb_page.py):
comment a line with access_token = app_id + "|" + app_secret
define new token value:
access_token = "YOUR TOKEN VALUE"

save & run - it should work now
the token can expire - so in a few days when you want to use the script again please regenerate token and paste a new value into the code

@dbsbookg
Copy link
Author

@kelvintiger I tried it last week it didn't work, but try it now and it looks working!
However I have the following UnicodeEncodeError now:

UnicodeEncodeError Traceback (most recent call last)
in ()
173
174 if name == 'main':
--> 175 scrapeFacebookPageFeedStatus(page_id, access_token, since_date, until_date)

in scrapeFacebookPageFeedStatus(page_id, access_token, since_date, until_date)
155 # calculate thankful/pride through algebra
156 num_special = status_data[6] - sum(reactions_data)
--> 157 w.writerow(status_data + reactions_data + (num_special,))
158
159 num_processed += 1

UnicodeEncodeError: 'cp950' codec can't encode character '\U0001f525' in position 39: illegal multibyte sequence

@94akshayraj
Copy link

Same problem, ERROR 400 issue. @mw0000 solution helped when i was facing 403 error. For 400, it doesnt help.

@kelvintiger
Copy link

@dbsbookg @akhisreelibra What pages are you guys trying to scrape? I can try on my end

@94akshayraj
Copy link

@kelvintiger im trying to make a corpus related to automobiles. Thus, i was trying to scrape the BMW page in facebook within a months interval.

@robby152
Copy link

robby152 commented Jul 5, 2018

I am also experiencing the same problem. I have tried the @mw0000 solution and the app id / app secret method, and both give me the same "HTTP Error 400: Bad Request" message

@philippnkling
Copy link

philippnkling commented Jul 19, 2018

Have you tried looking up that status? E.g. just pasting the status id after the url ("https://www.facebook.com/")? Maybe this status was deleted. This happens for me occassionally, too, however, I treat this as an exception because the statuses were deleted in my case.

Another problem could be, that your app was not reviewed by Facebook yet. If you paste your final url (the one that is being requested by Request(url)) into the browser it might tell you that:

(#10) To use 'Page Public Content Access', your use of this endpoint must be reviewed and approved by Facebook. To submit this 'Page Public Content Access' feature for review please read our documentation on reviewable features: https://developers.facebook.com/docs/apps/review.

In this case you need to consider the review procedure of Facebook before requesting anything else.

@arpan45
Copy link

arpan45 commented Jan 7, 2019

Works perfectly when I have the admin permission of a page. Not working for any random page

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

No branches or pull requests

8 participants