Youtube-dl --dump-json returning different extractor output for playlist when called from Python import vs. CLI










0















I am having trouble replicating the exact output of the specific --flat-playlist -j or --flat-playlist -J arguments provided to the youtube-dl cli, but using the direct python call instead.



Maybe i can't flush out the exact options i need to present or maybe the wrong function / method altogether?



I like this command because it is speedy and gives me only the YouTube ID's, without deep diving each and every video (As a simple benchmark, I can complete 4000 in about 30 seconds, vs. 4000 in 70 minutes via the regular info-only extraction).



CLI version, note that the cli somehow iterates, whereas the direct call method doesn't...



[root@tjds temp]# /usr/local/bin/youtube-dl --flat-playlist -J https://www.youtube.com/channel/UC6RNSPFcqY4BblL2Jg9SUtw 
"extractor": "youtube:playlist", "_type": "playlist", "uploader": "Patrick Best", "entries": ["url": "IaNEfhPmhPM", "_type": "url", "ie_key": "Youtube", "id": "IaNEfhPmhPM", "title": "Rona in Aurora - the death of a big box", "url": "JN-2vTf8-WM", "_type": "url", "ie_key": "Youtube", "id": "JN-2vTf8-WM", "title": "RealWorldNumbers - How to Test a Raspberry Pi Powered by Alkaline AA Batteries - After Poweroff", "url": "NmQmM36ja3o", "_type": "url", "ie_key": "Youtube", "id": "NmQmM36ja3o", "title": "RealWorldNumbers - How to Test a Raspberry Pi Powered by Alkaline AA Batteries - During the Test", "url": "MsrgW1Rdlso", "_type": "url", "ie_key": "Youtube", "id": "MsrgW1Rdlso", "title": "Raspberry Pi powered by AA batteries direct"], "id": "UU6RNSPFcqY4BblL2Jg9SUtw", "title": "Uploads from Patrick Best", "extractor_key": "YoutubePlaylist", "uploader_id": "patrickscottbest", "uploader_url": "https://www.youtube.com/user/patrickscottbest", "webpage_url": "https://www.youtube.com/playlist?list=UU6RNSPFcqY4BblL2Jg9SUtw", "webpage_url_basename": "playlist"



[root@tjds temp]# /usr/local/bin/youtube-dl --flat-playlist -j https://www.youtube.com/channel/UC6RNSPFcqY4BblL2Jg9SUtw
"url": "IaNEfhPmhPM", "_type": "url", "ie_key": "Youtube", "id": "IaNEfhPmhPM", "title": "Rona in Aurora - the death of a big box"
"url": "JN-2vTf8-WM", "_type": "url", "ie_key": "Youtube", "id": "JN-2vTf8-WM", "title": "RealWorldNumbers - How to Test a Raspberry Pi Powered by Alkaline AA Batteries - After Poweroff"
"url": "NmQmM36ja3o", "_type": "url", "ie_key": "Youtube", "id": "NmQmM36ja3o", "title": "RealWorldNumbers - How to Test a Raspberry Pi Powered by Alkaline AA Batteries - During the Test"
"url": "MsrgW1Rdlso", "_type": "url", "ie_key": "Youtube", "id": "MsrgW1Rdlso", "title": "Raspberry Pi powered by AA batteries direct"


Here's what my python script is:



 import youtube_dl
ydl_opts =
'extract_flat': True, ## --flat-playlist according to options.py
'dumpjson': True, ## lower -j
#'dump_single_json': True, ## UPPER -J

with youtube_dl.YoutubeDL(ydl_opts) as ydl:
object = ydl.extract_info(providedURL, download=False)
print (object)
print len(object)


and the result seems to only present the channel info without iterating:



[youtube:channel] UC6RNSPFcqY4BblL2Jg9SUtw: Downloading channel page
'_type': 'url', 'url': 'https://www.youtube.com/playlist?list=UU6RNSPFcqY4BblL2Jg9SUtw', 'ie_key': 'YoutubePlaylist', 'extractor': 'youtube:channel', 'webpage_url': 'https://www.youtube.com/channel/UC6RNSPFcqY4BblL2Jg9SUtw', 'webpage_url_basename': 'UC6RNSPFcqY4BblL2Jg9SUtw', 'extractor_key': 'YoutubeChannel'

7


Can anyone please steer me in the right direction or tell me what the best way is to accomplish that quick task? Is there a template component i need to address? Do I need to treat the response before it's ready for display?



