Merge branch 'vidme_mime_parser' of https://github.com/woorst/rtv
This commit is contained in:
@@ -204,9 +204,27 @@ class StreamableMIMEParser(OpenGraphMIMEParser):
|
||||
pattern = re.compile(r'https?://(www\.)?streamable\.com/[^.]+$')
|
||||
|
||||
|
||||
class VidmeMIMEParser(BaseMIMEParser):
|
||||
"""
|
||||
Vidme provides a json api.
|
||||
|
||||
https://doc.vid.me
|
||||
"""
|
||||
pattern = re.compile(r'https?://(www\.)?vid\.me/[^.]+$')
|
||||
|
||||
@staticmethod
|
||||
def get_mimetype(url):
|
||||
resp = requests.get('https://api.vid.me/videoByUrl?url=' + url)
|
||||
if resp.status_code == 200 and resp.json()['status']:
|
||||
return resp.json()['video']['complete_url'], 'video/mp4'
|
||||
else:
|
||||
return url, None
|
||||
|
||||
|
||||
# Parsers should be listed in the order they will be checked
|
||||
parsers = [
|
||||
StreamableMIMEParser,
|
||||
VidmeMIMEParser,
|
||||
InstagramMIMEParser,
|
||||
GfycatMIMEParser,
|
||||
ImgurAlbumMIMEParser,
|
||||
|
||||
@@ -65,6 +65,10 @@ URLS = OrderedDict([
|
||||
'https://streamable.com/vkc0y',
|
||||
re.compile('https://(.*)\.streamablevideo\.com/video/mp4/(.*)\.mp4?(.*)'),
|
||||
'video/mp4')),
|
||||
('vidme_video', (
|
||||
'https://vid.me/rHlb',
|
||||
'https://d1wst0behutosd.cloudfront.net/videos/15694926/52450725.mp4?Expires=1496269971&Signature=W4l-nipmi3tqEwUNAA~4MpkaT3tfKm6~EFmZ-TnzdUCo~9N96BhCfIiHqv1DAU657VEnBIQp7OgfhmD3~SuwfkZuoTJWJTOgsyVI86X-rwJa9-7Y8qXgSVwCwscLqdkKfw4uiuL2K6GTl5aEStqGcASn5E9p-6Y-6xSsGHbluX17ByIWX0RCRBa4uKKPj32~9kGLSx415U-sA5h9F~tFVPwgzs4NSQPrukO~j1HhBR6rvfaO8AsBARoH875hTuPTGScmdUFlAompAHqKgWV9ngHx4cINbO2m5CN38tx2UfjD8qm6Tq6SSb-WjMKdJ1DUmgwbCFGtpqWPDSPLkX6Kew__&Key-Pair-Id=APKAJJ6WELAPEP47UKWQ',
|
||||
'video/mp4'))
|
||||
])
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user