rg3/youtube-dl — Issue #296: Add the option to return only the info_dict
Author: cochiseruhulessin
Created: 2012-02-27 22:58:21+00:00
State: open

When _real_extract() is called, it immediately sends the parsed info to it's FileDownloader.

To expand the usability of youtube_dl, it would be great if the caller could only retrieve the parsed video info and do whatever he pleases with it.

A quick look at the code shows that this could be done by adding a, for example, "data_only" argument to InfoExtractor.extract(),
which is a bool indicating if we should download, or only parse the info. This is then passed to _real_extract().

See this example for __init__.py, line 1450-1467. It assumes _real_extract() got the "data only" argument.

```
try:
# Process video information
data = {
'id':	video_id.decode('utf-8'),
'url':	video_real_url.decode('utf-8'),
'uploader':	video_uploader.decode('utf-8'),
'upload_date':	upload_date,
'title':	video_title,
'stitle':	simple_title,
'ext':	video_extension.decode('utf-8'),
'format':	(format_param is None and u'NA' or format_param.decode('utf-8')),
'thumbnail':	video_thumbnail.decode('utf-8'),
'description':	video_description,
'player_url':	player_url,
}
if data_only:
return data
self._downloader.process_info(data)
except UnavailableVideoError, err:
self._downloader.trouble(u'\nERROR: unable to download video')
```