Spaces:
Paused
Paused
GilangAlRusliadi commited on
Commit ·
6b64712
1
Parent(s): adfe5e0
Rule 34
Browse files- youtube.py +5 -8
youtube.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
| 1 |
import os
|
| 2 |
import requests
|
| 3 |
from datetime import datetime, timedelta
|
| 4 |
-
import urllib.request
|
| 5 |
from pytube import YouTube
|
| 6 |
from moviepy.editor import VideoFileClip
|
| 7 |
from tqdm import tqdm
|
|
@@ -55,10 +54,8 @@ def youtube(link, resolusi_input):
|
|
| 55 |
thumbnail_url = yt.thumbnail_url
|
| 56 |
|
| 57 |
# Menentukan nama file thumbnail
|
| 58 |
-
thumbnail_file =
|
| 59 |
|
| 60 |
-
# Mendownload thumbnail
|
| 61 |
-
urllib.request.urlretrieve(thumbnail_url, thumbnail_file)
|
| 62 |
resolusi_tersedia = [stream.resolution for stream in yt.streams.filter(progressive=True)]
|
| 63 |
video_info += f"Resolusi yang tersedia: {', '.join(resolusi_tersedia)}\n"
|
| 64 |
|
|
@@ -67,8 +64,8 @@ def youtube(link, resolusi_input):
|
|
| 67 |
|
| 68 |
if stream is None:
|
| 69 |
stream = yt.streams.filter(progressive=True, resolution='360p').first()
|
| 70 |
-
|
| 71 |
-
return
|
| 72 |
else:
|
| 73 |
-
|
| 74 |
-
return
|
|
|
|
| 1 |
import os
|
| 2 |
import requests
|
| 3 |
from datetime import datetime, timedelta
|
|
|
|
| 4 |
from pytube import YouTube
|
| 5 |
from moviepy.editor import VideoFileClip
|
| 6 |
from tqdm import tqdm
|
|
|
|
| 54 |
thumbnail_url = yt.thumbnail_url
|
| 55 |
|
| 56 |
# Menentukan nama file thumbnail
|
| 57 |
+
thumbnail_file = download_file(thumbnail_url, judul_video, thumbnail_dir)
|
| 58 |
|
|
|
|
|
|
|
| 59 |
resolusi_tersedia = [stream.resolution for stream in yt.streams.filter(progressive=True)]
|
| 60 |
video_info += f"Resolusi yang tersedia: {', '.join(resolusi_tersedia)}\n"
|
| 61 |
|
|
|
|
| 64 |
|
| 65 |
if stream is None:
|
| 66 |
stream = yt.streams.filter(progressive=True, resolution='360p').first()
|
| 67 |
+
video_file = download_youtube(stream.url, nama_channel, judul_video)
|
| 68 |
+
return video_file, judul_video, video_info, thumbnail_file
|
| 69 |
else:
|
| 70 |
+
video_file = download_youtube(stream.url, nama_channel, judul_video)
|
| 71 |
+
return video_file, judul_video, video_info, thumbnail_file
|