Skip to main content

scrape all urls from youtube playlist

# -*- coding: utf-8 -*-
"""
Created on Wed Apr  4 14:09:45 2018

@author: kishlay
"""

from bs4 import BeautifulSoup as bs
import requests

r = requests.get('https://www.youtube.com/playlist?list=PL3D7BFF1DDBDAAFE5')
page = r.text
soup=bs(page,'html.parser')
res=soup.find_all('a',{'class':'pl-video-title-link'})
for l in res:
    print l.get("href")

Comments