>> print (youtube_dl.version.unicode_literals)
_Feature((2, 6, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 131072)

python --version
Python 3.6.5


Update,



As suggested, using the returned value of "url" seems to be a good enough workaround to continue my work. I still don't know why i don't see the same results that I would when using the CLI though... there seems to be a different logic there that automatically cycles through a channel's list, without having to run the command a second time.



>>> with youtube_dl.YoutubeDL(ydl_opts) as ydl:
... object = ydl.extract_info(providedURL, download=False)
... print (len(object))
... object2 = ydl.extract_info(object['url'], download=False)
... print (len(object2))
... print (object2)
...
[youtube:channel] UC6RNSPFcqY4BblL2Jg9SUtw: Downloading channel page
7


[download] Downloading playlist: Uploads from Patrick Best
[youtube:playlist] playlist Uploads from Patrick Best: Downloading 4 videos
[download] Downloading video 1 of 4
[download] Downloading video 2 of 4
[download] Downloading video 3 of 4
[download] Downloading video 4 of 4
[download] Finished downloading playlist: Uploads from Patrick Best
11
'_type': 'playlist', 'entries': ['_type': 'url', 'url': 'IaNEfhPmhPM', 'ie_key': 'Youtube', 'id': 'IaNEfhPmhPM', 'title': 'Rona in Aurora - the death of a big box', '_type': 'url', 'url': 'JN-2vTf8-WM', 'ie_key': 'Youtube', 'id': 'JN-2vTf8-WM', 'title': 'RealWorldNumbers - How to Test a Raspberry Pi Powered by Alkaline AA Batteries - After Poweroff', '_type': 'url', 'url': 'NmQmM36ja3o', 'ie_key': 'Youtube', 'id': 'NmQmM36ja3o', 'title': 'RealWorldNumbers - How to Test a Raspberry Pi Powered by Alkaline AA Batteries - During the Test', '_type': 'url', 'url': 'MsrgW1Rdlso', 'ie_key': 'Youtube', 'id': 'MsrgW1Rdlso', 'title': 'Raspberry Pi powered by AA batteries direct'], 'id': 'UU6RNSPFcqY4BblL2Jg9SUtw', 'title': 'Uploads from Patrick Best', 'uploader': 'Patrick Best', 'uploader_id': 'patrickscottbest', 'uploader_url': 'https://www.youtube.com/user/patrickscottbest', 'extractor': 'youtube:playlist', 'webpage_url': 'https://www.youtube.com/playlist?list=UU6RNSPFcqY4BblL2Jg9SUtw', 'webpage_url_basename': 'playlist', 'extractor_key': 'YoutubePlaylist'
>>>









share|improve this question




























    0















    I am having trouble replicating the exact output of the specific --flat-playlist -j or --flat-playlist -J arguments provided to the youtube-dl cli, but using the direct python call instead.



    Maybe i can't flush out the exact options i need to present or maybe the wrong function / method altogether?



    I like this command because it is speedy and gives me only the YouTube ID's, without deep diving each and every video (As a simple benchmark, I can complete 4000 in about 30 seconds, vs. 4000 in 70 minutes via the regular info-only extraction).



    CLI version, note that the cli somehow iterates, whereas the direct call method doesn't...



    [root@tjds temp]# /usr/local/bin/youtube-dl --flat-playlist -J https://www.youtube.com/channel/UC6RNSPFcqY4BblL2Jg9SUtw 
    "extractor": "youtube:playlist", "_type": "playlist", "uploader": "Patrick Best", "entries": ["url": "IaNEfhPmhPM", "_type": "url", "ie_key": "Youtube", "id": "IaNEfhPmhPM", "title": "Rona in Aurora - the death of a big box", "url": "JN-2vTf8-WM", "_type": "url", "ie_key": "Youtube", "id": "JN-2vTf8-WM", "title": "RealWorldNumbers - How to Test a Raspberry Pi Powered by Alkaline AA Batteries - After Poweroff", "url": "NmQmM36ja3o", "_type": "url", "ie_key": "Youtube", "id": "NmQmM36ja3o", "title": "RealWorldNumbers - How to Test a Raspberry Pi Powered by Alkaline AA Batteries - During the Test", "url": "MsrgW1Rdlso", "_type": "url", "ie_key": "Youtube", "id": "MsrgW1Rdlso", "title": "Raspberry Pi powered by AA batteries direct"], "id": "UU6RNSPFcqY4BblL2Jg9SUtw", "title": "Uploads from Patrick Best", "extractor_key": "YoutubePlaylist", "uploader_id": "patrickscottbest", "uploader_url": "https://www.youtube.com/user/patrickscottbest", "webpage_url": "https://www.youtube.com/playlist?list=UU6RNSPFcqY4BblL2Jg9SUtw", "webpage_url_basename": "playlist"



    [root@tjds temp]# /usr/local/bin/youtube-dl --flat-playlist -j https://www.youtube.com/channel/UC6RNSPFcqY4BblL2Jg9SUtw
    "url": "IaNEfhPmhPM", "_type": "url", "ie_key": "Youtube", "id": "IaNEfhPmhPM", "title": "Rona in Aurora - the death of a big box"
    "url": "JN-2vTf8-WM", "_type": "url", "ie_key": "Youtube", "id": "JN-2vTf8-WM", "title": "RealWorldNumbers - How to Test a Raspberry Pi Powered by Alkaline AA Batteries - After Poweroff"
    "url": "NmQmM36ja3o", "_type": "url", "ie_key": "Youtube", "id": "NmQmM36ja3o", "title": "RealWorldNumbers - How to Test a Raspberry Pi Powered by Alkaline AA Batteries - During the Test"
    "url": "MsrgW1Rdlso", "_type": "url", "ie_key": "Youtube", "id": "MsrgW1Rdlso", "title": "Raspberry Pi powered by AA batteries direct"


    Here's what my python script is:



     import youtube_dl
    ydl_opts =
    'extract_flat': True, ## --flat-playlist according to options.py
    'dumpjson': True, ## lower -j
    #'dump_single_json': True, ## UPPER -J

    with youtube_dl.YoutubeDL(ydl_opts) as ydl:
    object = ydl.extract_info(providedURL, download=False)
    print (object)
    print len(object)


    and the result seems to only present the channel info without iterating:



    [youtube:channel] UC6RNSPFcqY4BblL2Jg9SUtw: Downloading channel page
    '_type': 'url', 'url': 'https://www.youtube.com/playlist?list=UU6RNSPFcqY4BblL2Jg9SUtw', 'ie_key': 'YoutubePlaylist', 'extractor': 'youtube:channel', 'webpage_url': 'https://www.youtube.com/channel/UC6RNSPFcqY4BblL2Jg9SUtw', 'webpage_url_basename': 'UC6RNSPFcqY4BblL2Jg9SUtw', 'extractor_key': 'YoutubeChannel'

    7


    Can anyone please steer me in the right direction or tell me what the best way is to accomplish that quick task? Is there a template component i need to address? Do I need to treat the response before it's ready for display?



    >> print (youtube_dl.version.unicode_literals)
    _Feature((2, 6, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 131072)

    python --version
    Python 3.6.5


    Update,



    As suggested, using the returned value of "url" seems to be a good enough workaround to continue my work. I still don't know why i don't see the same results that I would when using the CLI though... there seems to be a different logic there that automatically cycles through a channel's list, without having to run the command a second time.



    >>> with youtube_dl.YoutubeDL(ydl_opts) as ydl:
    ... object = ydl.extract_info(providedURL, download=False)
    ... print (len(object))
    ... object2 = ydl.extract_info(object['url'], download=False)
    ... print (len(object2))
    ... print (object2)
    ...
    [youtube:channel] UC6RNSPFcqY4BblL2Jg9SUtw: Downloading channel page
    7


    [download] Downloading playlist: Uploads from Patrick Best
    [youtube:playlist] playlist Uploads from Patrick Best: Downloading 4 videos
    [download] Downloading video 1 of 4
    [download] Downloading video 2 of 4
    [download] Downloading video 3 of 4
    [download] Downloading video 4 of 4
    [download] Finished downloading playlist: Uploads from Patrick Best
    11
    '_type': 'playlist', 'entries': ['_type': 'url', 'url': 'IaNEfhPmhPM', 'ie_key': 'Youtube', 'id': 'IaNEfhPmhPM', 'title': 'Rona in Aurora - the death of a big box', '_type': 'url', 'url': 'JN-2vTf8-WM', 'ie_key': 'Youtube', 'id': 'JN-2vTf8-WM', 'title': 'RealWorldNumbers - How to Test a Raspberry Pi Powered by Alkaline AA Batteries - After Poweroff', '_type': 'url', 'url': 'NmQmM36ja3o', 'ie_key': 'Youtube', 'id': 'NmQmM36ja3o', 'title': 'RealWorldNumbers - How to Test a Raspberry Pi Powered by Alkaline AA Batteries - During the Test', '_type': 'url', 'url': 'MsrgW1Rdlso', 'ie_key': 'Youtube', 'id': 'MsrgW1Rdlso', 'title': 'Raspberry Pi powered by AA batteries direct'], 'id': 'UU6RNSPFcqY4BblL2Jg9SUtw', 'title': 'Uploads from Patrick Best', 'uploader': 'Patrick Best', 'uploader_id': 'patrickscottbest', 'uploader_url': 'https://www.youtube.com/user/patrickscottbest', 'extractor': 'youtube:playlist', 'webpage_url': 'https://www.youtube.com/playlist?list=UU6RNSPFcqY4BblL2Jg9SUtw', 'webpage_url_basename': 'playlist', 'extractor_key': 'YoutubePlaylist'
    >>>









    share|improve this question


























      0












      0








      0








      I am having trouble replicating the exact output of the specific --flat-playlist -j or --flat-playlist -J arguments provided to the youtube-dl cli, but using the direct python call instead.



      Maybe i can't flush out the exact options i need to present or maybe the wrong function / method altogether?



      I like this command because it is speedy and gives me only the YouTube ID's, without deep diving each and every video (As a simple benchmark, I can complete 4000 in about 30 seconds, vs. 4000 in 70 minutes via the regular info-only extraction).



      CLI version, note that the cli somehow iterates, whereas the direct call method doesn't...



      [root@tjds temp]# /usr/local/bin/youtube-dl --flat-playlist -J https://www.youtube.com/channel/UC6RNSPFcqY4BblL2Jg9SUtw 
      "extractor": "youtube:playlist", "_type": "playlist", "uploader": "Patrick Best", "entries": ["url": "IaNEfhPmhPM", "_type": "url", "ie_key": "Youtube", "id": "IaNEfhPmhPM", "title": "Rona in Aurora - the death of a big box", "url": "JN-2vTf8-WM", "_type": "url", "ie_key": "Youtube", "id": "JN-2vTf8-WM", "title": "RealWorldNumbers - How to Test a Raspberry Pi Powered by Alkaline AA Batteries - After Poweroff", "url": "NmQmM36ja3o", "_type": "url", "ie_key": "Youtube", "id": "NmQmM36ja3o", "title": "RealWorldNumbers - How to Test a Raspberry Pi Powered by Alkaline AA Batteries - During the Test", "url": "MsrgW1Rdlso", "_type": "url", "ie_key": "Youtube", "id": "MsrgW1Rdlso", "title": "Raspberry Pi powered by AA batteries direct"], "id": "UU6RNSPFcqY4BblL2Jg9SUtw", "title": "Uploads from Patrick Best", "extractor_key": "YoutubePlaylist", "uploader_id": "patrickscottbest", "uploader_url": "https://www.youtube.com/user/patrickscottbest", "webpage_url": "https://www.youtube.com/playlist?list=UU6RNSPFcqY4BblL2Jg9SUtw", "webpage_url_basename": "playlist"



      [root@tjds temp]# /usr/local/bin/youtube-dl --flat-playlist -j https://www.youtube.com/channel/UC6RNSPFcqY4BblL2Jg9SUtw
      "url": "IaNEfhPmhPM", "_type": "url", "ie_key": "Youtube", "id": "IaNEfhPmhPM", "title": "Rona in Aurora - the death of a big box"
      "url": "JN-2vTf8-WM", "_type": "url", "ie_key": "Youtube", "id": "JN-2vTf8-WM", "title": "RealWorldNumbers - How to Test a Raspberry Pi Powered by Alkaline AA Batteries - After Poweroff"
      "url": "NmQmM36ja3o", "_type": "url", "ie_key": "Youtube", "id": "NmQmM36ja3o", "title": "RealWorldNumbers - How to Test a Raspberry Pi Powered by Alkaline AA Batteries - During the Test"
      "url": "MsrgW1Rdlso", "_type": "url", "ie_key": "Youtube", "id": "MsrgW1Rdlso", "title": "Raspberry Pi powered by AA batteries direct"


      Here's what my python script is:



       import youtube_dl
      ydl_opts =
      'extract_flat': True, ## --flat-playlist according to options.py
      'dumpjson': True, ## lower -j
      #'dump_single_json': True, ## UPPER -J

      with youtube_dl.YoutubeDL(ydl_opts) as ydl:
      object = ydl.extract_info(providedURL, download=False)
      print (object)
      print len(object)


      and the result seems to only present the channel info without iterating:



      [youtube:channel] UC6RNSPFcqY4BblL2Jg9SUtw: Downloading channel page
      '_type': 'url', 'url': 'https://www.youtube.com/playlist?list=UU6RNSPFcqY4BblL2Jg9SUtw', 'ie_key': 'YoutubePlaylist', 'extractor': 'youtube:channel', 'webpage_url': 'https://www.youtube.com/channel/UC6RNSPFcqY4BblL2Jg9SUtw', 'webpage_url_basename': 'UC6RNSPFcqY4BblL2Jg9SUtw', 'extractor_key': 'YoutubeChannel'

      7


      Can anyone please steer me in the right direction or tell me what the best way is to accomplish that quick task? Is there a template component i need to address? Do I need to treat the response before it's ready for display?



      >> print (youtube_dl.version.unicode_literals)
      _Feature((2, 6, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 131072)

      python --version
      Python 3.6.5


      Update,



      As suggested, using the returned value of "url" seems to be a good enough workaround to continue my work. I still don't know why i don't see the same results that I would when using the CLI though... there seems to be a different logic there that automatically cycles through a channel's list, without having to run the command a second time.



      >>> with youtube_dl.YoutubeDL(ydl_opts) as ydl:
      ... object = ydl.extract_info(providedURL, download=False)
      ... print (len(object))
      ... object2 = ydl.extract_info(object['url'], download=False)
      ... print (len(object2))
      ... print (object2)
      ...
      [youtube:channel] UC6RNSPFcqY4BblL2Jg9SUtw: Downloading channel page
      7


      [download] Downloading playlist: Uploads from Patrick Best
      [youtube:playlist] playlist Uploads from Patrick Best: Downloading 4 videos
      [download] Downloading video 1 of 4
      [download] Downloading video 2 of 4
      [download] Downloading video 3 of 4
      [download] Downloading video 4 of 4
      [download] Finished downloading playlist: Uploads from Patrick Best
      11
      '_type': 'playlist', 'entries': ['_type': 'url', 'url': 'IaNEfhPmhPM', 'ie_key': 'Youtube', 'id': 'IaNEfhPmhPM', 'title': 'Rona in Aurora - the death of a big box', '_type': 'url', 'url': 'JN-2vTf8-WM', 'ie_key': 'Youtube', 'id': 'JN-2vTf8-WM', 'title': 'RealWorldNumbers - How to Test a Raspberry Pi Powered by Alkaline AA Batteries - After Poweroff', '_type': 'url', 'url': 'NmQmM36ja3o', 'ie_key': 'Youtube', 'id': 'NmQmM36ja3o', 'title': 'RealWorldNumbers - How to Test a Raspberry Pi Powered by Alkaline AA Batteries - During the Test', '_type': 'url', 'url': 'MsrgW1Rdlso', 'ie_key': 'Youtube', 'id': 'MsrgW1Rdlso', 'title': 'Raspberry Pi powered by AA batteries direct'], 'id': 'UU6RNSPFcqY4BblL2Jg9SUtw', 'title': 'Uploads from Patrick Best', 'uploader': 'Patrick Best', 'uploader_id': 'patrickscottbest', 'uploader_url': 'https://www.youtube.com/user/patrickscottbest', 'extractor': 'youtube:playlist', 'webpage_url': 'https://www.youtube.com/playlist?list=UU6RNSPFcqY4BblL2Jg9SUtw', 'webpage_url_basename': 'playlist', 'extractor_key': 'YoutubePlaylist'
      >>>









      share|improve this question
















      I am having trouble replicating the exact output of the specific --flat-playlist -j or --flat-playlist -J arguments provided to the youtube-dl cli, but using the direct python call instead.



      Maybe i can't flush out the exact options i need to present or maybe the wrong function / method altogether?



      I like this command because it is speedy and gives me only the YouTube ID's, without deep diving each and every video (As a simple benchmark, I can complete 4000 in about 30 seconds, vs. 4000 in 70 minutes via the regular info-only extraction).



      CLI version, note that the cli somehow iterates, whereas the direct call method doesn't...



      [root@tjds temp]# /usr/local/bin/youtube-dl --flat-playlist -J https://www.youtube.com/channel/UC6RNSPFcqY4BblL2Jg9SUtw 
      "extractor": "youtube:playlist", "_type": "playlist", "uploader": "Patrick Best", "entries": ["url": "IaNEfhPmhPM", "_type": "url", "ie_key": "Youtube", "id": "IaNEfhPmhPM", "title": "Rona in Aurora - the death of a big box", "url": "JN-2vTf8-WM", "_type": "url", "ie_key": "Youtube", "id": "JN-2vTf8-WM", "title": "RealWorldNumbers - How to Test a Raspberry Pi Powered by Alkaline AA Batteries - After Poweroff", "url": "NmQmM36ja3o", "_type": "url", "ie_key": "Youtube", "id": "NmQmM36ja3o", "title": "RealWorldNumbers - How to Test a Raspberry Pi Powered by Alkaline AA Batteries - During the Test", "url": "MsrgW1Rdlso", "_type": "url", "ie_key": "Youtube", "id": "MsrgW1Rdlso", "title": "Raspberry Pi powered by AA batteries direct"], "id": "UU6RNSPFcqY4BblL2Jg9SUtw", "title": "Uploads from Patrick Best", "extractor_key": "YoutubePlaylist", "uploader_id": "patrickscottbest", "uploader_url": "https://www.youtube.com/user/patrickscottbest", "webpage_url": "https://www.youtube.com/playlist?list=UU6RNSPFcqY4BblL2Jg9SUtw", "webpage_url_basename": "playlist"



      [root@tjds temp]# /usr/local/bin/youtube-dl --flat-playlist -j https://www.youtube.com/channel/UC6RNSPFcqY4BblL2Jg9SUtw
      "url": "IaNEfhPmhPM", "_type": "url", "ie_key": "Youtube", "id": "IaNEfhPmhPM", "title": "Rona in Aurora - the death of a big box"
      "url": "JN-2vTf8-WM", "_type": "url", "ie_key": "Youtube", "id": "JN-2vTf8-WM", "title": "RealWorldNumbers - How to Test a Raspberry Pi Powered by Alkaline AA Batteries - After Poweroff"
      "url": "NmQmM36ja3o", "_type": "url", "ie_key": "Youtube", "id": "NmQmM36ja3o", "title": "RealWorldNumbers - How to Test a Raspberry Pi Powered by Alkaline AA Batteries - During the Test"
      "url": "MsrgW1Rdlso", "_type": "url", "ie_key": "Youtube", "id": "MsrgW1Rdlso", "title": "Raspberry Pi powered by AA batteries direct"


      Here's what my python script is:



       import youtube_dl
      ydl_opts =
      'extract_flat': True, ## --flat-playlist according to options.py
      'dumpjson': True, ## lower -j
      #'dump_single_json': True, ## UPPER -J

      with youtube_dl.YoutubeDL(ydl_opts) as ydl:
      object = ydl.extract_info(providedURL, download=False)
      print (object)
      print len(object)


      and the result seems to only present the channel info without iterating:



      [youtube:channel] UC6RNSPFcqY4BblL2Jg9SUtw: Downloading channel page
      '_type': 'url', 'url': 'https://www.youtube.com/playlist?list=UU6RNSPFcqY4BblL2Jg9SUtw', 'ie_key': 'YoutubePlaylist', 'extractor': 'youtube:channel', 'webpage_url': 'https://www.youtube.com/channel/UC6RNSPFcqY4BblL2Jg9SUtw', 'webpage_url_basename': 'UC6RNSPFcqY4BblL2Jg9SUtw', 'extractor_key': 'YoutubeChannel'

      7


      Can anyone please steer me in the right direction or tell me what the best way is to accomplish that quick task? Is there a template component i need to address? Do I need to treat the response before it's ready for display?



      >> print (youtube_dl.version.unicode_literals)
      _Feature((2, 6, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 131072)

      python --version
      Python 3.6.5


      Update,



      As suggested, using the returned value of "url" seems to be a good enough workaround to continue my work. I still don't know why i don't see the same results that I would when using the CLI though... there seems to be a different logic there that automatically cycles through a channel's list, without having to run the command a second time.



      >>> with youtube_dl.YoutubeDL(ydl_opts) as ydl:
      ... object = ydl.extract_info(providedURL, download=False)
      ... print (len(object))
      ... object2 = ydl.extract_info(object['url'], download=False)
      ... print (len(object2))
      ... print (object2)
      ...
      [youtube:channel] UC6RNSPFcqY4BblL2Jg9SUtw: Downloading channel page
      7


      [download] Downloading playlist: Uploads from Patrick Best
      [youtube:playlist] playlist Uploads from Patrick Best: Downloading 4 videos
      [download] Downloading video 1 of 4
      [download] Downloading video 2 of 4
      [download] Downloading video 3 of 4
      [download] Downloading video 4 of 4
      [download] Finished downloading playlist: Uploads from Patrick Best
      11
      '_type': 'playlist', 'entries': ['_type': 'url', 'url': 'IaNEfhPmhPM', 'ie_key': 'Youtube', 'id': 'IaNEfhPmhPM', 'title': 'Rona in Aurora - the death of a big box', '_type': 'url', 'url': 'JN-2vTf8-WM', 'ie_key': 'Youtube', 'id': 'JN-2vTf8-WM', 'title': 'RealWorldNumbers - How to Test a Raspberry Pi Powered by Alkaline AA Batteries - After Poweroff', '_type': 'url', 'url': 'NmQmM36ja3o', 'ie_key': 'Youtube', 'id': 'NmQmM36ja3o', 'title': 'RealWorldNumbers - How to Test a Raspberry Pi Powered by Alkaline AA Batteries - During the Test', '_type': 'url', 'url': 'MsrgW1Rdlso', 'ie_key': 'Youtube', 'id': 'MsrgW1Rdlso', 'title': 'Raspberry Pi powered by AA batteries direct'], 'id': 'UU6RNSPFcqY4BblL2Jg9SUtw', 'title': 'Uploads from Patrick Best', 'uploader': 'Patrick Best', 'uploader_id': 'patrickscottbest', 'uploader_url': 'https://www.youtube.com/user/patrickscottbest', 'extractor': 'youtube:playlist', 'webpage_url': 'https://www.youtube.com/playlist?list=UU6RNSPFcqY4BblL2Jg9SUtw', 'webpage_url_basename': 'playlist', 'extractor_key': 'YoutubePlaylist'
      >>>






      python youtube-dl






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 13 '18 at 22:51







      Patrick Scott Best

















      asked Nov 13 '18 at 20:22









      Patrick Scott BestPatrick Scott Best

      11




      11






















          1 Answer
          1






          active

          oldest

          votes


















          0














          I believe if you are referring to the playlist then you should pass your URL as such:



          url = 'https://www.youtube.com/playlist?list=UU6RNSPFcqY4BblL2Jg9SUtw'


          Then you should be able to print object and iterate through each dict, something like:



          object = ydl.extract_info(url, download=False)
          for jsn in object.get('entries'):
          print jsn





          share|improve this answer























          • I see what you mean, I could use what's been extracted so far to re-formulate the request using the webpage_url dict item that was returned. I shall do so and test again. The larger question remains however, why does it work with the URL being youtube.com/channel/UC6RNSPFcqY4BblL2Jg9SUtw from the CLI, and what's the mechanism that is automatically traversing each individual video when the user (read:anyone) uses the /channel/ URL, and not the web URL. Stand by for more results... thank you

            – Patrick Scott Best
            Nov 13 '18 at 21:46











          • Well, your suggestion is a good one, and is a good workaround. My reputation score is too low to bump your answer, so if other people would, that would be helpful. Thanks LeKhan9.

            – Patrick Scott Best
            Nov 13 '18 at 22:52











          • Glad I could help. Best of luck! Hope the discussion is useful for others too.

            – LeKhan9
            Nov 13 '18 at 22:54










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53288922%2fyoutube-dl-dump-json-returning-different-extractor-output-for-playlist-when-ca%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          I believe if you are referring to the playlist then you should pass your URL as such:



          url = 'https://www.youtube.com/playlist?list=UU6RNSPFcqY4BblL2Jg9SUtw'


          Then you should be able to print object and iterate through each dict, something like:



          object = ydl.extract_info(url, download=False)
          for jsn in object.get('entries'):
          print jsn





          share|improve this answer























          • I see what you mean, I could use what's been extracted so far to re-formulate the request using the webpage_url dict item that was returned. I shall do so and test again. The larger question remains however, why does it work with the URL being youtube.com/channel/UC6RNSPFcqY4BblL2Jg9SUtw from the CLI, and what's the mechanism that is automatically traversing each individual video when the user (read:anyone) uses the /channel/ URL, and not the web URL. Stand by for more results... thank you

            – Patrick Scott Best
            Nov 13 '18 at 21:46











          • Well, your suggestion is a good one, and is a good workaround. My reputation score is too low to bump your answer, so if other people would, that would be helpful. Thanks LeKhan9.

            – Patrick Scott Best
            Nov 13 '18 at 22:52











          • Glad I could help. Best of luck! Hope the discussion is useful for others too.

            – LeKhan9
            Nov 13 '18 at 22:54















          0














          I believe if you are referring to the playlist then you should pass your URL as such:



          url = 'https://www.youtube.com/playlist?list=UU6RNSPFcqY4BblL2Jg9SUtw'


          Then you should be able to print object and iterate through each dict, something like:



          object = ydl.extract_info(url, download=False)
          for jsn in object.get('entries'):
          print jsn





          share|improve this answer























          • I see what you mean, I could use what's been extracted so far to re-formulate the request using the webpage_url dict item that was returned. I shall do so and test again. The larger question remains however, why does it work with the URL being youtube.com/channel/UC6RNSPFcqY4BblL2Jg9SUtw from the CLI, and what's the mechanism that is automatically traversing each individual video when the user (read:anyone) uses the /channel/ URL, and not the web URL. Stand by for more results... thank you

            – Patrick Scott Best
            Nov 13 '18 at 21:46











          • Well, your suggestion is a good one, and is a good workaround. My reputation score is too low to bump your answer, so if other people would, that would be helpful. Thanks LeKhan9.

            – Patrick Scott Best
            Nov 13 '18 at 22:52











          • Glad I could help. Best of luck! Hope the discussion is useful for others too.

            – LeKhan9
            Nov 13 '18 at 22:54













          0












          0








          0







          I believe if you are referring to the playlist then you should pass your URL as such:



          url = 'https://www.youtube.com/playlist?list=UU6RNSPFcqY4BblL2Jg9SUtw'


          Then you should be able to print object and iterate through each dict, something like:



          object = ydl.extract_info(url, download=False)
          for jsn in object.get('entries'):
          print jsn





          share|improve this answer













          I believe if you are referring to the playlist then you should pass your URL as such:



          url = 'https://www.youtube.com/playlist?list=UU6RNSPFcqY4BblL2Jg9SUtw'


          Then you should be able to print object and iterate through each dict, something like:



          object = ydl.extract_info(url, download=False)
          for jsn in object.get('entries'):
          print jsn






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 13 '18 at 20:43









          LeKhan9LeKhan9

          931112




          931112












          • I see what you mean, I could use what's been extracted so far to re-formulate the request using the webpage_url dict item that was returned. I shall do so and test again. The larger question remains however, why does it work with the URL being youtube.com/channel/UC6RNSPFcqY4BblL2Jg9SUtw from the CLI, and what's the mechanism that is automatically traversing each individual video when the user (read:anyone) uses the /channel/ URL, and not the web URL. Stand by for more results... thank you

            – Patrick Scott Best
            Nov 13 '18 at 21:46











          • Well, your suggestion is a good one, and is a good workaround. My reputation score is too low to bump your answer, so if other people would, that would be helpful. Thanks LeKhan9.

            – Patrick Scott Best
            Nov 13 '18 at 22:52











          • Glad I could help. Best of luck! Hope the discussion is useful for others too.

            – LeKhan9
            Nov 13 '18 at 22:54

















          • I see what you mean, I could use what's been extracted so far to re-formulate the request using the webpage_url dict item that was returned. I shall do so and test again. The larger question remains however, why does it work with the URL being youtube.com/channel/UC6RNSPFcqY4BblL2Jg9SUtw from the CLI, and what's the mechanism that is automatically traversing each individual video when the user (read:anyone) uses the /channel/ URL, and not the web URL. Stand by for more results... thank you

            – Patrick Scott Best
            Nov 13 '18 at 21:46











          • Well, your suggestion is a good one, and is a good workaround. My reputation score is too low to bump your answer, so if other people would, that would be helpful. Thanks LeKhan9.

            – Patrick Scott Best
            Nov 13 '18 at 22:52











          • Glad I could help. Best of luck! Hope the discussion is useful for others too.

            – LeKhan9
            Nov 13 '18 at 22:54
















          I see what you mean, I could use what's been extracted so far to re-formulate the request using the webpage_url dict item that was returned. I shall do so and test again. The larger question remains however, why does it work with the URL being youtube.com/channel/UC6RNSPFcqY4BblL2Jg9SUtw from the CLI, and what's the mechanism that is automatically traversing each individual video when the user (read:anyone) uses the /channel/ URL, and not the web URL. Stand by for more results... thank you

          – Patrick Scott Best
          Nov 13 '18 at 21:46





          I see what you mean, I could use what's been extracted so far to re-formulate the request using the webpage_url dict item that was returned. I shall do so and test again. The larger question remains however, why does it work with the URL being youtube.com/channel/UC6RNSPFcqY4BblL2Jg9SUtw from the CLI, and what's the mechanism that is automatically traversing each individual video when the user (read:anyone) uses the /channel/ URL, and not the web URL. Stand by for more results... thank you

          – Patrick Scott Best
          Nov 13 '18 at 21:46













          Well, your suggestion is a good one, and is a good workaround. My reputation score is too low to bump your answer, so if other people would, that would be helpful. Thanks LeKhan9.

          – Patrick Scott Best
          Nov 13 '18 at 22:52





          Well, your suggestion is a good one, and is a good workaround. My reputation score is too low to bump your answer, so if other people would, that would be helpful. Thanks LeKhan9.

          – Patrick Scott Best
          Nov 13 '18 at 22:52













          Glad I could help. Best of luck! Hope the discussion is useful for others too.

          – LeKhan9
          Nov 13 '18 at 22:54





          Glad I could help. Best of luck! Hope the discussion is useful for others too.

          – LeKhan9
          Nov 13 '18 at 22:54

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53288922%2fyoutube-dl-dump-json-returning-different-extractor-output-for-playlist-when-ca%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          How to read a connectionString WITH PROVIDER in .NET Core?

          In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

          Museum of Modern and Contemporary Art of Trento and Rovereto