Created
December 10, 2017 14:42
-
-
Save atultherajput/0f148f925b49e15336ba85618660d6b9 to your computer and use it in GitHub Desktop.
Convert Facebook username to Profile id.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
user = input('Enter user name: ') | |
url = 'https://www.facebook.com/'+ user | |
resp = requests.get(url) | |
soup = BeautifulSoup(resp.text, 'lxml') | |
mylink = soup.find_all('meta') | |
id = mylink[7].attrs['content'][13:] | |
print(id) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment