1 Using the ``youtube_dl`` module
2 ===============================
4 When using the ``youtube_dl`` module, you start by creating an instance of :class:`YoutubeDL` and adding all the available extractors:
8 >>> from youtube_dl import YoutubeDL
10 >>> ydl.add_default_info_extractors()
12 Extracting video information
13 ----------------------------
15 You use the :meth:`YoutubeDL.extract_info` method for getting the video information, which returns a dictionary:
17 .. code-block:: python
19 >>> info = ydl.extract_info('http://www.youtube.com/watch?v=BaW_jenozKc', download=False)
20 [youtube] Setting language
21 [youtube] BaW_jenozKc: Downloading webpage
22 [youtube] BaW_jenozKc: Downloading video info webpage
23 [youtube] BaW_jenozKc: Extracting video information
25 'youtube-dl test video "\'/\\ä↭𝕐'
26 >>> info['height'], info['width']
29 If you want to download or play the video you can get its url:
31 .. code-block:: python
36 Extracting playlist information
37 -------------------------------
39 The playlist information is extracted in a similar way, but the dictionary is a bit different:
41 .. code-block:: python
43 >>> playlist = ydl.extract_info('http://www.ted.com/playlists/13/open_source_open_world', download=False)
44 [TED] open_source_open_world: Downloading playlist webpage
47 'Open-source, open world'
51 You can access the videos in the playlist with the ``entries`` field:
53 .. code-block:: python
55 >>> for video in playlist['entries']:
56 ... print('Video #%d: %s' % (video['playlist_index'], video['title']))
58 Video #1: How Arduino is open-sourcing imagination
59 Video #2: The year open data went worldwide
60 Video #3: Massive-scale online collaboration
61 Video #4: The art of asking
62 Video #5: How cognitive surplus will change the world
63 Video #6: The birth of Wikipedia
64 Video #7: Coding a better government
65 Video #8: The era of open innovation
66 Video #9: The currency of the new economy is trust