YoutubeLoaderDL
利用yt-dlp
库的Youtube加载器。
这个包实现了一个用于YouTube的文档加载器。与依赖于pytube
的langchain-community
中的YoutubeLoader不同,YoutubeLoaderDL
能够获取YouTube元数据。langchain-yt-dlp
利用了强大的yt-dlp
库,提供了一个更可靠且功能丰富的YouTube文档加载器。
概述
集成详情
类 | 包 | 本地 | 可序列化 | JS支持 |
---|---|---|---|---|
YoutubeLoader | langchain-yt-dlp | ✅ | ✅ | ❌ |
设置
安装
pip install langchain-yt-dlp
初始化
from langchain_yt_dlp.youtube_loader import YoutubeLoaderDL
# Basic transcript loading
loader = YoutubeLoaderDL.from_youtube_url(
"https://www.youtube.com/watch?v=dQw4w9WgXcQ", add_video_info=True
)
加载
documents = loader.load()
documents[0].metadata
{'source': 'dQw4w9WgXcQ',
'title': 'Rick Astley - Never Gonna Give You Up (Official Music Video)',
'description': 'The official video for “Never Gonna Give You Up” by Rick Astley. \n\nNever: The Autobiography 📚 OUT NOW! \nFollow this link to get your copy and listen to Rick’s ‘Never’ playlist ❤️ #RickAstleyNever\nhttps://linktr.ee/rickastleynever\n\n“Never Gonna Give You Up” was a global smash on its release in July 1987, topping the charts in 25 countries including Rick’s native UK and the US Billboard Hot 100. It also won the Brit Award for Best single in 1988. Stock Aitken and Waterman wrote and produced the track which was the lead-off single and lead track from Rick’s debut LP “Whenever You Need Somebody”. The album was itself a UK number one and would go on to sell over 15 million copies worldwide.\n\nThe legendary video was directed by Simon West – who later went on to make Hollywood blockbusters such as Con Air, Lara Croft – Tomb Raider and The Expendables 2. The video passed the 1bn YouTube views milestone on 28 July 2021.\n\nSubscribe to the official Rick Astley YouTube channel: https://RickAstley.lnk.to/YTSubID\n\nFollow Rick Astley:\nFacebook: https://RickAstley.lnk.to/FBFollowID \nTwitter: https://RickAstley.lnk.to/TwitterID \nInstagram: https://RickAstley.lnk.to/InstagramID \nWebsite: https://RickAstley.lnk.to/storeID \nTikTok: https://RickAstley.lnk.to/TikTokID\n\nListen to Rick Astley:\nSpotify: https://RickAstley.lnk.to/SpotifyID \nApple Music: https://RickAstley.lnk.to/AppleMusicID \nAmazon Music: https://RickAstley.lnk.to/AmazonMusicID \nDeezer: https://RickAstley.lnk.to/DeezerID \n\nLyrics:\nWe’re no strangers to love\nYou know the rules and so do I\nA full commitment’s what I’m thinking of\nYou wouldn’t get this from any other guy\n\nI just wanna tell you how I’m feeling\nGotta make you understand\n\nNever gonna give you up\nNever gonna let you down\nNever gonna run around and desert you\nNever gonna make you cry\nNever gonna say goodbye\nNever gonna tell a lie and hurt you\n\nWe’ve known each other for so long\nYour heart’s been aching but you’re too shy to say it\nInside we both know what’s been going on\nWe know the game and we’re gonna play it\n\nAnd if you ask me how I’m feeling\nDon’t tell me you’re too blind to see\n\nNever gonna give you up\nNever gonna let you down\nNever gonna run around and desert you\nNever gonna make you cry\nNever gonna say goodbye\nNever gonna tell a lie and hurt you\n\n#RickAstley #NeverGonnaGiveYouUp #WheneverYouNeedSomebody #OfficialMusicVideo',
'view_count': 1603360806,
'publish_date': datetime.datetime(2009, 10, 25, 0, 0),
'length': 212,
'author': 'Rick Astley',
'channel_id': 'UCuAXFkgsw1L7xaCfnd5JJOw',
'webpage_url': 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'}
懒加载
- 未实现懒加载