facebookresearch / Ad-Library-API-Script-Repository

GitHub repository of commonly used python scripts that allows everyone to pull data via the Ad Library API
Other
213 stars 84 forks source link

The API can't give back more than 40k results. #1

Closed georgetardy closed 2 years ago

georgetardy commented 4 years ago

Either I run this script or use my own solution, I just can't get more than 40 thousand results back. After reaching 40k records, the API drops an exception: {"code": 1, "message": "An unknown error occurred"}]

Is there a way to fix this?

Thanks

colin-fraser commented 4 years ago

Can you provide an example query that fails?

On Sun, Feb 16, 2020, 3:18 PM georgetardy notifications@github.com wrote:

Either I run this script or use my own solution, I just can't get more than 40 thousand results. After reaching 40k records, the API drops an exception: {"code": 1, "message": "An unknown error occurred"}]

Is there a way to fix this?

Thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/facebookresearch/Ad-Library-API-Script-Repository/issues/1?email_source=notifications&email_token=AC3I5OSY6CH4HSUVLWFXKADRDHCV5A5CNFSM4KWHVXHKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IN4JSDQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC3I5OW62LG3ILKUGT4TTLTRDHCV5ANCNFSM4KWHVXHA .

georgetardy commented 4 years ago

python3.7 fb_ads_library_api_cli.py -t EAAkJfhDJvucBAF2kQh8yEAZADpJQ1w3pJyP4bkzfzVjq7MeiaaYaM70yXy3mywBH2hhHfeQdYR9q2EZBmCl4ygQ5mYmXxT64gE78sZBhhkT5qqFEVXdiDqs5KI2PHfw6cxkZA5kpTmZBH8hMIT1jKg8Te2DQTMCJY7UXjhbZAUZBDs7KxRvST8Sn6Of0sR74DIAjoYOcJ1UDZAakaxyOmkUv -f 'page_id,ad_snapshot_url,funding_entity,ad_delivery_start_time' -c 'HU' -s '""' --ad-active-status 'ALL' --batch-size '5000' -v save 'output-Feb-16-2020.json'

georgetardy commented 4 years ago

However, I just realized that if I'm using a smaller batch size, e.g. '500' the script runs fine and paging works OK beyond 40k hits... So technically the script works great, but users have to be aware not to set the batch size (or limit parameter when using the API) too high.

georgetardy commented 4 years ago

After some trial and error I figured out that a max limit of 4470 is still OK. Use anything above that and the API's going to drop the Code 1 exception.

skylarcheung commented 4 years ago

@georgetardy has this issue persisted for you?

rinogo commented 2 years ago

@georgetardy - You should regenerate your access token since it's posted for the world to see above! 😬