def resolve(self, item, captcha_cb=None, select_cb=None): #util.debug("[SC] ITEM RESOLVE: " + str(item)) #util.debug("[SC] RESOLVE argv: [%s] " % str(sys.argv)) sctop.win.setProperty('sc.resume', 'true') addparams = sys.argv[3] if 3 in sys.argv else None if addparams is not None and re.search('resume:false', sys.argv.get(3)): sctop.win.setProperty('sc.resume', 'false') if 'https://' not in item['url'] and 'http://' not in item['url']: item['url'] = self._url(item['url']) if sctop.BASE_URL in item['url']: try: data = self._json(item['url']) except: raise ResolveException('Video is not available.') if data is None or data is False: raise ResolveException('Video is not available.') if 'strms' in data: util.debug("[SC] data info: %s" % str(data['info'])) out = [ sctop.merge_dicts(data['info'], i) for i in data['strms'] ] data = out #util.debug("[SC] data: %s" % str(data)) if len(data) < 1: raise ResolveException('Video is not available.') return self._resolve(select_cb(data)) else: return self._resolve(item)
def resolve(self, item, captcha_cb=None, select_cb=None): #util.debug("ITEM RESOLVE: " + str(item)) item['url'] = self._url(item['url']) if sctop.BASE_URL in item['url']: try: data = self._json(item['url']) #json.loads(self.get_data_cached(item['url'])) except: raise ResolveException('Video is not available.') if data is None or data is False: raise ResolveException('Video is not available.') if 'strms' in data: util.debug("[SC] data info: %s" % str(data['info'])) out = [sctop.merge_dicts(data['info'], i) for i in data['strms']] data = out #util.debug("[SC] data: %s" % str(data)) if len(data) < 1: raise ResolveException('Video is not available.') return self._resolve(select_cb(data)) else: return self._resolve(item)