October 22, 2023
Search data from Youtube in Python
pip install youtube-search-python
from youtubesearchpython import VideosSearch
videosSearch = VideosSearch('NoCopyrightSounds', limit = 1)
print(videosSearch.result()){
"result": [
{
"type": "video",
"id": "K4DyBUG242c",
"title": "Cartoon - On & On (feat. Daniel Levi) [NCS Release]",
"publishedTime": "5 years ago",
"duration": "3:28",
"viewCount": {
"text": "389,673,774 views",
"short": "389M views"
},
"thumbnails": [
{
"url": "https://i.ytimg.com/vi/K4DyBUG242c/hqdefault.jpg?sqp=-oaymwEjCOADEI4CSFryq4qpAxUIARUAAAAAGAElAADIQj0AgKJDeAE=&rs=AOn4CLBkTusCwcZQlmVAaRQ5rH-mvBuA1g",
"width": 480,
"height": 270
}
],
"richThumbnail": {
"url": "https://i.ytimg.com/an_webp/K4DyBUG242c/mqdefault_6s.webp?du=3000&sqp=COCn64IG&rs=AOn4CLBeYxeJ_5lME4jXbFQlv7kIN37kmw",
"width": 320,
"height": 180
},
"descriptionSnippet": [
{
"text": "NCS: Music Without Limitations NCS Spotify: http://spoti.fi/NCS Free Download / Stream: http://ncs.io/onandon \u25bd Connect with\u00a0..."
}
],
"channel": {
"name": "NoCopyrightSounds",
"id": "UC_aEa8K-EOJ3D6gOs7HcyNg",
"thumbnails": [
{
"url": "https://yt3.ggpht.com/a-/AOh14GhS0G5FwV8rMhVCUWSDp36vWEvnNs5Vl97Zww=s68-c-k-c0x00ffffff-no-rj-mo",
"width": 68,
"height": 68
}
],
"link": "https://www.youtube.com/channel/UC_aEa8K-EOJ3D6gOs7HcyNg"
},
"accessibility": {
"title": "Cartoon - On & On (feat. Daniel Levi) [NCS Release] by NoCopyrightSounds 5 years ago 3 minutes, 28 seconds 389,673,774 views",
"duration": "3 minutes, 28 seconds"
},
"link": "https://www.youtube.com/watch?v=K4DyBUG242c",
"shelfTitle": null
}
]
}