rg3/youtube-dl — pull request #2951 by disfasia (2014-05-19 07:17:53+00:00)
Title: [youtube_dl] Added cancelable metadata / playlist downlod progress hook

I added cancelable hooks to playlist metadata downloads.

Here an example showing how to skip downloads after the 3rd entry of a playlist:

```python
import youtube_dl

url = 'http://www.youtube.com/watch?v=QonQ_8qnAbY&list=PLC3CC1956BA739976&index=8'

ydl = youtube_dl.YoutubeDL({
'ignoreerrors': True,
'quiet': True,
'socket_timeout': 10
})

ydl.add_default_info_extractors()

# dummy hook
def hook(status):
if status['current'] > 3:
print "Skipping..."
return False # returning False from any of the added hooks makes the next request skipped
else:
print(status)

# Adding the hook
ydl.add_metadata_hook(hook)

result = ydl.extract_info(url, download = False)
```