how to extract media (video, photo, etc) download url?

I created a browser based on

WKWebView
. I need to add the ability to download videos, photos, music, etc. in the AppStore there are many applications, such as DManager, where you open any link, and if it contains a media file it immediately determines that the site contains a media file and offers to download. To download by URL I need to extract url. For example to extract youtube video link i found this solution https://github.com/devandsev/YoutubeDirectLinkExtractor
how to extract media (video, photo, etc) download url?
 
 
Q