'how to get around HTTP Error 403: Forbidden error while downloading a video using download link

I'm working on a code in which I access a website using selenium and put a link in a download field then extract the download link from download button and download the video using urllib.request. I managed to do it until extracting the download link but when I try to download it I get this 403 error. here is my code:

req = Request(downloadlink, headers={
          'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36'})
urlretrieve(downloadlink, r'C:\some\place\on\my\pc\file_name')

I tried sending the request containing the headers both to the main website and the video download link but every time I'm getting this 403 error. is there any way to get around this?

P.S:

  1. the website is a downloader website which you put video url from for example tiktok or reddit and it shows you some bottoms to downland it.
  2. this download link directly downloads the media on system, meaning if you click on it on windows the window which asks you where you want to save it pops up.


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source