goversetv commited on
Commit
6683b6c
โ€ข
1 Parent(s): 1e500d9

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -41
app.py DELETED
@@ -1,41 +0,0 @@
1
- import gradio as gr
2
- from googleapiclient.discovery import build
3
- from google_auth_oauthlib.flow import InstalledAppFlow
4
- from google.auth.transport.requests import Request
5
- from google.oauth2.credentials import Credentials
6
-
7
- # YouTube API ์Šค์ฝ”ํ”„ ๋ฐ ํ•„์š”ํ•œ ์ธ์ฆ ์ •๋ณด
8
- SCOPES = ['https://www.googleapis.com/auth/youtube.force-ssl']
9
- CLIENT_SECRETS_FILE = 'YOUR_CLIENT_SECRETS_FILE.json'
10
-
11
- def update_video_descriptions(additional_text):
12
- # ์‚ฌ์šฉ์ž ์ธ์ฆ ๋ฐ YouTube API ํด๋ผ์ด์–ธํŠธ ์ดˆ๊ธฐํ™”
13
- creds = None
14
- flow = InstalledAppFlow.from_client_secrets_file(CLIENT_SECRETS_FILE, SCOPES)
15
- creds = flow.run_local_server(port=0)
16
- youtube = build('youtube', 'v3', credentials=creds)
17
-
18
- # ์‚ฌ์šฉ์ž์˜ YouTube ์ฑ„๋„ ๋™์˜์ƒ ๋ชฉ๋ก ๊ฐ€์ ธ์˜ค๊ธฐ
19
- request = youtube.videos().list(part='snippet', mine=True)
20
- response = request.execute()
21
-
22
- for video in response.get('items', []):
23
- video_id = video['id']
24
- snippet = video['snippet']
25
- original_description = snippet['description']
26
-
27
- # ์„ค๋ช…๋ž€ ์—…๋ฐ์ดํŠธ
28
- updated_description = f"{original_description}\n\n{additional_text}"
29
- snippet['description'] = updated_description
30
-
31
- update_request = youtube.videos().update(part='snippet', body={'id': video_id, 'snippet': snippet})
32
- update_request.execute()
33
-
34
- return f"Updated descriptions for {len(response.get('items', []))} videos."
35
-
36
- # Gradio ์ธํ„ฐํŽ˜์ด์Šค
37
- def add_text_to_videos(text):
38
- return update_video_descriptions(text)
39
-
40
- interface = gr.Interface(fn=add_text_to_videos, inputs="text", outputs="text")
41
- interface.launch()