ocx2025 commited on
Commit
8027f40
·
1 Parent(s): 06f0ba5
Files changed (4) hide show
  1. README.md +1 -1
  2. test_after_update.sh +17 -0
  3. test_api_key.sh +8 -0
  4. wait_for_space.sh +31 -0
README.md CHANGED
@@ -20,7 +20,7 @@ This is an MCP (Model Context Protocol) server that provides YouTube video searc
20
 
21
  ## Configuration
22
 
23
- ### Environment Variables
24
  - `YOUTUBE_API_KEY`: Your YouTube Data API v3 key (required)
25
  - `PORT`: HTTP server port (optional, default: 7860)
26
 
 
20
 
21
  ## Configuration
22
 
23
+ ### Environment Variables ##
24
  - `YOUTUBE_API_KEY`: Your YouTube Data API v3 key (required)
25
  - `PORT`: HTTP server port (optional, default: 7860)
26
 
test_after_update.sh ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ echo "Waiting 90 seconds for Space to rebuild..."
3
+ sleep 90
4
+
5
+ echo ""
6
+ echo "1️⃣ Checking if API key has a value now..."
7
+ curl -s https://ocx2025-basicsearch.hf.space/debug/env 2>/dev/null | python3 -m json.tool
8
+
9
+ echo ""
10
+ echo "2️⃣ Testing YouTube search..."
11
+ curl -s -X POST https://ocx2025-basicsearch.hf.space/search \
12
+ -H "Content-Type: application/json" \
13
+ -d '{"query": "Python programming", "max_results": 1}' \
14
+ 2>/dev/null | python3 -m json.tool
15
+
16
+ echo ""
17
+ echo "✅ If you see video results above, it's working!"
test_api_key.sh ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ echo "Testing if YOUTUBE_API_KEY is working..."
3
+ echo ""
4
+ echo "Sending search request..."
5
+ curl -X POST https://ocx2025-basicsearch.hf.space/search \
6
+ -H "Content-Type: application/json" \
7
+ -d '{"query": "Python programming", "max_results": 2}' \
8
+ 2>/dev/null | python3 -m json.tool
wait_for_space.sh ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ echo "⏳ Waiting for Space to restart and load YOUTUBE_API_KEY..."
3
+ echo ""
4
+
5
+ for i in {1..30}; do
6
+ echo -n "Attempt $i/30: "
7
+
8
+ # Check if space is responding
9
+ STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://ocx2025-basicsearch.hf.space/health 2>/dev/null)
10
+
11
+ if [ "$STATUS" = "200" ]; then
12
+ echo "✅ Space is UP!"
13
+ echo ""
14
+ echo "Testing YouTube API..."
15
+ curl -X POST https://ocx2025-basicsearch.hf.space/search \
16
+ -H "Content-Type: application/json" \
17
+ -d '{"query": "Python programming", "max_results": 1}' \
18
+ 2>/dev/null | python3 -m json.tool
19
+ exit 0
20
+ elif [ "$STATUS" = "404" ]; then
21
+ echo "⚠️ 404 (Space might be private or still building)"
22
+ else
23
+ echo "⏳ Building... (Status: $STATUS)"
24
+ fi
25
+
26
+ sleep 6
27
+ done
28
+
29
+ echo ""
30
+ echo "❌ Timeout waiting for Space. Please check manually:"
31
+ echo "https://huggingface.co/spaces/ocx2025/basicsearch"