RamAnanth1 commited on
Commit
3b07320
1 Parent(s): 8d1c4b4

Create utils.py

Browse files
Files changed (1) hide show
  1. utils.py +48 -0
utils.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ from typing import Any
3
+
4
+ VIDEO_INFO = [
5
+ "id",
6
+ "channel",
7
+ "channel_id",
8
+ "title",
9
+ "categories",
10
+ "tags",
11
+ "description"
12
+ ]
13
+
14
+ TRANSCRIPT_INFO = [
15
+ "text",
16
+ "segments"
17
+ ]
18
+
19
+ SEGMENTS_INFO = [
20
+ "start",
21
+ "end",
22
+ "text"
23
+ ]
24
+
25
+ AUDIO_FILES = [
26
+ ".webm",
27
+ ".mp3",
28
+ ".flac",
29
+ ".wav",
30
+ ".m4a"
31
+ ]
32
+
33
+ YT_OPTIONS = {
34
+ "format": "bestaudio/best",
35
+ "extractaudio": True,
36
+ "audioformat": "mp3",
37
+ "yesplaylist": True,
38
+ "postprocessors": [{
39
+ "key": "FFmpegExtractAudio",
40
+ "preferredcodec": "mp3",
41
+ "preferredquality": "192",
42
+ }]
43
+ }
44
+
45
+
46
+ def json_dump(obj: Any, save_path: str) -> None:
47
+ with open(save_path, "w") as file:
48
+ json.dump(obj, file)