Spaces:
Running
Running
Update extract_m3u8.py
Browse files- extract_m3u8.py +4 -10
extract_m3u8.py
CHANGED
@@ -1,14 +1,11 @@
|
|
1 |
import time
|
2 |
import json
|
3 |
import re
|
4 |
-
import os
|
5 |
from selenium import webdriver
|
6 |
from selenium.webdriver.chrome.options import Options
|
7 |
from selenium.webdriver.chrome.service import Service
|
8 |
-
from webdriver_manager.chrome import ChromeDriverManager
|
9 |
-
from webdriver_manager.core.os_manager import ChromeType
|
10 |
|
11 |
-
def extract_m3u8_urls(url, wait_time=10, headers=None):
|
12 |
"""
|
13 |
Captura URLs m3u8 de una página web y las devuelve directamente.
|
14 |
|
@@ -16,6 +13,7 @@ def extract_m3u8_urls(url, wait_time=10, headers=None):
|
|
16 |
url (str): URL de la página a analizar
|
17 |
wait_time (int): Tiempo de espera en segundos
|
18 |
headers (dict): Headers personalizados
|
|
|
19 |
|
20 |
Returns:
|
21 |
list: Lista de URLs m3u8 encontradas
|
@@ -39,12 +37,8 @@ def extract_m3u8_urls(url, wait_time=10, headers=None):
|
|
39 |
# Habilitar registro de red
|
40 |
chrome_options.set_capability("goog:loggingPrefs", {"performance": "ALL"})
|
41 |
|
42 |
-
#
|
43 |
-
|
44 |
-
os.makedirs(cache_dir, exist_ok=True)
|
45 |
-
|
46 |
-
# Iniciar navegador usando ChromeDriverManager con directorio de caché personalizado
|
47 |
-
service = Service(ChromeDriverManager(path=cache_dir).install())
|
48 |
driver = webdriver.Chrome(service=service, options=chrome_options)
|
49 |
|
50 |
try:
|
|
|
1 |
import time
|
2 |
import json
|
3 |
import re
|
|
|
4 |
from selenium import webdriver
|
5 |
from selenium.webdriver.chrome.options import Options
|
6 |
from selenium.webdriver.chrome.service import Service
|
|
|
|
|
7 |
|
8 |
+
def extract_m3u8_urls(url, wait_time=10, headers=None, chromedriver_path="./chromedriver"):
|
9 |
"""
|
10 |
Captura URLs m3u8 de una página web y las devuelve directamente.
|
11 |
|
|
|
13 |
url (str): URL de la página a analizar
|
14 |
wait_time (int): Tiempo de espera en segundos
|
15 |
headers (dict): Headers personalizados
|
16 |
+
chromedriver_path (str): Ruta al ejecutable de ChromeDriver
|
17 |
|
18 |
Returns:
|
19 |
list: Lista de URLs m3u8 encontradas
|
|
|
37 |
# Habilitar registro de red
|
38 |
chrome_options.set_capability("goog:loggingPrefs", {"performance": "ALL"})
|
39 |
|
40 |
+
# Iniciar navegador con ruta específica al ChromeDriver
|
41 |
+
service = Service(executable_path=chromedriver_path)
|
|
|
|
|
|
|
|
|
42 |
driver = webdriver.Chrome(service=service, options=chrome_options)
|
43 |
|
44 |
try:
|