Domanda Risolto Guida Rintracciare un utente suoi social

mrcamarium

Utente Silver
7 Gennaio 2022
108
25
6
56
Ultima modifica:
Condivido questo codice che può essere utile per rintracciare su quale social è registrato un utente.
Python:
import requests
from requests.exceptions import RequestException


def socialinfo():
    username = input("Inserisci Nome Utente: ")
    print("========== Analisi In Corso ==========")
    results = {}
    social_media = [
        {"url": "https://www.facebook.com/{}", "name": "Facebook"},
        {"url": "https://www.twitter.com/{}", "name": "Twitter"},
        {"url": "https://www.instagram.com/{}", "name": "Instagram"},
        {"url": "https://www.linkedin.com/in/{}", "name": "LinkedIn"},
        {"url": "https://www.github.com/{}", "name": "GitHub"},
        {"url": "https://www.pinterest.com/{}", "name": "Pinterest"},
        {"url": "https://www.tumblr.com/{}", "name": "Tumblr"},
        {"url": "https://www.youtube.com/{}", "name": "Youtube"},
        {"url": "https://soundcloud.com/{}", "name": "SoundCloud"},
        {"url": "https://www.snapchat.com/add/{}", "name": "Snapchat"},
        {"url": "https://www.tiktok.com/@{}", "name": "TikTok"},
        {"url": "https://www.behance.net/{}", "name": "Behance"},
        {"url": "https://www.medium.com/@{}", "name": "Medium"},
        {"url": "https://www.quora.com/profile/{}", "name": "Quora"},
        {"url": "https://www.flickr.com/people/{}", "name": "Flickr"},
        {"url": "https://www.periscope.tv/{}", "name": "Periscope"},
        {"url": "https://www.twitch.tv/{}", "name": "Twitch"},
        {"url": "https://www.dribbble.com/{}", "name": "Dribbble"},
        {"url": "https://www.stumbleupon.com/stumbler/{}", "name": "StumbleUpon"},
        {"url": "https://www.ello.co/{}", "name": "Ello"},
        {"url": "https://www.producthunt.com/@{}", "name": "Product Hunt"},
        {"url": "https://www.telegram.me/{}", "name": "Telegram"},
        {"url": "https://www.weheartit.com/{}", "name": "We Heart It"}
    ]
    headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'}

    with requests.Session() as session:
        session.headers.update(headers)
        for site in social_media:
            url = site['url'].format(username)
            try:
                response = session.get(url, timeout=5)
                if response.status_code == 200 and response.url == url:
                    results[site['name']] = "Utente registrato!"
                else:
                    results[site['name']] = "Nome utente non registrato!"
            except RequestException as e:
                results[site['name']] = "Errore di connessione"
    print("========== MOSTRA INFORMAZIONI NOME UTENTE ==========")
    for site, url in results.items():
        print(f" [ + ]  {site} : {url}")
se conoscete altri social fatemelo sapere cosi aggiorno la mia lista.