-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathyoutube2notion.py
44 lines (37 loc) · 1.26 KB
/
youtube2notion.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
40
41
42
43
44
from youtube2notion.youtube2notion import Youtube2notion
import click
@click.command()
@click.argument('video_id')
@click.option('--output-dir', '-o', 'output_dir', required=False, type=str)
@click.option(
'--notion-token-v2', '-t', 'notion_token_v2', required=False, type=str)
@click.option(
'--notion-page-url', '-p', 'notion_page_url', required=False, type=str)
@click.option(
'--subtitle_language',
'-l',
'subtitle_language',
required=False,
type=str,
default='en')
def youtube2notion(video_id: str, output_dir, notion_token_v2, notion_page_url,
subtitle_language):
if not output_dir:
output_dir = './tmp/%s/' % video_id
click.echo('video_id: %s' % video_id)
click.echo('output_dir: %s' % output_dir)
click.echo('notion_token_v2: %s' % notion_token_v2)
click.echo('notion_page_url: %s' % notion_page_url)
click.echo('subtitle_language: %s' % subtitle_language)
y2n = Youtube2notion(
video_id=video_id,
output_dir=output_dir,
notion_token_v2=notion_token_v2,
notion_page_url=notion_page_url,
subtitle_language=subtitle_language)
try:
y2n.execute()
except Exception as e:
print(e)
if __name__ == '__main__':
youtube2notion()