CentBrowser Forum
how video download works? - Printable Version

+- CentBrowser Forum (https://www.centbrowser.net/en)
+-- Forum: Members Area (https://www.centbrowser.net/en/forumdisplay.php?fid=3)
+--- Forum: General Discuss (https://www.centbrowser.net/en/forumdisplay.php?fid=5)
+--- Thread: how video download works? (/showthread.php?tid=4736)



how video download works? - QZMTCH - 11-16-2022

Hi, this question is for the developer or those who know how video downloading works

I see that in the local state file there are such lines:
Code:
"video_download":{"blocked_sites":["netflix.com"],"direct_sites":["youtube.com","facebook.com","twitter.com","tiktok.com","instagram.com","twitch.tv","afreecatv.com"],"disabled_level":"0","online_downloaders":{"g0":"https://save.tube/?video={URL}","g1":"https://getvideo.org/en?url={URL}","g2":"https://fdown.net/download.php?URLz={URL}","g3":"https://twittervideodownloader.com/","g4":"https://www.flvcd.com/parse.php?format=&kw={URL}","g5":"https://www.videofk.com/douyin-video-download/search?url={URL}","g6":"https://en.savefrom.net/","g7":"https://toolzu.com/downloader/tiktok/","g8":"https://igram.io/"},"supported_sites":{"facebook.com":"g2","instagram.com":"g8","tumblr.com":"g4","twitter.com":"g3","vimeo.com":"g0","youtube.com":"g0"},"vd_tools_info":{"direct_cmd":"{TOOL_PATH} -o {OUTPUT_PATH} --no-check-certificates --force-overwrites --proxy \"{PROXY_SERVER}\" --add-header \"User-Agent:{USER_AGENT}\" --add-header \"Cookie:{COOKIES}\" --merge-output-format mp4 {URL_OR_PLAYLIST}","ff_name":"ffmpeg.exe","ff_pull_cmd":"{TOOL_PATH} -y -reconnect_on_network_error 1 -protocol_whitelist file,http,https,tcp,tls,crypto -referer \"{REFERRER}\" -user_agent \"{USER_AGENT}\" -cookies \"{COOKIES}\" -i {URL_OR_PLAYLIST} -codec copy {OUTPUT_PATH}","url":"https://static.centbrowser.cn/.misc_tools/win/vd_tools_x86.exe","v_merge_cmd":"{TOOL_PATH} -fflags +discardcorrupt -y -i {VIDEO_PATH} -codec copy -bsf:a aac_adtstoasc {OUTPUT_PATH}","va_merge_cmd":"{TOOL_PATH} -fflags +discardcorrupt -y -i {VIDEO_PATH} -i {AUDIO_PATH} -codec copy -bsf:a aac_adtstoasc {OUT_PATH}","version":"0.0","yd_name":"yt-dlp.exe","yd_pull_cmd":"{TOOL_PATH} -o {OUTPUT_PATH} --no-check-certificates --force-overwrites --proxy \"{PROXY_SERVER}\" --add-header \"User-Agent:{USER_AGENT}\" --add-header \"Cookie:{COOKIES}\" --add-header \"Referer:{REFERRER}\" --merge-output-format mp4
"video_download":                     these are video download services
"vd_tools_info":                         this is adding metadata to the downloaded video file (correct me if this is not true)

why not do everything with yt-dlp and ffmpeg? download and add metadata
why not give the user a choice of what to download in the settings? which service to download from the list or which program to download, since there is such an opportunity inside the browser code
maybe in the future you can still make it possible in the settings for yt-dlp to choose what quality to download with what codecs (on the same YouTube a lot of codecs) and post-processing settings in ffmpeg?

it would be convenient in the settings of the browser itself in the parameters field for the program (similar to the Run with command line switches field) to customize this button for yourself and also what kind of post-processing you personally need in ffmpeg

Update 
that's it, I figured out how the browser downloads the video 
in the lines:
Code:
"direct_sites": ["youtube.com", "facebook.com", "twitter.com", "tiktok.com", "instagram.com", "twitch.tv", "afreecatv.com"]
and
Code:
"supported_sites": {
                    "facebook.com": "g2",
                    "instagram.com": "g8",
                    "tumblr.com": "g4",
                    "twitter.com": "g3",
                    "vimeo.com": "g0",
                    "youtube.com": "g0"
                }
downloads services, and everything else using yt-dlp with settings

if you remove YouTube from these lines, and block the file with read-only attributes, then YouTube will download from the site using yt-dlp with the settings of their file
so if there is already such functionality in the browser, then why is it not fully available to users?

from the entire community of fans of the cent browser, and from fans of yt-dlp, I ask you to add the ability in the settings to choose for which site than to download through this button in the floating menu, and with a choice of command line settings for yt-dlp and ffmpeg... plz  Shy


RE: how video download works? - Admini - 11-23-2022

This is designed for future change.
For example, if the usage of some parameter/feature changed, we need to push it to our users.
Another reason is that they are both working for some websites and not working for some others.
"direct_sites" are using yt-dlp by default and "supported_sites" are using online tools by default.
If you are familiar with yt-dlp/youtube-dl, you can use them in cmd.exe directly.
In most cases cookies and referrers are not needed.


RE: how video download works? - QZMTCH - 11-26-2022

(11-23-2022, 04:23 PM)CentBrowser Wrote: This is designed for future change.

cool, we'll be waiting


Quote:"direct_sites" are using yt-dlp by default and "supported_sites" are using online tools by default.

but YouTube is not downloaded using yt-dlp by default, but I would like it to be downloaded by this program, with its own settings


Quote:If you are familiar with yt-dlp/youtube-dl, you can use them in cmd.exe directly.

do you mean use yt-dlp in console directly, without a pop-up menu near the video player? Yes, I’m doing this for now, because if you change this file in your own way, then it is overwritten, I would like to see all this in the settings quickly, and so that you can configure the entire cmd query string to the tools in the settings for yourself

Thanks  Wink


RE: how video download works? - Admini - 11-26-2022

(11-26-2022, 12:46 AM)QZMTCH Wrote: cool, we'll be waiting



but YouTube is not downloaded using yt-dlp by default, but I would like it to be downloaded by this program, with its own settings



do you mean use yt-dlp in console directly, without a pop-up menu near the video player? Yes, I’m doing this for now, because if you change this file in your own way, then it is overwritten, I would like to see all this in the settings quickly, and so that you can configure the entire cmd query string to the tools in the settings for yourself

Thanks  Wink
Do you want to change the default command line? Why?
For Youtube issue, can you provide an URL that is not using yt-dlp?


RE: how video download works? - QZMTCH - 11-27-2022

(11-26-2022, 04:36 PM)CentBrowser Wrote: Do you want to change the default command line? Why?
no, I just would like in the browser settings to have a request input field for yt-dlp, for my settings, the same input field as for launching the browser with launch keys
and the choice of sites for which yt-dlp will download by default

Quote:For Youtube issue, can you provide an URL that is not using yt-dlp?

I had this when I tested it
any YouTube video, by clicking on the download button that pops up in the player, downloads the service specified in the file, and not the yt-dlp program
only if you remove YouTube from "supported_sites": , it will download yt-dlp 

because by default, when you click to download a video on YouTube, there are no signs of downloading for a very long time (and just this should also be added to the loading pop-up window so that this window displays the progress of the download as in cmd, something like this line https://i.imgur.com/IEpUYTh.png or the same output as cmd, so that you can see the progress of loading and combining video and audio) , and only after a while the download starts, and if you remove these lines, the download starts immediately

checking again now, I realized that it is downloaded from YouTube by default using yt-dlp, but I would like to have access to the settings directly in the browser, let's say I want to remove --merge-output-format mp4, but changes in the file are overwritten and I need to change the read-only attribute of the file

I don't want to use extensions like this https://chrome.google.com/webstore/detail/open-in-external-app/okdopehcdgnellkaldfnaemhbpciplem to pass video link to cmd, it would be nice to use your popup menu


RE: how video download works? - QZMTCH - 11-28-2022

PS also, as a feature request, you can add in the browser settings the creation of several video download presets using yt-dlp, simply creating presets in the settings https://i.imgur.com/7MgPjjW.png, or loading from a file (maybe json) as done with loading a custom css style 
Code:
{
   "mp3": "-x --audio-format mp3 --audio-quality 0",
   "merge mp4": "--merge-output-format mp4 {URL_OR_PLAYLIST}",
   "<1080": "-f "bv*[height<=?1080]+ba[ext=m4a]/bv*+ba/b" --merge-output-format mp4 {URL_OR_PLAYLIST}"
}
and in the popup menu make a submenu https://i.imgur.com/rF5Wcaz.png  Wink


RE: how video download works? - Admini - 11-28-2022

(11-28-2022, 11:28 AM)QZMTCH Wrote: PS also, as a feature request, you can add in the browser settings the creation of several video download presets using yt-dlp, simply creating presets in the settings https://i.imgur.com/7MgPjjW.png, or loading from a file (maybe json) as done with loading a custom css style 
Code:
{
   "mp3": "-x --audio-format mp3 --audio-quality 0",
   "merge mp4": "--merge-output-format mp4 {URL_OR_PLAYLIST}",
   "<1080": "-f "bv*[height<=?1080]+ba[ext=m4a]/bv*+ba/b" --merge-output-format mp4 {URL_OR_PLAYLIST}"
}
and in the popup menu make a submenu https://i.imgur.com/rF5Wcaz.png  Wink
OK, we will consider your suggestion.
Generally we shouldn't make a feature too complicated, otherwise it will cause users to be confused.


RE: how video download works? - QZMTCH - 11-28-2022

(11-28-2022, 04:42 PM)CentBrowser Wrote: OK, we will consider your suggestion.
Generally we shouldn't make a feature too complicated, otherwise it will cause users to be confused.
yes, I understand, thanks.

So that this function is not difficult for users, you can make this feature as an additional function, and by default your settings  Wink