File size: 1,492 Bytes
f812981
7fd7317
81117e4
7fd7317
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cb99b4d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
45
46
47
48
import yfinance as yf

# ์˜ˆ์‹œ ์ œํ’ˆ ์นดํƒˆ๋กœ๊ทธ
product_catalog = {
    "807ZPKBL9V": "SuperWidget",
    "1234567890": "MegaGadget"
}

def get_product_name_by_PID(PID: str) -> str:
    """
    Finds the name of a product by its Product ID
    """
    return product_catalog.get(PID, "Unknown product")

def get_stock_price(ticker: str) -> float:
    """
    Retrieves the latest stock price for a given ticker using yfinance.
    """
    stock = yf.Ticker(ticker)
    data = stock.history(period="1d")
    if not data.empty:
        return data['Close'].iloc[-1]
    return float('nan')

# ==============================
# (New) YouTube ๋™์˜์ƒ ๊ฒ€์ƒ‰ ํ•จ์ˆ˜
# ==============================
def search_youtube(query: str) -> str:
    """
    Searches YouTube for the given query and returns a short list of video titles/links.
    Actual implementation could use YouTube Data API or 'youtube-search-python'.
    Here we mock the result for demonstration.
    """
    # ์‹ค์ „ ์˜ˆ์‹œ (youtube-search-python ์‚ฌ์šฉ ์‹œ):
    # from youtubesearchpython import VideosSearch
    # videosSearch = VideosSearch(query, limit=3)
    # results = videosSearch.result()['result']
    # formatted = []
    # for item in results:
    #     title = item['title']
    #     link = item['link']
    #     formatted.append(f"{title} - {link}")
    # return "\n".join(formatted)

    # -- ๋ฐ๋ชจ์šฉ ๋”๋ฏธ ๊ฒฐ๊ณผ --
    return (
        "[Demo Video](https://www.youtube.com/watch?v=JzjR5LGOvqg)\n"
    )