From b3e08a36e9d0dc679c8fb2499be9d45dc2b99fa6 Mon Sep 17 00:00:00 2001 From: Barna Zsombor Date: Thu, 19 Sep 2019 22:21:40 +0200 Subject: [PATCH] [dlive] Add useful error message --- youtube_dl/extractor/dlive.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/dlive.py b/youtube_dl/extractor/dlive.py index d95c67a5b..02a11e664 100644 --- a/youtube_dl/extractor/dlive.py +++ b/youtube_dl/extractor/dlive.py @@ -4,7 +4,10 @@ import json import re from .common import InfoExtractor -from ..utils import int_or_none +from ..utils import ( + int_or_none, + ExtractorError, +) class DLiveVODIE(InfoExtractor): @@ -76,7 +79,14 @@ class DLiveStreamIE(InfoExtractor): username } }''' % display_name}).encode())['data']['userByDisplayName'] + livestream = user['livestream'] + + if(livestream is None): + raise ExtractorError( + "The requested stream is offline!", + expected=True) + title = livestream['title'] username = user['username'] formats = self._extract_m3u8_formats(