Created
November 25, 2016 20:21
-
-
Save fffaraz/f3dcf48ae93b6c04adb9d74b1de711e5 to your computer and use it in GitHub Desktop.
Python YouTube Playlist Link Collector
This file contains 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
from bs4 import BeautifulSoup | |
import requests | |
def getPlaylistLinks(url): | |
sourceCode = requests.get(url).text | |
soup = BeautifulSoup(sourceCode, 'html.parser') | |
domain = 'https://www.youtube.com' | |
for link in soup.find_all("a", {"dir": "ltr"}): | |
href = link.get('href') | |
if href.startswith('/watch?'): | |
print(link.string.strip()) | |
print(domain + href + '\n') | |
getPlaylistLinks('Playlist url') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Made a quick fork https://gist.github.com/Axeltherabbit/5b147d508faf1b5cd735a52bd916b1e4 (No, doesn't solve the 100 video problem)