Exemplo n.º 1
0
 def __get_video_streams_info(self):
     # prepare to get the streams info of the video
     infoUrl = self.GET_VIDEO_BASE_URL + self.__videoId
     resp = urllib2.urlopen(infoUrl)
     content = resp.read()
     # also, prepare to get the video title
     streams = ""
     for item in content.split('&'):
         if item.find(self.GET_VIDEO_TITLE_PARAM) == 0:
             if self.__videoTitle == '':
                 self.__videoTitle = String.url_decode(item.split('=')[1])
                 self.__videoTitle = self.__videoTitle.replace('+', ' ')
                 self.__videoTitle = self.__videoTitle.replace('/', ' ')
         elif item.find(self.GET_VIDEO_STREAM_PARAM) == 0:
             streams = item.strip()
             if self.__videoTitle != '':
                 break;
     streams = map(lambda stream: String.url_decode("type"+stream), streams.split("type"))[1:]
     return streams
Exemplo n.º 2
0
 def __get_video_streams_info(self):
     # prepare to get the streams info of the video
     infoUrl = self.GET_VIDEO_BASE_URL + self.__videoId
     resp = urllib2.urlopen(infoUrl)
     content = resp.read()
     # also, prepare to get the video title
     streams = ""
     for item in content.split('&'):
         if item.find(self.GET_VIDEO_TITLE_PARAM) == 0:
             if self.__videoTitle == '':
                 self.__videoTitle = String.url_decode(item.split('=')[1])
                 self.__videoTitle = self.__videoTitle.replace('+', ' ')
                 self.__videoTitle = self.__videoTitle.replace('/', ' ')
         elif item.find(self.GET_VIDEO_STREAM_PARAM) == 0:
             streams = item.strip()
             if self.__videoTitle != '':
                 break
     streams = map(lambda stream: String.url_decode("type" + stream),
                   streams.split("type"))[1:]
     return streams