Last active
October 4, 2017 15:50
-
-
Save jimywork/1d492cfd129edfe11a96fd89f3006108 to your computer and use it in GitHub Desktop.
Web Scraping Facebook ID, Name, Photo, URL
This file contains 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
#!/usr/bin/python2.7 | |
# -*- coding: utf-8 -*- | |
import requests | |
from bs4 import BeautifulSoup | |
UUIDS = open('uuids.txt', 'r') | |
for UUID in UUIDS : | |
UUID = UUID.strip('\n ') | |
URL = "https://www.facebook.com/%s" % (UUID) | |
Request = requests.get(URL, headers={"user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36"}, timeout=5) | |
Response = Request.text | |
Soup = BeautifulSoup(Response, 'html.parser') | |
uuids = Soup.find("meta", {"property":"al:android:url"}) | |
path = Soup.find("meta", {"property":"og:url"}) | |
img = Soup.find("meta", {"property":"og:image"}) | |
name = Soup.find("meta", {"property":"og:title"}) | |
Profiles = {"name": name.get('content'), "id": uuids.get('content'), "img": img.get('content'), "path": path.get('content')} | |
print("Nome: %s\nIdentificacao: %s\nFoto: %s\nPath: %s\n" % (Profiles.get('name'), Profiles.get('id'), Profiles.get('img'), Profiles.get('path') )) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment