Spaces:
Running
Running
stlaurentjr
commited on
Commit
•
083660e
1
Parent(s):
e3bf97f
Update scripts/mainrunpodA1111.py
Browse files- scripts/mainrunpodA1111.py +11 -3
scripts/mainrunpodA1111.py
CHANGED
@@ -15,6 +15,7 @@ import gdown
|
|
15 |
from urllib.request import urlopen, Request
|
16 |
import tempfile
|
17 |
from tqdm import tqdm
|
|
|
18 |
|
19 |
|
20 |
|
@@ -498,9 +499,16 @@ def getsrc(url):
|
|
498 |
return src
|
499 |
|
500 |
def get_true_name(url):
|
501 |
-
|
502 |
-
|
503 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
504 |
|
505 |
def get_name(url, gdrive):
|
506 |
|
|
|
15 |
from urllib.request import urlopen, Request
|
16 |
import tempfile
|
17 |
from tqdm import tqdm
|
18 |
+
from bs4 import BeautifulSoup
|
19 |
|
20 |
|
21 |
|
|
|
499 |
return src
|
500 |
|
501 |
def get_true_name(url):
|
502 |
+
response = requests.get(url)
|
503 |
+
soup = BeautifulSoup(response.text, 'html.parser')
|
504 |
+
title_tag = soup.find('title')
|
505 |
+
if title_tag:
|
506 |
+
title_text = title_tag.text
|
507 |
+
# Извлечение имени файла из тега title (предполагая, что имя файла указано в теге title)
|
508 |
+
file_name = title_text.split(' - ')[0]
|
509 |
+
return file_name
|
510 |
+
else:
|
511 |
+
raise RuntimeError('Could not find the title tag in the HTML')
|
512 |
|
513 |
def get_name(url, gdrive):
|
514 |
|