facebook-ad-library-scraper icon indicating copy to clipboard operation
facebook-ad-library-scraper copied to clipboard

KeyError: 'data'

Open hmpargi opened this issue 5 years ago • 3 comments

hi minimax,

I try to run the program, I am getting this error.

PS D:\downloads\fbscrap> python .\fb_ad_lib_scraper.py 0%| | 0/100 [00:00<?, ?it/s]Traceback (most recent call last): File ".\fb_ad_lib_scraper.py", line 49, in for ad in data['data']: KeyError: 'data' 0%|

The csv files are empty. Any Idea about this ?

hmpargi avatar Dec 12 '19 06:12 hmpargi

That means no ads were retrieved, or an error was made in the configuration. I’ll add a more helpful output for that case.

Does your FB account have permission to access the API as noted in the README?

minimaxir avatar Dec 12 '19 06:12 minimaxir

Yes, except the step 1, at https://www.facebook.com/ID and confirm your identity for Running Ads About Social Issues, Elections or Politics, which involves receiving a letter w/ a code at your US address and sending picture identification to Facebook.

The above step is in the process but I already created a user token https://developers.facebook.com/tools/explorer/ and configured in config.yaml.

Do you think step 1 is necessary for any to retrieve any Ad Data?

also, I left the search term: aoc as default to test.

Thanks, Hp

hmpargi avatar Dec 12 '19 07:12 hmpargi

All steps are necessary.

minimaxir avatar Dec 12 '19 15:12 minimaxir