python webscrapping downloading all the videos in a playlist code example

Example 1: python webscrapping downloading all the videos in a playlist

vquality=input("Enter the video quality (1080,720,480,360,240,144):")
vquality=vquality+"p"

for link in playlist:
    yt = YouTube(link)
    videos= yt.streams.filter(mime_type="video/mp4",res=vquality)
    video=videos[0]
    video.download("Downloads")
    print(yt.title+" - has been downloaded !!!")

Example 2: python webscrapping downloading all the videos in a playlist

for links in soup.find_all('a'):
        link=links.get('href')
        if (link[0:6]=="/watch" and link[0]!="#"):
            link="https://www.youtube.com"+link
            link=str(link)
            playlist.append(link)

print(playlist)
"""
For example, a playlist with 6 videos

Enter the Youtube Playlist URL : https://www.youtube.com/playlist?list=PLGzz7pyosmlJfx9ivigemSouoZR9uLT2-
['https://www.youtube.com/watch?v=iyL9-EE3ngk&list=PLGzz7pyosmlJfx9ivigemSouoZR9uLT2-',
 'https://www.youtube.com/watch?v=iyL9-EE3ngk&list=PLGzz7pyosmlJfx9ivigemSouoZR9uLT2-',
 'https://www.youtube.com/watch?v=iyL9-EE3ngk&list=PLGzz7pyosmlJfx9ivigemSouoZR9uLT2-&index=2&t=0s', 
'https://www.youtube.com/watch?v=iyL9-EE3ngk&list=PLGzz7pyosmlJfx9ivigemSouoZR9uLT2-&index=2&t=0s', 
'https://www.youtube.com/watch?v=G7E8YrOiYrQ&list=PLGzz7pyosmlJfx9ivigemSouoZR9uLT2-&index=3&t=0s', 
'https://www.youtube.com/watch?v=G7E8YrOiYrQ&list=PLGzz7pyosmlJfx9ivigemSouoZR9uLT2-&index=3&t=0s',
 'https://www.youtube.com/watch?v=79D4Y1cUK7I&list=PLGzz7pyosmlJfx9ivigemSouoZR9uLT2-&index=4&t=0s',
 'https://www.youtube.com/watch?v=79D4Y1cUK7I&list=PLGzz7pyosmlJfx9ivigemSouoZR9uLT2-&index=4&t=0s',
 'https://www.youtube.com/watch?v=MUe0FPx8kSE&list=PLGzz7pyosmlJfx9ivigemSouoZR9uLT2-&index=5&t=0s',
 'https://www.youtube.com/watch?v=MUe0FPx8kSE&list=PLGzz7pyosmlJfx9ivigemSouoZR9uLT2-&index=5&t=0s',
 'https://www.youtube.com/watch?v=UkpmjbHYV0Y&list=PLGzz7pyosmlJfx9ivigemSouoZR9uLT2-&index=6&t=0s',
 'https://www.youtube.com/watch?v=UkpmjbHYV0Y&list=PLGzz7pyosmlJfx9ivigemSouoZR9uLT2-&index=6&t=0s',
 'https://www.youtube.com/watch?v=WTOFLmB9ge0&list=PLGzz7pyosmlJfx9ivigemSouoZR9uLT2-&index=7&t=0s',
 'https://www.youtube.com/watch?v=WTOFLmB9ge0&list=PLGzz7pyosmlJfx9ivigemSouoZR9uLT2-&index=7&t=0s'
]
"""

Example 3: python webscrapping downloading all the videos in a playlist

playlist=[]
url=input("Enter the Youtube Playlist URL : ") #Takes the Playlist Link
data= requests.get(url)
soup=bs4.BeautifulSoup(data.text,'html.parser')

Example 4: python webscrapping downloading all the videos in a playlist

from pytube import YouTube
import bs4
import requests