Update app.py
Browse files
app.py
CHANGED
|
@@ -75,7 +75,7 @@ def video_id(id: str):
|
|
| 75 |
url = f"https://www.youtube.com/watch?v={id}"
|
| 76 |
log.info(f"Fetching YouTube video for ID: {id}")
|
| 77 |
|
| 78 |
-
|
| 79 |
"198.23.239.134:6540:widxbsal:cnu4fy74afh7",
|
| 80 |
"207.244.217.165:6712:widxbsal:cnu4fy74afh7",
|
| 81 |
"107.172.163.27:6543:widxbsal:cnu4fy74afh7",
|
|
@@ -87,8 +87,7 @@ def video_id(id: str):
|
|
| 87 |
"104.239.105.125:6655:widxbsal:cnu4fy74afh7",
|
| 88 |
"173.0.9.70:5653:widxbsal:cnu4fy74afh7"
|
| 89 |
]
|
| 90 |
-
|
| 91 |
-
# Pick a random proxy
|
| 92 |
proxy = random.choice(proxy_list)
|
| 93 |
|
| 94 |
ip, port, user, password = proxy.split(":")
|
|
@@ -99,15 +98,13 @@ def video_id(id: str):
|
|
| 99 |
"https": f"http://{user}:{password}@{ip}:{port}"
|
| 100 |
}
|
| 101 |
|
| 102 |
-
# Your YouTube download code
|
| 103 |
-
url = "https://www.youtube.com/watch?v=xyz123abc" # replace with actual URL
|
| 104 |
-
|
| 105 |
try:
|
| 106 |
-
yt = YouTube(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
ys = yt.streams.get_highest_resolution()
|
| 108 |
-
ys.download()
|
| 109 |
-
except Exception as e:
|
| 110 |
-
print("Error:", e)
|
| 111 |
|
| 112 |
if not ys:
|
| 113 |
log.warning("No suitable video stream found.")
|
|
|
|
| 75 |
url = f"https://www.youtube.com/watch?v={id}"
|
| 76 |
log.info(f"Fetching YouTube video for ID: {id}")
|
| 77 |
|
| 78 |
+
proxies = [
|
| 79 |
"198.23.239.134:6540:widxbsal:cnu4fy74afh7",
|
| 80 |
"207.244.217.165:6712:widxbsal:cnu4fy74afh7",
|
| 81 |
"107.172.163.27:6543:widxbsal:cnu4fy74afh7",
|
|
|
|
| 87 |
"104.239.105.125:6655:widxbsal:cnu4fy74afh7",
|
| 88 |
"173.0.9.70:5653:widxbsal:cnu4fy74afh7"
|
| 89 |
]
|
| 90 |
+
|
|
|
|
| 91 |
proxy = random.choice(proxy_list)
|
| 92 |
|
| 93 |
ip, port, user, password = proxy.split(":")
|
|
|
|
| 98 |
"https": f"http://{user}:{password}@{ip}:{port}"
|
| 99 |
}
|
| 100 |
|
|
|
|
|
|
|
|
|
|
| 101 |
try:
|
| 102 |
+
yt = YouTube(
|
| 103 |
+
url,
|
| 104 |
+
'WEB',
|
| 105 |
+
proxies=proxies,
|
| 106 |
+
)
|
| 107 |
ys = yt.streams.get_highest_resolution()
|
|
|
|
|
|
|
|
|
|
| 108 |
|
| 109 |
if not ys:
|
| 110 |
log.warning("No suitable video stream found.")
|