Last active
April 20, 2020 16:12
-
-
Save blhack/ba93610ae12d2f58c2faa08b6ea3103c to your computer and use it in GitHub Desktop.
Watch all the Rising with Krystal and Saagar clips in a playlist instead of having to find them on youtube
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 urllib | |
import parse | |
req = urllib.urlopen("https://www.youtube.com/channel/UCPWXiRWZ29zrxPFIQT7eHSA/videos") | |
data = req.read() | |
vIDs = [] | |
soup = BeautifulSoup(data, "html.parser") | |
for link in soup.find_all("a", class_="yt-uix-sessionlink yt-uix-tile-link spf-link yt-ui-ellipsis yt-ui-ellipsis-2"): | |
if "Krystal and Saagar" in link.attrs["title"]: | |
vid = parse.parse("/watch?v={}", link.attrs["href"]) | |
vIDs.append(vid[0]) | |
print "%s - %s" % (link.attrs["title"],vid[0]) | |
print """<iframe width="720" height="405" src="https://www.youtube.com/embed/VIDEO_ID?playlist=%s&autoplay=1"frameborder="0" allowfullscreen>""" % (",".join(vIDs)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment