2013-03-10 14:18:39 +01:00
|
|
|
# ex:ts=4:sw=4:sts=4:et
|
|
|
|
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
|
|
|
|
from __future__ import absolute_import
|
|
|
|
import json
|
2013-11-14 22:56:32 +01:00
|
|
|
import re
|
2014-06-07 20:43:40 +02:00
|
|
|
import copy
|
2013-11-12 20:46:08 +01:00
|
|
|
|
2014-01-26 01:52:11 +01:00
|
|
|
from svtplay_dl.service import Service, OpenGraphThumbMixin
|
2014-12-08 23:07:02 +01:00
|
|
|
from svtplay_dl.utils import get_http_data
|
2014-04-21 17:09:03 +02:00
|
|
|
from svtplay_dl.fetcher.http import HTTP
|
2013-03-17 19:55:19 +01:00
|
|
|
from svtplay_dl.log import log
|
2013-03-10 14:18:39 +01:00
|
|
|
|
2014-01-26 01:52:11 +01:00
|
|
|
class Vimeo(Service, OpenGraphThumbMixin):
|
2014-01-01 14:57:17 +01:00
|
|
|
supported_domains = ['vimeo.com']
|
2013-03-10 14:18:39 +01:00
|
|
|
|
2014-01-06 23:14:06 +01:00
|
|
|
def get(self, options):
|
2014-12-08 23:07:02 +01:00
|
|
|
error, data = self.get_urldata()
|
|
|
|
if error:
|
2014-11-26 16:01:54 +01:00
|
|
|
log.error("Can't get the page")
|
2014-12-08 23:07:02 +01:00
|
|
|
return
|
2014-12-22 17:41:40 +01:00
|
|
|
|
|
|
|
if self.exclude(options):
|
|
|
|
return
|
|
|
|
|
2014-12-08 23:07:02 +01:00
|
|
|
match = re.search('data-config-url="([^"]+)" data-fallback-url', data)
|
2013-11-14 22:56:32 +01:00
|
|
|
if not match:
|
2014-10-06 23:21:43 +02:00
|
|
|
log.error("Can't find video file for: %s", self.url)
|
|
|
|
return
|
2013-11-14 22:56:32 +01:00
|
|
|
player_url = match.group(1).replace("&", "&")
|
2014-12-08 23:07:02 +01:00
|
|
|
error, player_data = get_http_data(player_url)
|
2013-03-10 14:18:39 +01:00
|
|
|
|
2013-11-12 20:46:08 +01:00
|
|
|
if player_data:
|
|
|
|
jsondata = json.loads(player_data)
|
|
|
|
avail_quality = jsondata["request"]["files"]["h264"]
|
2014-04-21 17:09:03 +02:00
|
|
|
for i in avail_quality.keys():
|
2014-06-07 20:43:40 +02:00
|
|
|
yield HTTP(copy.copy(options), avail_quality[i]["url"], avail_quality[i]["bitrate"])
|
2013-03-10 14:18:39 +01:00
|
|
|
else:
|
|
|
|
log.error("Can't find any streams.")
|
2015-04-28 23:19:35 +02:00
|
|
|
return
|