ඕනෑම video එකක් download කරමු!

shenic88

Well-known member
  • May 19, 2020
    1,511
    3,212
    113
    Sri Lanka
    මේ කියන්න යන්නේ ඕනෑම video එකක් download කර ගන්න හැටි!
    video එක විතරක් නෙවේ එකේ audio එකත් වෙනම ගන්න පුළුවන්!

    මම මුලිකවම කියලා දෙන්නේ GNU/Linux වල කරන හැටි.. නමුත් පහල මම Windows සහ macOS සඳහා YouTube links දාලා තියනවා.
    මේ GNU/Linux commands ඒ විදිහටම Windows සහ macOS සහ වෙනත් OS සඳහා වැඩ කරනවා කියලා මම හිතනවා.

    tool එකේ / package එකේ නම තමයි youtube-dl.
    මේකෙන් YouTube විතරක් නෙවේ පහත ලින්ක් එකේ දාලා තියන විදිහට websites 1000 කට වැඩි ප්‍රමාණයක video/audio download කර ගන්න පුළුවන්.

    https://github.com/ytdl-org/youtube-dl/blob/master/docs/supportedsites.md

    මම මෙතන පහල දාන්නේ youtube-dl වල ගොඩක් ම ප්‍රයෝජනවත් වෙන commands ටිකක්.
    මම මේවා සාරාංශ කර ගත්තේ මෙන්න මේ පහල web එකෙන්.
    https://ostechnix.com/youtube-dl-tutorial-with-examples-for-beginners/

    මම සාරාංශ කර ගත්ත note එකක් පහල දානවා. ඒක තේරුම් අරගෙන පාවිච්චි කරලා බලන්න.



    Code:
    -------------------------
    youtube-dl
    -------------------------
    https://youtube-dl.org/
    https://wiki.archlinux.org/index.php/Youtube-dl
    
    
    Suppoerted Websites
    --------------------
        https://github.com/ytdl-org/youtube-dl/blob/master/docs/supportedsites.mdyoutube-dl/blob/master/docs/supportedsites.md
    
    Install
    -------------
        $ sudo pacman -S youtube-dl ffmpeg (for Arch family)
        $ sudo apt install youtube-dl ffmpeg (for Debian faniliy)
        .... .... .... etc
    
        youtube-dl
        ----------
        youtube-dl is a command-line program that lets you easily download videos and audio from more than a thousand websites.
    
        ffmpeg
        -----
        FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video
    
    Config(optional)
    ---------------
        $ sudo nano ~/.config/youtube-dl/config
    
        # Default download location
        -o ~/Downloads/%(title)s.%(ext)s
    
    Getting help
    ------------
        $ youtube-dl --help
    
    Get/Check Available formats
    -------------
        $ youtube-dl -F <url>
        $ youtube-dl --list-formats <url>
    
    Download video/audio or playlist
    --------------------------
        video
        -----
        $ youtube-dl <url>
        $ youtube-dl <url-1> <url-2> <url-3>
    
        audio (default Ogg (opus) extension)
        -----
        $ youtube-dl -x <url>
        $ youtube-dl -x <url-1> <url-2> <url-3>
    
    Download given format
    ----------------------
        given extension
        ---------------
        $ youtube-dl -f mp4 <url>
        $ youtube-dl -x --audio-format mp3 <url>
    
        given format code
        -----------------
        $ youtube-dl -f 160 <url>
    
    Download with given path/to/filename
    ------------------------------------
        $ youtube-dl -x --audio-format mp3 -o '~/Music/%(title)s.%(ext)s' <url>
    
    Filename - title/uploader name/channel name/upload date
    --------------------------------------------------------
        $ youtube-dl -o '%(title)s by %(uploader)s on %(upload_date)s in %(playlist)s.%(ext)s' <url>
    
    Download all URLs in a text file
    -------------------------------
        ~/Music/youtube-urls.txt :-
    
        <url-1>
        <url-2>
        <url-3>
        <url-4>
        <url-5>
    
        $ youtube-dl -a ~/Music/youtube-urls.txt
    
    Download videos in certain quality and/or format
    ------------------------------------------------
        [#] best - Select the best quality format of the given file with video and audio.
        [#] worst - Select the worst quality format (both video and audio).
        [#] bestvideo - Select the best quality video-only format (e.g. DASH video). Please note that it may not be available.
        [#] worstvideo - Select the worst quality video-only format. May not be available.
        [#] bestaudio - Select the best quality audio only-format. May not be available.
        [#] worstaudio - Select the worst quality audio only-format. May not be available.
    
        audio-only with best quality.
        --------------
        $ youtube-dl -f bestaudio <url>
    
        1 file with 2 different qualities combined
        --------------
        $ youtube-dl -f bestvideo+bestaudio <url>
    
        2 files with 2 differnat qualities
        --------------
        $ youtube-dl -f 'bestvideo,bestaudio' <url>
    
        given quality with specific resolution
        --------------------------------------
        $ youtube-dl -f 'bestvideo[height<=720]' <url>
        $ youtube-dl -f 'bestvideo[height<=720]+bestaudio[height<=720]' <url>
        $ youtube-dl -f 'bestvideo[height<=720],bestaudio[height<=720]' <url>
    
        given quality with given format/extention
        ------------------------------------------
        $ youtube-dl -f 'bestvideo[ext=mp4],bestaudio[ext=m4a]' <url>
    
        if not available, go for the next
        ---------------------------------
        $  youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' <url>
    
    Set size limit for videos
    -------------------------
        $ youtube-dl --min-filesize 100M <playlist_url>
        $ youtube-dl --max-filesize 500M <playlist_url>
        $ youtube-dl -f 'bestvideo[filesize<200M]' <url>
    
    Download videos by date-wise
    ----------------------------
        download videos uploaded at an exact date - October 01, 2018
        ------------------------------------------------------------
        $ youtube-dl --date 20181001 <URL>
    
        Download videos uploaded on or before October 01, 2018
        ------------------------------------------------------
        $ youtube-dl --datebefore 20180101 <URL>
    
        Download videos uploaded on or after October 01, 2018
        ------------------------------------------------------
        $ youtube-dl --dateafter 20180101 <URL>
    
        Download only the videos uploaded in the last 6 months
        ------------------------------------------------------
        $ youtube-dl --dateafter now-6months <URL>
    
        Download videos between January 01, 2018 and January 01, 2019
        --------------------------------------------------------------
        $ youtube-dl --dateafter 20180101 --datebefore 20190101 <URL>
    
    Download specific videos from playlist
    -------------------------------------
        Download the 10th file from a playlist
        -------------------------------------
        $ youtube-dl --playlist-items 10 <playlist_url>
    
        Download multiple random files
        -----------------------------
        $ youtube-dl --playlist-items 2,3,7,10 <playlist_url>
    
        Download a video playlist starting from 10 to end
        -------------------------------------------------
        $ youtube-dl --playlist-start 10 <playlist_url>
    
        Download only the files starting from 2nd to 5th in a playlist
        -------------------------------------------------------------
        $ youtube-dl --playlist-start 2 --playlist-end 5 <playlist_url>
    
    Download only videos suitable for specific age
    ---------------------------------------------
        $ youtube-dl --match-title "let's play" --age-limit 7 --reject-title "nsfw" <playlist_url>
    
    Set download speed limit
    ------------------------
        $ youtube-dl -r 50K <URL>
    
    Resume downloads
    ----------------
        $ youtube-dl  -c  <URL>


    Windows වල කරන විදිහ.
    ----------------------------------




    macOS වල කරන විදිහ.
    --------------------------------



    Note එක මම text file එකක් විදිහට මෙතන attach කරලා තියනවා. එක අරගෙන තියාගන්නත් පුළුවන්.

    comment එකක් දාගෙන යන්න... අවුල් තියන ඒවා කියන්න. අපිඋ බලමු කොහොමද මොනවද කරන්න පුළුවන් කියලා පසුව... :)


    PS:
    --------------------------

    මට කියන්න අමතක උනා.. GNU/Linux භාවිතා කරන්නන්ට ගොඩක්ම වැදගත් වෙන තව දෙයක්..
    මේ හෙන දිග commands කෙටි කර ගන්නේ කොහොමද?
    මේක මේ thread එකට නෙවේ හැම දේටම ගොඩක්ම වැදගත් වෙන දෙයක්..
    ඒක කරන්නේ මෙහෙම.. මේ මගේ වෙන note එකක්.

    Code:
    Create .bashrc file in your home directory if it's not there
    -----------------------------------------------------------
        /home/<username>/.bashrc
    
    Comment line
    ------------
        Comments begin with #
        # this is a comment line
    
    Edit bashrc file
    ----------------
        $ sudo nano /home/<username>/.bashrc
        save .bashrc
    
    Load/Reload bashrc config
    -------------------------
        $ . /home/<username>/.bashrc
    
    Create aliases for Linux terminal commands
    ------------------------------------------
        #-------------
        # youtube-dl = ydl
        #-------------
        alias ydl-chk='youtube-dl -F
        alias ydl-mp3='youtube-dl -x --audio-format mp3
        alias ydl-ba='youtube-dl -f bestaudio
        alias ydl-bv='youtube-dl -f bestvideo
    
        usage
        -----
        $ ydl-chk <URL>
        $ ydl-mp3 <URL>
        $ ydl-ba <URL>
        $ ydl-bv <URL>


    මේකත් attach කරලා තියනවා අරගන්න..
     

    Attachments

    • bashrc-config.txt
      723 bytes · Views: 154
    • youtube-dl.txt
      5.3 KB · Views: 186
    Last edited:

    shenic88

    Well-known member
  • May 19, 2020
    1,511
    3,212
    113
    Sri Lanka
    machn onema audio file ekak download krnnath puluvanda me vidiyata ?
    video ekaka audio eka nan ban sure ekatama enawa.
    video ekak nathuwa audio eka witharak thibbath enna ona.. mama check karala kiyannam ban.. :)

    ------------------------------------
    https://github.com/ytdl-org/youtube-dl/blob/master/docs/supportedsites.md
    test ekak kala,

    me web eke nan machan pennanawa download karanna puluwan
    https://video.aktualne.cz/dvtv/po-d...sky-vulka/r~b5ef8882896a11eba4560cc47ab5f122/
    Screenshot from 2021-03-21 23-13-29.png


    habai



    me link eke audio eka ganna giya eeka nan error ekak pennanawa.

    balamu mama vidihak hamba unoth kiyannam :)
     
    Last edited:

    shenic88

    Well-known member
  • May 19, 2020
    1,511
    3,212
    113
    Sri Lanka
    Just use the Windows Installer from YouTube-DLG - It's the same thing but with an easy interface.
    (This is a cross platform front-end GUI of the popular youtube-dl written in wxPython.)
    thanks mchan! (y)

    mata nan command line eka patta lesi! nikan mokak hari eka vidihak dekak mathaka thiyagena short cut ekak hada gaththama mara lesi..
    habai ee Linux wala.
    Windows/macOS mama try kale na. samahara wita Windows users la me method ekata kamathi wei! (y)
     
    • Like
    Reactions: Stimulus mind