Files
langchain/docs/extras/integrations/tools/youtube.ipynb
T
Leonid Ganeline 37e435bd00 docs: youtube_search tool example update (#9958)
Added a link to source package; updated title, description.
2023-09-01 13:32:27 -07:00

2.8 KiB

YouTube

YouTube Search package searches YouTube videos avoiding using their heavily rate-limited API.

It uses the form on the YouTube homepage and scrapes the resulting page.

This notebook shows how to use a tool to search YouTube.

Adapted from https://github.com/venuv/langchain_yt_tools

In [5]:
#! pip install youtube_search
In [1]:
from langchain.tools import YouTubeSearchTool
In [2]:
tool = YouTubeSearchTool()
In [6]:
tool.run("lex friedman")
Out [6]:
"['/watch?v=VcVfceTsD0A&pp=ygUMbGV4IGZyaWVkbWFu', '/watch?v=gPfriiHBBek&pp=ygUMbGV4IGZyaWVkbWFu']"

You can also specify the number of results that are returned

In [7]:
tool.run("lex friedman,5")
Out [7]:
"['/watch?v=VcVfceTsD0A&pp=ygUMbGV4IGZyaWVkbWFu', '/watch?v=YVJ8gTnDC4Y&pp=ygUMbGV4IGZyaWVkbWFu', '/watch?v=Udh22kuLebg&pp=ygUMbGV4IGZyaWVkbWFu', '/watch?v=gPfriiHBBek&pp=ygUMbGV4IGZyaWVkbWFu', '/watch?v=L_Guz73e6fw&pp=ygUMbGV4IGZyaWVkbWFu']"
In [ ]: