Skip to content

Instantly share code, notes, and snippets.

@elmoiv
Last active November 5, 2020 09:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elmoiv/2a6d41459d10827619c0c5f099d4bf17 to your computer and use it in GitHub Desktop.
Save elmoiv/2a6d41459d10827619c0c5f099d4bf17 to your computer and use it in GitHub Desktop.
Getting ID of any facebook user without scraping.
import re, urllib.request
query = input()
rgx = re.split(r'((http|https):\/\/)?(www\.)?(facebook|fb)\.com\/([.a-z0-9]+)', query.lower())
name = rgx[0] if len(rgx) == 1 else rgx[5]
redirected = urllib.request.urlopen(f'https://m.me/{name}').geturl().split('%2F')
ID = 'Not Found!' if len(redirected) < 2 else redirected[-2]
print('ID:', ['Not Found!', ID][ID.isdecimal()])
# You can message yourself by adding your ID to messenger base
# my_messenger_url = 'https://www.messenger.com/t/' + Your_ID
# And voice call yourself too 😂
# voice_call_url = 'https://www.messenger.com/videocall/incall/?peer_id=' + Your_ID
# Have fun :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment