ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
131.72k stars 9.97k forks source link

extract_info() tries to download all files from a playlist even if told not to #29598

Open nitanmarcel opened 3 years ago

nitanmarcel commented 3 years ago

Checklist

Verbose log

[youtube:tab] RDjKmgXcs-bqg: Downloading webpage
[download] Downloading playlist: Mix - The Streets Of The Bronx
[youtube:tab] playlist Mix - The Streets Of The Bronx: Downloading 25 videos
[download] Downloading video 1 of 25
[youtube] jKmgXcs-bqg: Downloading webpage
[youtube] Downloading just video jKmgXcs-bqg because of --no-playlist
[debug] Invoking downloader on 'https://r4---sn-p5qlsndz.googlevideo.com/videoplayback?expire=1626805071&ei=7772YIjQK7SY2_gPhtGEyAU&ip=18.118.207.43&id=o-AJSNhq0tl_AAQ5kimERkY5AGE11Y5Za8nqhehG2IgREk&itag=251&source=youtube&requiressl=yes&mh=b4&mm=31%2C26&mn=sn-p5qlsndz%2Csn-vgqsknlk&ms=au%2Conr&mv=u&mvi=4&pl=22&vprv=1&mime=audio%2Fwebm&ns=SrJ_3iAD9fm_lP3kzb3QLGIG&gir=yes&clen=3072209&dur=177.761&lmt=1496236688180999&mt=1626783082&fvip=4&keepalive=yes&fexp=24001373%2C24007246&c=WEB&n=Ts4yHx4ARe6xqpx&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl&lsig=AG3C_xAwRQIhAKeEjUDkw3LeLTVsqW2G8PLjNu5YMAN4ysGRDxnoCU-fAiBFhxxEzRh0KDL16JPIHv9x0BiwiFNe58uPwFZ-Kx6t4g%3D%3D&sig=AOq0QJ8wRAIgXwH7HIkq2S9AW55voOo3I74n_ySilZnPeNFwnpx88a8CIG85T2XuJi51jZm3J5zZwbCdvOQYywhVevma5vebOKPj'
[download] Sleeping 1 seconds...
[download] Destination: jKmgXcs-bqg.webm
[download] 100% of 2.93MiB in 00:59
[ffmpeg] Adding metadata to 'jKmgXcs-bqg.webm'
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i file:jKmgXcs-bqg.webm -c copy -metadata 'title=Streets of the Bronx' -metadata date=20100311 -metadata description= -metadata comment= -metadata 'purl=https://www.youtube.com/watch?v=jKmgXcs-bqg' -metadata 'artist=Cool Change' file:jKmgXcs-bqg.temp.webm
[download] Downloading video 2 of 25
[youtube] QwVjTlTdIDQ: Downloading webpage
[youtube] Downloading just video QwVjTlTdIDQ because of --no-playlist
[debug] Invoking downloader on 'https://r1---sn-p5qlsnrr.googlevideo.com/videoplayback?expire=1626805133&ei=LL_2YO3BO7OL2_gP58K64AQ&ip=18.118.207.43&id=o-ALBX4sZTA_tTTHGecBNQriCr08QE4ZK_iV5U0eWE9z8H&itag=251&source=youtube&requiressl=yes&mh=iK&mm=31%2C26&mn=sn-p5qlsnrr%2Csn-vgqskn7z&ms=au%2Conr&mv=u&mvi=1&pl=22&gcr=us&vprv=1&mime=audio%2Fwebm&ns=d-EmLHbRPmT_vmk8cmWrQ2wG&gir=yes&clen=5843684&dur=339.981&lmt=1537047191673015&mt=1626783082&fvip=1&keepalive=yes&fexp=24001373%2C24007246&c=WEB&n=kmWBw9GgesuNUfd&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cgcr%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl&lsig=AG3C_xAwRQIhAJGdclDYCTjHixgXf2RVCEEqFTQx_3CWMuo3UQUw5IM_AiAbt3kuYsxqseUE9tbRexAcy0YVsBtu98HB9j4bNM5VFg%3D%3D&sig=AOq0QJ8wRQIgCvBfECj5ojzcQsfT0AsVpJ1H-XMr71Qfpsi389GetH0CIQCIy-FJ2sHdy9uIU-UMzZiHP6IqEesv7DICTUxxejSrqA=='
[download] Sleeping 1 seconds...
[download] Destination: QwVjTlTdIDQ.webm
[download] 100% of 5.57MiB in 00:00
[ffmpeg] Adding metadata to 'QwVjTlTdIDQ.webm'
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i file:QwVjTlTdIDQ.webm -c copy -metadata 'title=Piano Man' -metadata date=20130322 -metadata 'description=In 1973, Billy Joel released his legendary '"'"'Piano Man'"'"' album. Listen to Billy Joel perform the title track '"'"'Piano Man'"'"'.

http://smarturl.it/BJ_CJPM_YT?IQid=ytd.bj.pma
Listen to the Piano Man album in full now

http://smarturl.it/BJ_DSTFMR_YT?IQid=ytd.bj.pma
Listen to more of Billy Joel'"'"'s top tracks.

iTunes: http://smarturl.it/BJ_TEBJ_iTunes?IQid=ytd.bj.pma
Amazon: http://smarturl.it/BJ_TEBJ_Amzn?IQid=ytd.bj.pma 
Spotify: http://smarturl.it/BillyJoel_Spotify?IQid=ytd.bj.pma
Google Play: http://smarturl.it/BJ_Gplay?IQid=ytd.bj.pma

Facebook: http://smarturl.it/BJ_YD_FB?IQid=ytd.bj.pma
Twitter: http://smarturl.it/BJ_YD_T?IQid=ytd.bj.pma
Subscribe: http://smarturl.it/BJ_YD_YT?IQid=ytd.bj.pma

Lyrics:
He says, '"'"'Son can you play me a memory
I'"'"'m not really sure how it goes
But it'"'"'s sad and it'"'"'s sweet
And I knew it complete
When I wore a younger man'"'"'s clothes'"'"'

Sing us a song you'"'"'re the piano man
Sing us a song tonight
Well we'"'"'re all in the mood for a melody
And you'"'"'ve got us feeling alright

Billy Joel'"'"'s official YouTube channel features music videos, live performances, interviews, TV appearances and more. Best known for his first hit song, '"'"'Piano Man'"'"', in 1973, Billy has written and recorded thirty- three Top 40 hits in the United States. He is a six-time Grammy Award winner, a 23-time Grammy nominee and one of the world'"'"'s best-selling artists of all time, having sold over 150 million records worldwide. Billy Joel is the sixth-best-selling recording artist and the third-best-selling solo artist in the United States.' -metadata 'comment=In 1973, Billy Joel released his legendary '"'"'Piano Man'"'"' album. Listen to Billy Joel perform the title track '"'"'Piano Man'"'"'.

http://smarturl.it/BJ_CJPM_YT?IQid=ytd.bj.pma
Listen to the Piano Man album in full now

http://smarturl.it/BJ_DSTFMR_YT?IQid=ytd.bj.pma
Listen to more of Billy Joel'"'"'s top tracks.

iTunes: http://smarturl.it/BJ_TEBJ_iTunes?IQid=ytd.bj.pma
Amazon: http://smarturl.it/BJ_TEBJ_Amzn?IQid=ytd.bj.pma 
Spotify: http://smarturl.it/BillyJoel_Spotify?IQid=ytd.bj.pma
Google Play: http://smarturl.it/BJ_Gplay?IQid=ytd.bj.pma

Facebook: http://smarturl.it/BJ_YD_FB?IQid=ytd.bj.pma
Twitter: http://smarturl.it/BJ_YD_T?IQid=ytd.bj.pma
Subscribe: http://smarturl.it/BJ_YD_YT?IQid=ytd.bj.pma

Lyrics:
He says, '"'"'Son can you play me a memory
I'"'"'m not really sure how it goes
But it'"'"'s sad and it'"'"'s sweet
And I knew it complete
When I wore a younger man'"'"'s clothes'"'"'

Sing us a song you'"'"'re the piano man
Sing us a song tonight
Well we'"'"'re all in the mood for a melody
And you'"'"'ve got us feeling alright

Billy Joel'"'"'s official YouTube channel features music videos, live performances, interviews, TV appearances and more. Best known for his first hit song, '"'"'Piano Man'"'"', in 1973, Billy has written and recorded thirty- three Top 40 hits in the United States. He is a six-time Grammy Award winner, a 23-time Grammy nominee and one of the world'"'"'s best-selling artists of all time, having sold over 150 million records worldwide. Billy Joel is the sixth-best-selling recording artist and the third-best-selling solo artist in the United States.' -metadata 'purl=https://www.youtube.com/watch?v=QwVjTlTdIDQ' -metadata 'artist=Billy Joel' file:QwVjTlTdIDQ.temp.webm
[download] Downloading video 3 of 25
[youtube] hIHxDxTcuDk: Downloading webpage
[youtube] Downloading just video hIHxDxTcuDk because of --no-playlist
[debug] Invoking downloader on 'https://r2---sn-p5qlsndd.googlevideo.com/videoplayback?expire=1626805135&ei=L7_2YK3KJLfz2_gPmN6B-As&ip=18.118.207.43&id=o-ANQ9djjKfJ6iywWfeDpYLeruONIZAwM6FJxdQJcruBNF&itag=140&source=youtube&requiressl=yes&mh=Rb&mm=31%2C26&mn=sn-p5qlsndd%2Csn-vgqsknld&ms=au%2Conr&mv=u&mvi=2&pl=22&vprv=1&mime=audio%2Fmp4&ns=7ScJH5Q49GwXGtiDVby7k7MG&gir=yes&clen=4037767&dur=249.451&lmt=1593849097320431&mt=1626783082&fvip=2&keepalive=yes&fexp=24001373%2C24007246&c=WEB&txp=5531432&n=03JGKch_vQ9I3h7&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl&lsig=AG3C_xAwRgIhALWE1H0eW4DAETwqxOdufxN70hmrESYvpMB3bhlokRKiAiEA9S_bozBsc0Qmx3Mep9goSger7NgebHCYHxiUbP7pYFc%3D&sig=AOq0QJ8wRQIhAOfk5ryf_q-CSF1_Q4FyVxjV3Tb6dyGAdAY396Nux6U1AiAOEbDU1MQZuQ--eGMTtuYoPC-_3cohH8evKckF0wzEsQ=='
[download] Sleeping 1 seconds...
[download] Destination: hIHxDxTcuDk.m4a
[download] 100% of 3.85MiB in 00:00
[ffmpeg] Correcting container in "hIHxDxTcuDk.m4a"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i file:hIHxDxTcuDk.m4a -c copy -f mp4 file:hIHxDxTcuDk.temp.m4a
[ffmpeg] Adding metadata to 'hIHxDxTcuDk.m4a'
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i file:hIHxDxTcuDk.m4a -vn -acodec copy -metadata 'title=Durand Jones & The Indications - Is It Any Wonder? - 8/28/2017 - Paste Studios, New York, NY' -metadata date=20170907 -metadata 'description=Durand Jones & The Indications - Is It Any Wonder?
Recorded Live: 8/28/2017 - Paste Studios - New York, NY
More Durand Jones & The Indications in the Paste Cloud: http://www.pastemagazine.com/search?t=Durand Jones & The Indications&m=Video
Visit Paste Magazine: http://www.pastemagazine.com

Audio: Bob Mallory
Video: Brad Wagner' -metadata 'comment=Durand Jones & The Indications - Is It Any Wonder?
Recorded Live: 8/28/2017 - Paste Studios - New York, NY
More Durand Jones & The Indications in the Paste Cloud: http://www.pastemagazine.com/search?t=Durand Jones & The Indications&m=Video
Visit Paste Magazine: http://www.pastemagazine.com

Audio: Bob Mallory
Video: Brad Wagner' -metadata 'purl=https://www.youtube.com/watch?v=hIHxDxTcuDk' -metadata 'artist=Paste Magazine' file:hIHxDxTcuDk.temp.m4a
[download] Downloading video 4 of 25
[youtube] 7gV81mKADcA: Downloading webpage
[youtube] Downloading just video 7gV81mKADcA because of --no-playlist
[debug] Invoking downloader on 'https://r5---sn-p5qlsndz.googlevideo.com/videoplayback?expire=1626805138&ei=Mb_2YMaDPN7U2_gP-qKJsA8&ip=18.118.207.43&id=o-AHWnrAjg7IX2wExX489yXElFWgAp6sqyg5XDSpCB9UVT&itag=251&source=youtube&requiressl=yes&mh=k1&mm=31%2C26&mn=sn-p5qlsndz%2Csn-vgqsknlz&ms=au%2Conr&mv=u&mvi=5&pl=22&gcr=us&vprv=1&mime=audio%2Fwebm&ns=Dlc0EZtvI41vGkzW9GYRLsoG&gir=yes&clen=5047128&dur=286.501&lmt=1574714431059071&mt=1626783082&fvip=5&keepalive=yes&fexp=24001373%2C24007246&c=WEB&txp=5531432&n=0Uo9xBk_M3DsqYZ&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cgcr%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl&lsig=AG3C_xAwRQIgIqUoKnR1rocOGU_7V_tsCsbsmTi1AC3hXdXcCs9Pt8YCIQChbeoftEC9qB7Myc66avfNXu_1qqC7pe9-cPvR6jDfGg%3D%3D&sig=AOq0QJ8wRQIhANI36bPeVQyMiVQSoOqHikVoYv0EiGhVfQk6jR0X87myAiB2bm4jOR7THAy57BFDYXfnf8p6xndpsWsptCyXeF11FA=='

Description

I'm trying download an youtube video given a playlist url and even with noplaylist added in the options dict it still tries to download the whole playlist.

Code:


_ytdl_opts = {"format": "bestaudio/best",
              "extractaudio": True,
              "restrictfilenames": True,
              "noplaylist": True,
              "force_noplaylist": True,
              "logtostderr": False,
              "outtmpl": "%(id)s.%(ext)s",
              "source_address": "0.0.0.0",
              "postprocessors": [{"key": "FFmpegMetadata"}]}
ytdl = YoutubeDL(_ytdl_opts)

async with semaphore:
    download = await run_in_executor(ytdl.extract_info, url)
    if "entries" in download.keys():
        download = download["entries"][0]
    process = ffmpeg.input(f"{song.id}.{song.original_ext}").output(song.file, format="s16le",
                                                                    acodec="pcm_s16le",
                                                                    ac=2, ar="48k").overwrite_output()
    await run_in_executor(process.run)

async def run_in_executor(func, *args, **kwargs):
    return await LOOP.run_in_executor(executor=THREAD_POOL, func=partial(func, *args, **kwargs))
ghost commented 3 years ago

I don't know what you really want to do, but

  1. add "extract_flat": True, to your options
  2. with the playlist url, do info = ytdl.extract_info(playlist_url, download=False)
  3. with the 1st url from the result info["entries"][0]["url"], do ytdl.extract_info(url)

I get this and finish.

[youtube:tab] RDjKmgXcs-bqg: Downloading webpage
[download] Downloading playlist: Mix - The Streets Of The Bronx
[youtube:tab] playlist Mix - The Streets Of The Bronx: Downloading 25 videos
[download] Downloading video 1 of 25
...
[download] Downloading video 25 of 25
[download] Finished downloading playlist: Mix - The Streets Of The Bronx
[youtube] 9xp1XWmJ_Wo: Downloading webpage
[youtube] Downloading just video 9xp1XWmJ_Wo because of --no-playlist
[download] Destination: 9xp1XWmJ_Wo.m4a
[download] 100% of 949.77KiB in 00:00
[ffmpeg] Correcting container in "9xp1XWmJ_Wo.m4a"
[ffmpeg] Adding metadata to '9xp1XWmJ_Wo.m4a'