def _parse(self, url, id, **kwargs): """Return metadata for the given URL that matches :attr:`url_pattern`. :type url: unicode :param url: A remote URL string. :param \*\*kwargs: The named matches from the url match object. :rtype: dict :returns: Any extracted metadata. """ if '?' in url: url += '&skin=api' else: url += '?skin=api' req = Request(url) try: temp_data = urlopen(req) xmlstring = temp_data.read() try: try: xmltree = ElementTree.fromstring(xmlstring) except: temp_data.close() raise except SyntaxError: raise UserStorageError( _('Invalid BlipTV URL. This video does not exist.')) except URLError, e: log.exception(e) raise
def _parse(self, url, **kwargs): """Return metadata for the given URL that matches :attr:`url_pattern`. :type url: unicode :param url: A remote URL string. :param \*\*kwargs: The named matches from the url match object. :rtype: dict :returns: Any extracted metadata. """ id = kwargs['id'] req = Request('http://blip.tv/file/%s?skin=api' % id) try: temp_data = urlopen(req) xmlstring = temp_data.read() try: xmltree = ElementTree.fromstring(xmlstring) finally: temp_data.close() except URLError, e: log.exception(e) raise