Spaces:
Runtime error
Runtime error
Download utils/utils.py from IAGeneral/vidu: direct link, hf CLI and curl.
- Browser
- Download file 4.2 kB
-
https://huggingface.co/spaces/IAGeneral/vidu/resolve/main/utils/utils.py
- Command line
-
hf download hf://spaces/IAGeneral/vidu/utils/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/IAGeneral/vidu/resolve/main/utils/utils.py
4.2 kB
| import re | |
| import random | |
| import string | |
| import requests | |
| def generar_nombre_completo(): | |
| """Genera un nombre completo triplicando el nombre y apellido, junto con un número aleatorio de 3 dígitos.""" | |
| nombres = ["Juan", "Pedro", "Maria", "Ana", "Luis", "Sofia", "Diego", "Laura", "Javier", "Isabel", | |
| "Pablo", "Marta", "David", "Elena", "Sergio", "Irene", "Daniel", "Alicia", "Carlos", "Sandra", | |
| "Antonio", "Lucia", "Miguel", "Sara", "Jose", "Cristina", "Alberto", "Blanca", "Alejandro", "Marta", | |
| "Francisco", "Esther", "Roberto", "Silvia", "Manuel", "Patricia", "Marcos", "Victoria", "Fernando", "Rosa", | |
| # Nombres comunes de EE.UU. | |
| "James", "John", "Robert", "Michael", "William", "David", "Richard", "Joseph", "Charles", "Thomas", | |
| "Christopher", "Daniel", "Matthew", "Anthony", "Mark", "Donald", "Steven", "Paul", "Andrew", "Joshua", | |
| "Kenneth", "Kevin", "Brian", "George", "Edward", "Ronald", "Timothy", "Jason", "Jeffrey", "Ryan", | |
| "Jacob", "Gary", "Nicholas", "Eric", "Jonathan", "Stephen", "Larry", "Justin", "Scott", "Brandon", | |
| "Benjamin", "Samuel", "Frank", "Gregory", "Raymond", "Alexander", "Patrick", "Jack", "Dennis", "Jerry", | |
| "Tyler", "Aaron", "Henry", "Douglas", "Jose", "Peter", "Adam", "Zachary", "Nathan", "Walter", | |
| "Kyle", "Harold", "Carl", "Arthur", "Gerald", "Roger", "Keith", "Jeremy", "Terry", "Lawrence", | |
| "Sean", "Christian", "Ethan", "Austin", "Joe", "Jordan", "Albert", "Jesse", "Willie", "Billy"] | |
| apellidos = ["Garcia", "Rodriguez", "Gonzalez", "Fernandez", "Lopez", "Martinez", "Sanchez", "Perez", "Alonso", "Diaz", | |
| "Martin", "Ruiz", "Hernandez", "Jimenez", "Torres", "Moreno", "Gomez", "Romero", "Alvarez", "Vazquez", | |
| "Gil", "Lopez", "Ramirez", "Santos", "Castro", "Suarez", "Munoz", "Gomez", "Gonzalez", "Navarro", | |
| "Dominguez", "Lopez", "Rodriguez", "Sanchez", "Perez", "Garcia", "Gonzalez", "Martinez", "Fernandez", "Lopez", | |
| # Apellidos comunes de EE.UU. | |
| "Smith", "Johnson", "Williams", "Brown", "Jones", "Garcia", "Miller", "Davis", "Rodriguez", "Martinez", | |
| "Hernandez", "Lopez", "Gonzalez", "Wilson", "Anderson", "Thomas", "Taylor", "Moore", "Jackson", "Martin", | |
| "Lee", "Perez", "Thompson", "White", "Harris", "Sanchez", "Clark", "Ramirez", "Lewis", "Robinson", | |
| "Walker", "Young", "Allen", "King", "Wright", "Scott", "Torres", "Nguyen", "Hill", "Flores", | |
| "Green", "Adams", "Nelson", "Baker", "Hall", "Rivera", "Campbell", "Mitchell", "Carter", "Roberts", | |
| "Gomez", "Phillips", "Evans", "Turner", "Diaz", "Parker", "Cruz", "Edwards", "Collins", "Reyes", | |
| "Stewart", "Morris", "Morales", "Murphy", "Cook", "Rogers", "Gutierrez", "Ortiz", "Morgan", "Cooper", | |
| "Peterson", "Bailey", "Reed", "Kelly", "Howard", "Ward", "Cox", "Diaz", "Richardson", "Wood"] | |
| nombre = random.choice(nombres) | |
| apellido = random.choice(apellidos) | |
| numero = random.randint(100, 999) | |
| nombre_completo = f"{nombre}_{apellido}_{numero}" | |
| return nombre_completo | |
| def generar_contrasena(): | |
| """Genera una contraseña aleatoria.""" | |
| caracteres = string.ascii_letters + "0123456789" + "#$%&/()@_-*+[]" | |
| longitud = 10 | |
| contraseña = ''.join(random.choice(caracteres) for _ in range(longitud)) | |
| return contraseña | |
| def enviar_formulario(url, datos): | |
| """Envía una solicitud POST a un formulario web.""" | |
| response = requests.post(url, data=datos) | |
| return response | |
| def extraer_dominios(response_text): | |
| """Extrae dominios de un texto utilizando expresiones regulares.""" | |
| dominios = re.findall(r'id="([^"]+\.[^"]+)"', response_text) | |
| return dominios | |
| def obtener_sitio_web_aleatorio(response_text): | |
| """Obtiene un sitio web aleatorio de los dominios extraídos.""" | |
| dominios = extraer_dominios(response_text) | |
| sitio_web_aleatorio = random.choice(dominios) | |
| return sitio_web_aleatorio | |