def getDailymotionInfo(self,ID): url = 'http://www.dailymotion.com/video/%s' % ID html = urllib2.urlopen(urllib2.Request(url,None,{'User-Agent':'Wget/1.9.1'})).read() ret = {} try: title,ret['thumbnail'] = re.search('<meta property="og:title" content="([^"].+?)".*<meta property="og:image" content="([^"].+?)(?is)"',html).groups() ret['title'] = convertHTMLCodes(title) except: pass return ret
def getDailymotionInfo(self, ID): url = 'http://www.dailymotion.com/video/%s' % ID html = urllib2.urlopen( urllib2.Request(url, None, {'User-Agent': 'Wget/1.9.1'})).read() ret = {} try: title, ret['thumbnail'] = re.search( '<meta property="og:title" content="([^"].+?)".*<meta property="og:image" content="([^"].+?)(?is)"', html).groups() ret['title'] = convertHTMLCodes(title) except: pass return ret
def getVimeoInfo(self,ID): infoURL = 'http://vimeo.com/api/v2/video/%s.xml' % ID try: xml = urllib2.urlopen(urllib2.Request(infoURL,None,{'User-Agent':'Wget/1.9.1'})).read() except: ERROR('Could not get Vimeo info for ID: %s' % ID) return None ret = {} try: ret['title'] = convertHTMLCodes(re.search('<title>([^<]*)</title>',xml).group(1)) except: pass try: ret['thumbnail'] = re.search('<thumbnail_large>([^<]*)</thumbnail_large>',xml).group(1) except: pass return ret
def getVimeoInfo(self, ID): infoURL = 'http://vimeo.com/api/v2/video/%s.xml' % ID try: xml = urllib2.urlopen( urllib2.Request(infoURL, None, {'User-Agent': 'Wget/1.9.1'})).read() except: ERROR('Could not get Vimeo info for ID: %s' % ID) return None ret = {} try: ret['title'] = convertHTMLCodes( re.search('<title>([^<]*)</title>', xml).group(1)) except: pass try: ret['thumbnail'] = re.search( '<thumbnail_large>([^<]*)</thumbnail_large>', xml).group(1) except: pass return ret