Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Facebook User ID fetcher
import requests
import re
url = ''
idre = re.compile('"entity_id":"([0-9]+)"')
page = requests.get(url)
print idre.findall(page.content)
# One-liner
# python -c 'import requests, re; print re.findall("\"entity_id\":\"([0-9]+)\"", requests.get("").content)[0] + "\n"'
Copy link

Dev-iL commented Oct 24, 2017

I'd suggest using the lite version of fb, i.e.<USERNAME> (or<USERNAME>, which is easier to parse afterwards) as the returned page is much smaller. Of course in that case entity_id won't do anymore, so one might resort to looking for owner_id= or the more robust photo.php?fbid=99999999999999999&amp;id=1111111111 (where 111.... is the id we're looking for).

The lite sites support the https://<site_type> endpoint.

Copy link

Stihotvor commented Jun 6, 2018

This will not work for private accounts

Copy link

DM-ahmedelsayed commented Jul 18, 2018

Is there a way to verify a set of numbers in a file to see who has a Facebook account?
Using python

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment