App to generate direct download links from a YouTube video

232 Views Asked by At

i need to make an program like this website: https://youtubemultidownloader.net/playlists.html

this website when you give it a playlist link it gives you a direct download link of each video in this playlist then you can use program like FDM to download it at once.

how can i do like this app?

i tried pytube library, to do it but the direct link doesn't have the information about the video title just the title it gives something like videoback

1

There are 1 best solutions below

0
5rod On

You can do this with playwright. Playwright is a web scraping library that allows dynamic scraping of websites, and in many different browsers.

Install it in these two steps (in the terminal):

pip install playwright
playwright install

Then you can use it to web scrape, here's an example (in this case I used microsoft edge as my browser):

from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch(channel="msedge")
    page = browser.new_page()
    page.goto('playlist link here')
    #find elements and get a list of the video titles
    browser.close()

Of course, you'll still have to find the elements and explore youtube's html structure to be able to scrape the page. Before doing anything however, I recommend checking out the documentation so you have a good idea of what to expect and how to go about scraping using playwright.