mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-11 17:45:26 -05:00
[ViewSource] Add extractor to handle view-source:
This commit is contained in:
parent
5d39972ed0
commit
54df8fc5b2
2 changed files with 16 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..compat import (
|
from ..compat import (
|
||||||
compat_urlparse,
|
compat_urlparse,
|
||||||
|
@ -58,3 +60,16 @@ def _real_extract(self, url):
|
||||||
'title': title,
|
'title': title,
|
||||||
'url': url,
|
'url': url,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class ViewSourceIE(InfoExtractor):
|
||||||
|
IE_DESC = False
|
||||||
|
_VALID_URL = r'view-source:(?P<url>.+)'
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
'url': 'view-source:https://www.youtube.com/watch?v=BaW_jenozKc',
|
||||||
|
'only_matching': True
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
return self.url_result(re.match(self._VALID_URL, url).group('url'))
|
||||||
|
|
|
@ -264,6 +264,7 @@
|
||||||
from .commonprotocols import (
|
from .commonprotocols import (
|
||||||
MmsIE,
|
MmsIE,
|
||||||
RtmpIE,
|
RtmpIE,
|
||||||
|
ViewSourceIE,
|
||||||
)
|
)
|
||||||
from .condenast import CondeNastIE
|
from .condenast import CondeNastIE
|
||||||
from .contv import CONtvIE
|
from .contv import CONtvIE
|
||||||
|
|
Loading…
Reference in a new issue