def streamGetter(embedCode): ## Decrypts the embed code and returns a stream path retlist = [] smil = CommonUtils().grabEncrypted(embedCode) decrypted_smil = ooyalaCrypto().ooyalaDecrypt(smil) videoList = MagicNaming().getVideoUrl(decrypted_smil) retlist.extend(videoList) videoArray = "".join(videoList) ## Pulls the playpath from the stream path Segments = videoArray.rsplit("/", 2) playpath = "mp4:s/" + Segments[1] + "/" + Segments[2] ## Returns the title, description, thumbnail url and playpath return playpath
def streamGetter(embedCode): ## Decrypts the embed code and returns a stream path retlist = [] smil = CommonUtils().grabEncrypted(embedCode) decrypted_smil = ooyalaCrypto().ooyalaDecrypt(smil) videoList = MagicNaming().getVideoUrl(decrypted_smil) retlist.extend(videoList) videoArray = ''.join(videoList) ## Pulls the playpath from the stream path Segments = videoArray.rsplit('/', 2) playpath = 'mp4:s/' + Segments[1] + '/' + Segments[2] ## Returns the title, description, thumbnail url and playpath return playpath
def streamGetter(url): ## Open the PostTV video URL response = urllib2.urlopen(url) page_source = response.read() ## Pull some metadata from the video page source soup = BeautifulSoup(page_source) for titles in soup.findAll("meta", attrs={"property":"og:title"}): title = titles.get("content") for descs in soup.findAll("meta", attrs={"property":"og:description"}): description = descs.get("content") for images in soup.findAll("meta", attrs={"property":"og:image"}): image = images.get("content") ## Look for the Ooyala player string m = re.search('"((http)?://player.ooyala.com/player_v2.swf(?!.*adSetCode).*?)"', page_source) url = m.group() ## strip off some extra quotes cleanURL = url.replace("\"","") ## Grabs the embed code from the cleaned URL ec = re.search('((?<=embedCode=)(.*)(?=&autoplay))', cleanURL) embedCode = ec.group() ## Decrypts the embed code and returns a stream path smil = CommonUtils().grabEncrypted(embedCode) decrypted_smil = ooyalaCrypto().ooyalaDecrypt(smil) videoList = MagicNaming().getVideoUrl(decrypted_smil) videoArray = ''.join(videoList) ## Pulls the playpath from the stream path Segments = videoArray.rsplit('/',2) playpath = 'mp4:s/' + Segments[1]+ '/' +Segments[2] ## Returns the title, description, thumbnail url and playpath return (title, description, image, playpath)