forked from tiemi/automatic-blog-post
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_blog_post.py
39 lines (33 loc) · 970 Bytes
/
generate_blog_post.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import argparse
from src.video import Video
from src.blog_post import BlogPost
def generate_blog_post(video_url, deepgram_key):
output_directory = 'output'
video = Video(video_url, output_directory)
video.download_audio()
video.download_image()
blog_post = BlogPost(video, output_directory)
blog_post.generate_text(deepgram_key)
markdown_post = blog_post.generate_markdown_post()
blog_post.save_markdown_post(markdown_post)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument(
'-v',
'--video',
action='store',
dest='video_url',
help='The Youtube video url'
)
parser.add_argument(
'-dk',
'--deepgram',
action='store',
dest='deepgram_key',
help='The DeepGram API key'
)
args = parser.parse_args()
generate_blog_post(
video_url=args.video_url,
deepgram_key=args.deepgram_key
)