반응형
youtube_dl 라이브러리를 이용하여 플레이리스트 내용을 다운 받을 수 있다.
해당라이브러리의 옵션의 자세한 내용은 http://ytdl-org.github.io/youtube-dl/ 에서 확인 가능하다.
from __future__ import unicode_literals
import textwrap
import youtube_dl
playlists = [
"https://www.youtube.com/watch?v=0-q1KafFCLU&list=RDCLAK5uy_keiEJYbZRRLEHxmrEceD9WGxdtBU8SK-o&start_radio=1"
]
for playlist in playlists:
with youtube_dl.YoutubeDL({"ignoreerrors": True, "quiet": True}) as ydl:
playlist_dict = ydl.extract_info(playlist, download=False)
# Pretty-printing the video information (optional)
for video in playlist_dict["entries"]:
print("\n" + "*" * 60 + "\n")
if not video:
print("ERROR: Unable to get info. Continuing...")
continue
for prop in ["thumbnail", "id", "title", "description", "duration"]:
print(prop + "\n" +
textwrap.indent(str(video.get(prop)), " | ", lambda _: True)
)
결과
thumbnail
| https://i.ytimg.com/vi_webp/0-q1KafFCLU/maxresdefault.webp
id
| 0-q1KafFCLU
title
| [MV] IU(아이유) _ Celebrity
description
| [MV] IU(아이유) _ Celebrity
|
|
| K-POP Wonderland, 1theK
|
| K-POP의 모든 즐거움을 1theK(원더케이)에서 만나보세요! :)
| Welcome to the official YouTube channel of K-POP Wonderland, 1theK
|
| ""1theK Originals"" Subscribe 👉 https://www.youtube.com/1theKOriginals
|
| [Notice] 1theK YouTube is also an official channel for the MV, and music shows will count the views from this channel too.
| [공지] 1theK YouTube는 MV를 유통하는 공식 채널로, 1theK에 업로드된 MV 조회수 또한 음악방송 순위에 반영됩니다.
|
| #NEWRELEASE#MV#1theK#원더케이
|
| ▶1theK YT : https://www.youtube.com/1theK
| ▶1theK FB : http://www.facebook.com/1theK
| ▶1theK TW : https://twitter.com/1theK
| ▶1theK Kakao : https://goo.gl/otRpZc
| ▶1theK TikTok : https://vt.tiktok.com/2mSMBS
duration
| 198
************************************************************
thumbnail
| https://i.ytimg.com/vi_webp/4TWR90KJl84/maxresdefault.webp
id
| 4TWR90KJl84
title
| aespa 에스파 'Next Level' MV
description
| aespa's new single "Next Level" is out!
| Listen and download on your favorite platform: https://smarturl.it/aespa_NextLevel
| ⚔️ Performance Stage #1: https://youtu.be/z58k37I4Crs
| ⚔️ Performance Stage #2: https://youtu.be/hehFXvnWyKo
| ⚔️ Performance Stage #3: https://youtu.be/82CnK4M2sxo
|
| Subscribe to aespa Official YouTube Channel!
| https://www.youtube.com/aespa?sub_confirmation=1
|
| aespa official
| https://www.youtube.com/c/aespa
| https://www.instagram.com/aespa_official
| https://www.tiktok.com/@aespa_official
| https://twitter.com/aespa_Official
| https://www.facebook.com/aespa.official
| https://www.vlive.tv/channel/97CCED
| https://weibo.com/aespa
|
| #aespa #æspa #NextLevel #에스파
| aespa 에스파 'Next Level' MV ℗ SM Entertainment
duration
| 236
반응형
댓글