Last active
September 26, 2018 15:01
-
-
Save yzdann/f16f0f4cf37bf5aca7087dde428deb06 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
playlist_uuid = "PLoTq7UR349FHG_fqBNFAjsnWmUntUs0_E" | |
response = requests.get( | |
"https://www.youtube.com/playlist?list=" | |
+ playlist_uuid) | |
page_content = response.content | |
soup = BeautifulSoup(page_content, "lxml") | |
links = soup.select('.pl-video-title-link') | |
with open('/home/yzdann/youtube_links_file', 'w') as youtube_link_file: | |
for link in links: | |
uuid = link.attrs['href'][9:20] | |
title = link.string.strip() | |
youtube_link = title + ":\nhttps://www.youtube.com/watch?v=" + uuid | |
youtube_link_file.write(youtube_link+"\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
save my youtube playlist links to a file for download them later with youtube-dl after midnight :)