Last active
January 18, 2019 20:38
-
-
Save mbcrump/8cd65fa6bdc33a11561958a87477cc51 to your computer and use it in GitHub Desktop.
Pull down title and url of all Azure Tips and Tricks videos
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
# Author: Michael Crump | |
# Date: 1/18/2019 | |
# Functionality: To easily scrape an Azure YouTube playlist of the title and url and format it with '{number}. title url [new line] and - | |
from bs4 import BeautifulSoup as bs | |
import requests | |
r = requests.get('https://www.youtube.com/playlist?list=PLLasX02E8BPCNCK8Thcxu-Y-XcBUbhFWC') | |
page = r.text | |
soup=bs(page,'html.parser') | |
for i, tr in enumerate(soup.select('tr.pl-video')): | |
print('{}. {}'.format(i + 1, tr['data-title'])) | |
print('https://www.youtube.com' + tr.a['href']) | |
print('-' * 80) |
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
# Author: Michael Crump | |
# Date: 1/18/2019 | |
# Functionality: To scrape an Azure YouTube playlist of the title and url and format is with 'title - url' | |
from bs4 import BeautifulSoup as bs | |
import requests | |
r = requests.get('https://www.youtube.com/playlist?list=PLLasX02E8BPCNCK8Thcxu-Y-XcBUbhFWC') | |
page = r.text | |
soup=bs(page,'html.parser') | |
for i, tr in enumerate(soup.select('tr.pl-video')): | |
print('{} - https://www.youtube.com{}'.format(tr['data-title'], tr.a['href'])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment