Spaces:
Running
on
Zero
Running
on
Zero
Update my_functions.py
Browse files- my_functions.py +25 -0
my_functions.py
CHANGED
@@ -21,3 +21,28 @@ def get_stock_price(ticker: str) -> float:
|
|
21 |
if not data.empty:
|
22 |
return data['Close'].iloc[-1]
|
23 |
return float('nan')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
if not data.empty:
|
22 |
return data['Close'].iloc[-1]
|
23 |
return float('nan')
|
24 |
+
|
25 |
+
# ==============================
|
26 |
+
# (New) YouTube ๋์์ ๊ฒ์ ํจ์
|
27 |
+
# ==============================
|
28 |
+
def search_youtube(query: str) -> str:
|
29 |
+
"""
|
30 |
+
Searches YouTube for the given query and returns a short list of video titles/links.
|
31 |
+
Actual implementation could use YouTube Data API or 'youtube-search-python'.
|
32 |
+
Here we mock the result for demonstration.
|
33 |
+
"""
|
34 |
+
# ์ค์ ์์ (youtube-search-python ์ฌ์ฉ ์):
|
35 |
+
# from youtubesearchpython import VideosSearch
|
36 |
+
# videosSearch = VideosSearch(query, limit=3)
|
37 |
+
# results = videosSearch.result()['result']
|
38 |
+
# formatted = []
|
39 |
+
# for item in results:
|
40 |
+
# title = item['title']
|
41 |
+
# link = item['link']
|
42 |
+
# formatted.append(f"{title} - {link}")
|
43 |
+
# return "\n".join(formatted)
|
44 |
+
|
45 |
+
# -- ๋ฐ๋ชจ์ฉ ๋๋ฏธ ๊ฒฐ๊ณผ --
|
46 |
+
return (
|
47 |
+
"[Demo Video](https://www.youtube.com/watch?v=JzjR5LGOvqg)\n"
|
48 |
+
)
|