GilbertClaus commited on
Commit
b3fc5a1
·
1 Parent(s): 92ee4d4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -9
app.py CHANGED
@@ -50,15 +50,15 @@ def cut_video(link, resolusi_input, start_time_str, end_time_str):
50
  rata2_viewer_per_hari = format_number(int(yt.views if selisih_hari < 1 else yt.views / selisih_hari))
51
  durasi_video = str(timedelta(seconds=yt.length))
52
 
53
- print("Nama Channel:", nama_channel)
54
- print("Judul Video:", judul_video)
55
- print("Tanggal Upload:", tanggal_upload)
56
- print("Jumlah Viewer:", jumlah_viewer)
57
- print("Rata-rata Viewer per Hari:", rata2_viewer_per_hari)
58
- print("Durasi Video:", durasi_video)
59
 
60
  resolusi_tersedia = [stream.resolution for stream in yt.streams.filter(progressive=True)]
61
- print("Resolusi yang tersedia:", ", ".join(resolusi_tersedia))
62
 
63
  resolusi = resolusi_input + "p"
64
  stream = yt.streams.filter(progressive=True, resolution=resolusi).first()
@@ -82,7 +82,8 @@ def cut_video(link, resolusi_input, start_time_str, end_time_str):
82
  subclip = video.subclip(start_time_seconds, end_time_seconds)
83
  subclip.write_videofile(output_file_path)
84
 
85
- return output_file_path
 
86
 
87
  iface = gr.Interface(
88
  fn=cut_video,
@@ -92,7 +93,11 @@ iface = gr.Interface(
92
  gr.inputs.Textbox(lines=1, label="Start Time (HH:MM:SS.MS)"),
93
  gr.inputs.Textbox(lines=1, label="End Time (HH:MM:SS.MS)"),
94
  ],
95
- outputs=gr.outputs.File(label="Download Cut Video"),
 
 
 
 
96
  title="YouTube Video Cutter",
97
  description="Potong dan download sebagian video YouTube.",
98
  )
 
50
  rata2_viewer_per_hari = format_number(int(yt.views if selisih_hari < 1 else yt.views / selisih_hari))
51
  durasi_video = str(timedelta(seconds=yt.length))
52
 
53
+ video_info = f"""Nama Channel: {nama_channel}
54
+ Judul Video: {judul_video}
55
+ Tanggal Upload: {tanggal_upload}
56
+ Jumlah Viewer: {jumlah_viewer}
57
+ Rata-rata Viewer per Hari: {rata2_viewer_per_hari}
58
+ Durasi Video: {durasi_video}"""
59
 
60
  resolusi_tersedia = [stream.resolution for stream in yt.streams.filter(progressive=True)]
61
+ video_info += f"\nResolusi yang tersedia: {', '.join(resolusi_tersedia)}"
62
 
63
  resolusi = resolusi_input + "p"
64
  stream = yt.streams.filter(progressive=True, resolution=resolusi).first()
 
82
  subclip = video.subclip(start_time_seconds, end_time_seconds)
83
  subclip.write_videofile(output_file_path)
84
 
85
+ return video_info, output_file_path, output_file_path
86
+
87
 
88
  iface = gr.Interface(
89
  fn=cut_video,
 
93
  gr.inputs.Textbox(lines=1, label="Start Time (HH:MM:SS.MS)"),
94
  gr.inputs.Textbox(lines=1, label="End Time (HH:MM:SS.MS)"),
95
  ],
96
+ outputs=[
97
+ gr.outputs.Textbox(label="Video Information"),
98
+ gr.outputs.Video(label="Hasil Video"),
99
+ gr.outputs.File(label="Download Hasil Potongan Video"),
100
+ ],
101
  title="YouTube Video Cutter",
102
  description="Potong dan download sebagian video YouTube.",
103
  )