Skip to content

Instantly share code, notes, and snippets.

@blhack
Last active April 20, 2020 16:12
Show Gist options
  • Save blhack/ba93610ae12d2f58c2faa08b6ea3103c to your computer and use it in GitHub Desktop.
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
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