Advertisement
IssouLinux

check_banlist_pseudos_jvc.py

Nov 26th, 2023 (edited)
588
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.10 KB | None | 0 0
  1. # Auteur: IssouLinux
  2. # Dernière mise à jour: 03/03/2025
  3. # Exemple d'utilisation:
  4. # python3 check_banlist_pseudos_jvc.py liste_pseudos_jvc.txt
  5.  
  6. # /!\ Ne permet pas de savoir si un pseudo est ban tempo ou def /!\
  7.  
  8. import subprocess
  9. import time
  10. import sys
  11. from selenium import webdriver
  12. from selenium.webdriver.firefox.options import Options
  13.  
  14. # Démarrer Geckodriver automatiquement en arrière-plan
  15. geckodriver_process = subprocess.Popen(["geckodriver", "--host", "127.0.0.1", "--port", "4444"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
  16. time.sleep(2)  # Laisse le temps à Geckodriver de démarrer
  17.  
  18. # Configurations Selenium
  19. options = Options()
  20. options.headless = True  # Mode invisible
  21. options.set_preference("network.proxy.allow_hijacking_localhost", True)
  22.  
  23. # Fonction pour vérifier le statut d'un pseudo
  24. def check_ban_status(driver, pseudo):
  25.     url = f"https://www.jeuxvideo.com/profil/{pseudo.lower()}?mode=infos"  # Pseudo en minuscule
  26.  
  27.     try:
  28.         driver.get(url)
  29.         time.sleep(3)  # Attendre que la page charge
  30.  
  31.         page_source = driver.page_source.lower()
  32.  
  33.         if "banni" in page_source:
  34.             print(f"{pseudo}: ❌ Banni")
  35.         else:
  36.             print(f"{pseudo}: ✅ Non banni")
  37.  
  38.     except Exception as e:
  39.         print(f"Erreur pour {pseudo}: {str(e)}")
  40.  
  41. # Ouvre un seul navigateur pour tous les pseudos
  42. def main(file_path):
  43.     driver = webdriver.Remote(
  44.         command_executor="http://127.0.0.1:4444",
  45.         options=options
  46.     )
  47.  
  48.     try:
  49.         with open(file_path, "r") as file:
  50.             pseudos = [line.strip() for line in file]
  51.             for pseudo in pseudos:
  52.                 if pseudo:
  53.                     check_ban_status(driver, pseudo)
  54.  
  55.     except FileNotFoundError:
  56.         print(f"Erreur: fichier {file_path} introuvable.")
  57.  
  58.     finally:
  59.         driver.quit()  # Ferme le navigateur à la fin
  60.         geckodriver_process.terminate()  # Tue Geckodriver quand tout est fini
  61.  
  62. # Lancer le script
  63. if len(sys.argv) > 1:
  64.     main(sys.argv[1])
  65. else:
  66.     print("Usage: python3 check_jvc.py liste_pseudos_jvc.txt")
  67.  
  68.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement