Exemple #1
0
 def __init__(self, url):
     self.url = url
     self.id = self._get_vimeo_id(url)
     try:
         self.shortmem = vimeo.get_shortmem(url)
     except VidscraperError, e:
         raise VideoTypeError(e[0])
Exemple #2
0
 def __init__(self, url):
     self.url = self._resolve_url_redirects(url)
     self.id = self._get_brightcove_id(self.url)
     try:
         self.shortmem = {}
     except VidscraperError, e:
         raise VideoTypeError(e[0])
Exemple #3
0
 def _get_entry(self, video_id):
     Meter('youtube.api_request').inc()
     try:
         return yt_service.GetYouTubeVideoEntry(video_id=str(video_id))
     except RequestError, e:
         err = e[0].get('body', 'Undefined error')
         raise VideoTypeError('Youtube error: %s' % err)
Exemple #4
0
 def get_metadata(cls, video_id):
     #FIXME: get_metadata is called twice: in matches_video_url and set_values
     conn = httplib.HTTPConnection("www.dailymotion.com")
     conn.request("GET", "/json/video/" + video_id)
     try:
         response = conn.getresponse()
         body = response.read()
         try:
             return json.loads(body)
         except json.JSONDecodeError:
             raise VideoTypeError(_(u'Video is unavailable'))
     except httplib.BadStatusLine:
         return {}