Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -507,16 +507,6 @@ if hf_token:
|
|
| 507 |
login(hf_token)
|
| 508 |
else:
|
| 509 |
raise ValueError("HF_TOKEN environment variable not set.")
|
| 510 |
-
|
| 511 |
-
# GOOGLE_API_KEY = "AIzaSyAURQb9jueh3dBQ4SITgKoR0L2_33en3yU"
|
| 512 |
-
# YOUTUBE_API_KEY = "AIzaSyB7X-RYjZmUuDSMTQsvCfyzURw5bhqOto4"
|
| 513 |
-
# # genai.configure(api_key=GOOGLE_API_KEY)
|
| 514 |
-
# GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
|
| 515 |
-
# genai.configure(api_key=GOOGLE_API_KEY)
|
| 516 |
-
# YOUTUBE_API_KEY = os.getenv("YOUTUBE_API_KEY")
|
| 517 |
-
# print("GOOGLE_API_KEY:", os.getenv("GOOGLE_API_KEY"))
|
| 518 |
-
# print("YOUTUBE_API_KEY:", os.getenv("YOUTUBE_API_KEY"))
|
| 519 |
-
|
| 520 |
|
| 521 |
|
| 522 |
# Configuration
|
|
@@ -680,6 +670,11 @@ def extract_video_id(url):
|
|
| 680 |
# except Exception as e:
|
| 681 |
# return None, f"Error: {str(e)}", "N/A", ""
|
| 682 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 683 |
def process_youtube_video(url="", keywords=""):
|
| 684 |
try:
|
| 685 |
# Initialize variables
|
|
|
|
| 507 |
login(hf_token)
|
| 508 |
else:
|
| 509 |
raise ValueError("HF_TOKEN environment variable not set.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 510 |
|
| 511 |
|
| 512 |
# Configuration
|
|
|
|
| 670 |
# except Exception as e:
|
| 671 |
# return None, f"Error: {str(e)}", "N/A", ""
|
| 672 |
|
| 673 |
+
from textblob import TextBlob
|
| 674 |
+
from youtube_transcript_api import YouTubeTranscriptApi, TranscriptsDisabled, NoTranscriptFound
|
| 675 |
+
import re
|
| 676 |
+
from collections import Counter
|
| 677 |
+
from googleapiclient.discovery import build
|
| 678 |
def process_youtube_video(url="", keywords=""):
|
| 679 |
try:
|
| 680 |
# Initialize variables
|