def getSource(self, url, form_data, referer, xml=False, mobile=False): url = self.fixurl(url) if not referer: referer = url else: referer = self.fixurl( referer.replace('wizhdsports.be', 'wizhdsports.is').replace( 'ibrod.tv', 'www.ibrod.tv').replace('livetv123.net', 'livetv.sx')) headers = {'Referer': referer} if mobile: self.s.headers.update({ 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13E238 Safari/601.1' }) if xml: headers['X-Requested-With'] = 'XMLHttpRequest' if 'cndhlsstream.pw' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'skstream.tv' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'bstream.tech' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'bcast.site' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'bcast.pw' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'live247.online' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'indexstream.tv' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'streamlive.to' in urlparse.urlsplit(url).netloc: self.s.verify = False if form_data: #zo**tv if 'uagent' in form_data[0]: form_data[0] = ('uagent', self.s.headers['User-Agent']) r = self.s.post(url, headers=headers, data=form_data, timeout=20) else: try: r = self.s.get(url, headers=headers, timeout=20) except (requests.exceptions.MissingSchema): return 'pass' #many utf8 encodings are specified in HTTP body not headers and requests only checks headers, maybe use html5lib #https://github.com/kennethreitz/requests/issues/2086 if 'streamlive.to' in urlparse.urlsplit(url).netloc \ or 'sport365.live' in urlparse.urlsplit(url).netloc \ or 'vipleague' in urlparse.urlsplit(url).netloc \ or 'cinestrenostv.tv' in urlparse.urlsplit(url).netloc \ or 'batmanstream.com' in urlparse.urlsplit(url).netloc \ or 'sportcategory.com' in urlparse.urlsplit(url).netloc: r.encoding = 'utf-8' if 'lfootball.ws' in urlparse.urlsplit(url).netloc: r.encoding = 'windows-1251' response = r.text if 'beget=begetok' in response: # av _cookie = requests.cookies.create_cookie( 'beget', 'begetok', domain=urlparse.urlsplit(url).netloc, path='/') self.s.cookies.set_cookie(_cookie) r = self.s.get(url, headers=headers, timeout=20) response = r.text if 'fromCharCode,sucuri_cloudproxy_js' in response: # sebn from sucuri import sucuri_decode sucuri_name, sucuri_value = sucuri_decode(response) sucuri_cookie = requests.cookies.create_cookie( sucuri_name, sucuri_value, domain=urlparse.urlsplit(url).netloc, path='/', discard=False, expires=(time.time() + 86400)) self.s.cookies.set_cookie(sucuri_cookie) r = self.s.get(url, headers=headers, timeout=20) response = r.text if len(response) > 10: self.s.cookies.save(ignore_discard=True) self.s.close() return HTMLParser().unescape(response)
def getSource(self, url, form_data, referer, xml=False, mobile=False): url = self.fixurl(url) if not referer: referer = url else: referer = self.fixurl( referer.replace('wizhdsports.be', 'wizhdsports.is').replace( 'ibrod.tv', 'www.ibrod.tv').replace('livetv123.net', 'livetv.sx')) headers = {'Referer': referer} if mobile: self.s.headers.update({ 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.75 Mobile/14E5239e Safari/602.1' }) if xml: headers['X-Requested-With'] = 'XMLHttpRequest' if 'cndhlsstream.pw' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'skstream.tv' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'bstream.tech' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'bcast.site' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'bcast.pw' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'live247.online' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'indexstream.tv' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'streamlive.to' in urlparse.urlsplit(url).netloc: self.s.verify = False if 'vipleague' in url or 'strikeout' in url or 'homerun' or 'nbastreams' in url: self.s.verify = False if 'firstonetv' in url or 'bypassed' in url or 'livecamtv' in url: self.s.verify = False #if 'strikeout' in urlparse.urlsplit(url).netloc: #self.s.headers.update({'Upgrade-Insecure-Requests': '1'}) #self.s.headers.update({'Host': 'zoomtv.me'}) # self.s.headers.update({'Accept' : 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'}) # self.s.headers.update({'Accept-Language' : 'en-US,en;q=0.8,de;q=0.6,es;q=0.4'}) #self.s.headers.update({'Accept-Encoding': 'gzip, deflate'}) #self.s.headers.update({'Connection' : 'keep-alive'}) # self.s.headers.update({'Origin': 'http://www.strikeout.co'}) # self.s.headers.update({'Content-Type': 'application/x-www-form-urlencoded'}) if form_data: #zo**tv #if 'uagent' in form_data[0]: #form_data[0] = ('uagent',urllib.quote(self.s.headers['User-Agent'])) #if len(form_data) > 4 and 'Cookie' in form_data[4]: #headers['Cookie'] = form_data[4][1] #del form_data[4] #headers['Content-Type'] = 'application/x-www-form-urlencoded' #headers['User-Agent'] = self.s.headers['User-Agent'] #lib.common.log("JairoX10:" + form_data[0][1]) r = self.s.post(url, headers=headers, data=form_data, timeout=20) else: try: r = self.s.get(url, headers=headers, timeout=20) except (requests.exceptions.MissingSchema): return 'pass' #many utf8 encodings are specified in HTTP body not headers and requests only checks headers, maybe use html5lib #https://github.com/kennethreitz/requests/issues/2086 if 'streamlive.to' in urlparse.urlsplit(url).netloc \ or 'sport365.live' in urlparse.urlsplit(url).netloc \ or 'vipleague' in urlparse.urlsplit(url).netloc \ or 'cinestrenostv.tv' in urlparse.urlsplit(url).netloc \ or 'batmanstream.com' in urlparse.urlsplit(url).netloc \ or 'sportcategory.com' in urlparse.urlsplit(url).netloc: r.encoding = 'utf-8' if 'lfootball.ws' in urlparse.urlsplit(url).netloc: r.encoding = 'windows-1251' response = r.text if 'beget=begetok' in response: # av _cookie = requests.cookies.create_cookie( 'beget', 'begetok', domain=urlparse.urlsplit(url).netloc, path='/') self.s.cookies.set_cookie(_cookie) r = self.s.get(url, headers=headers, timeout=20) response = r.text if 'fromCharCode,sucuri_cloudproxy_js' in response: # sebn from sucuri import sucuri_decode sucuri_name, sucuri_value = sucuri_decode(response) sucuri_cookie = requests.cookies.create_cookie( sucuri_name, sucuri_value, domain=urlparse.urlsplit(url).netloc, path='/', discard=False, expires=(time.time() + 86400)) self.s.cookies.set_cookie(sucuri_cookie) r = self.s.get(url, headers=headers, timeout=20) response = r.text if len(response) > 10: self.s.cookies.save(ignore_discard=True) self.s.close() return HTMLParser().unescape(response)
def getSource(self, url, form_data, referer, xml=False, mobile=False): url = self.fixurl(url) if not referer: referer = url else: referer = self.fixurl(referer.replace('wizhdsports.be','wizhdsports.is').replace('ibrod.tv','www.ibrod.tv').replace('livetv123.net','livetv.sx')) headers = {'Referer': referer} if mobile: self.s.headers.update({'User-Agent' : 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13E238 Safari/601.1'}) if xml: headers['X-Requested-With'] = 'XMLHttpRequest' if 'cndhlsstream.pw' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'skstream.tv' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'bstream.tech' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'bcast.site' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'bcast.pw' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'live247.online' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'indexstream.tv' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'streamlive.to' in urlparse.urlsplit(url).netloc: self.s.verify = False if form_data: #zo**tv if 'uagent' in form_data[0]: form_data[0] = ('uagent',self.s.headers['User-Agent']) r = self.s.post(url, headers=headers, data=form_data, timeout=20) else: try: r = self.s.get(url, headers=headers, timeout=20) except (requests.exceptions.MissingSchema): return 'pass' #many utf8 encodings are specified in HTTP body not headers and requests only checks headers, maybe use html5lib #https://github.com/kennethreitz/requests/issues/2086 if 'streamlive.to' in urlparse.urlsplit(url).netloc \ or 'sport365.live' in urlparse.urlsplit(url).netloc \ or 'vipleague' in urlparse.urlsplit(url).netloc \ or 'cinestrenostv.tv' in urlparse.urlsplit(url).netloc \ or 'batmanstream.com' in urlparse.urlsplit(url).netloc \ or 'sportcategory.com' in urlparse.urlsplit(url).netloc: r.encoding = 'utf-8' if 'lfootball.ws' in urlparse.urlsplit(url).netloc: r.encoding = 'windows-1251' response = r.text if 'beget=begetok' in response: # av _cookie = requests.cookies.create_cookie('beget','begetok',domain=urlparse.urlsplit(url).netloc,path='/') self.s.cookies.set_cookie(_cookie) r = self.s.get(url, headers=headers, timeout=20) response = r.text if 'fromCharCode,sucuri_cloudproxy_js' in response: # sebn from sucuri import sucuri_decode sucuri_name, sucuri_value = sucuri_decode(response) sucuri_cookie = requests.cookies.create_cookie(sucuri_name,sucuri_value,domain=urlparse.urlsplit(url).netloc,path='/', discard=False,expires=(time.time() + 86400)) self.s.cookies.set_cookie(sucuri_cookie) r = self.s.get(url, headers=headers, timeout=20) response = r.text if len(response) > 10: self.s.cookies.save(ignore_discard=True) self.s.close() return HTMLParser().unescape(response)
def getSource(self, url, form_data, referer, xml=False, mobile=False): url = self.fixurl(url) if not referer: referer = url else: referer = self.fixurl( referer.replace('wizhdsports.be', 'wizhdsports.is').replace( 'ibrod.tv', 'www.ibrod.tv').replace('livetv123.net', 'livetv.sx')) headers = {'Referer': referer} if 'liveonlinetv247' in urlparse.urlsplit(url).netloc: mobile = True if mobile: self.s.headers.update({ 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.75 Mobile/14E5239e Safari/602.1' }) if xml: headers['X-Requested-With'] = 'XMLHttpRequest' if 'cndhlsstream.pw' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'skstream.tv' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'bstream.tech' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'bcast.site' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'bcast.pw' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'live247.online' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'indexstream.tv' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'streamlive.to' in urlparse.urlsplit(url).netloc: self.s.verify = False if 'vipleague' in url or 'strikeout' in url or 'homerun' or 'nbastream' in url: self.s.verify = False if 'bypassed' in url or 'livecamtv.me' in url or 'seelive.me' in url: self.s.verify = False if 'firstonetv' in url: self.s.verify = False if 'vaughnlive.tv' in url: self.s.verify = False if 'ustreamix' in url: self.s.verify = False if 'vergol' in url or 'vercanales' in url: self.s.verify = False if 'telerium' in url or 'cdn4.us' in url: self.s.verify = False if 'auth.livecamtv' in url: self.s.headers['Origin'] = 'https://www.seelive.me' #if 'strikeout' in urlparse.urlsplit(url).netloc: #self.s.headers.update({'Upgrade-Insecure-Requests': '1'}) #self.s.headers.update({'Host': 'zoomtv.me'}) # self.s.headers.update({'Accept' : 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'}) # self.s.headers.update({'Accept-Language' : 'en-US,en;q=0.8,de;q=0.6,es;q=0.4'}) #self.s.headers.update({'Accept-Encoding': 'gzip, deflate'}) #self.s.headers.update({'Connection' : 'keep-alive'}) # self.s.headers.update({'Origin': 'http://www.strikeout.co'}) # self.s.headers.update({'Content-Type': 'application/x-www-form-urlencoded'}) if form_data: #zo**tv #if 'uagent' in form_data[0]: #form_data[0] = ('uagent',urllib.quote(self.s.headers['User-Agent'])) #if len(form_data) > 4 and 'Cookie' in form_data[4]: #headers['Cookie'] = form_data[4][1] #del form_data[4] #headers['Content-Type'] = 'application/x-www-form-urlencoded' #headers['User-Agent'] = self.s.headers['User-Agent'] #lib.common.log("JairoX10:" + form_data[0][1]) if 'firstonetv' in url and len(form_data) > 0: # tmp_data = dict(form_data) # cookies = str(tmp_data['cookie']) # cookies = cookies.replace('___', ';') cookies = requests.utils.dict_from_cookiejar(self.s.cookies) evercookie = { 'evercookie_cache': '', 'evercookie_etag': '', 'evercookie_png': '', 'f1tvuvid': '' } cookies.update(evercookie) cookiestr = "; ".join([ "=".join([key, str(val)]) for key, val in cookies.items() ]) headers['cookie'] = cookiestr # tmp_data.pop('cookie') # form_data = tmp_data.items() r = self.s.post(url, headers=headers, data=form_data, timeout=20) else: try: r = self.s.get(url, headers=headers, timeout=20) if r.status_code == 503: import cfscrape scraper = cfscrape.create_scraper(sess=self.s) r = scraper.get(url, headers=headers) #lib.common.log("JairoWebUtils: %d"%r.status_code) except (requests.exceptions.MissingSchema): return 'pass' #many utf8 encodings are specified in HTTP body not headers and requests only checks headers, maybe use html5lib #https://github.com/kennethreitz/requests/issues/2086 if 'streamlive.to' in urlparse.urlsplit(url).netloc \ or 'sport365.live' in urlparse.urlsplit(url).netloc \ or 'vipleague' in urlparse.urlsplit(url).netloc \ or 'cinestrenostv.tv' in urlparse.urlsplit(url).netloc \ or 'batmanstream.com' in urlparse.urlsplit(url).netloc \ or 'dailydeports.pw' in urlparse.urlsplit(url).netloc \ or 'sportcategory.com' in urlparse.urlsplit(url).netloc: r.encoding = 'utf-8' if 'lfootball.ws' in urlparse.urlsplit(url).netloc: r.encoding = 'windows-1251' response = r.text # if 'dailydeports.pw' in urlparse.urlsplit(url).netloc and 'Schedule' in response: # try: # #page = unicode(response, 'utf-8') # page = response #.decode('utf8') # items = re.findall(r'(?s)<font.+?b>(http[^<]+).+?font>([^<]+)', page) # res = "" # for item in items: # titles = re.findall(r'(\d+:\d+)\s+([^\n]+)', item[1]) # for title in titles: # res+='<url>%s</url><time>%s</time><event>%s</event>\n'%(item[0],title[0],title[1]) # response = res # except: # pass #lib.common.log("JairoWebUtils: %s"%response) if 'beget=begetok' in response: # av _cookie = requests.cookies.create_cookie( 'beget', 'begetok', domain=urlparse.urlsplit(url).netloc, path='/') self.s.cookies.set_cookie(_cookie) r = self.s.get(url, headers=headers, timeout=20) response = r.text if 'fromCharCode,sucuri_cloudproxy_js' in response: # sebn from sucuri import sucuri_decode sucuri_name, sucuri_value = sucuri_decode(response) sucuri_cookie = requests.cookies.create_cookie( sucuri_name, sucuri_value, domain=urlparse.urlsplit(url).netloc, path='/', discard=False, expires=(time.time() + 86400)) self.s.cookies.set_cookie(sucuri_cookie) r = self.s.get(url, headers=headers, timeout=20) response = r.text if len(response) > 10: self.s.cookies.save(ignore_discard=True) self.s.close() return HTMLParser().unescape(response)
def getSource(self, url, form_data, referer, xml=False, mobile=False): url = self.fixurl(url) if not referer: referer = url else: referer = self.fixurl(referer.replace('wizhdsports.be','wizhdsports.is').replace('ibrod.tv','www.ibrod.tv').replace('livetv123.net','livetv.sx')) headers = {'Referer': referer} if mobile: self.s.headers.update({'User-Agent' : 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.75 Mobile/14E5239e Safari/602.1'}) if xml: headers['X-Requested-With'] = 'XMLHttpRequest' if 'cndhlsstream.pw' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'skstream.tv' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'bstream.tech' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'bcast.site' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'bcast.pw' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'live247.online' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'indexstream.tv' in urlparse.urlsplit(url).netloc: del self.s.headers['Accept-Encoding'] if 'streamlive.to' in urlparse.urlsplit(url).netloc: self.s.verify = False if 'vipleague' in url or 'strikeout' in url or 'homerun' or 'nbastreams' in url: self.s.verify = False if 'firstonetv' in url or 'bypassed' in url or 'livecamtv' in url: self.s.verify = False #if 'strikeout' in urlparse.urlsplit(url).netloc: #self.s.headers.update({'Upgrade-Insecure-Requests': '1'}) #self.s.headers.update({'Host': 'zoomtv.me'}) # self.s.headers.update({'Accept' : 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'}) # self.s.headers.update({'Accept-Language' : 'en-US,en;q=0.8,de;q=0.6,es;q=0.4'}) #self.s.headers.update({'Accept-Encoding': 'gzip, deflate'}) #self.s.headers.update({'Connection' : 'keep-alive'}) # self.s.headers.update({'Origin': 'http://www.strikeout.co'}) # self.s.headers.update({'Content-Type': 'application/x-www-form-urlencoded'}) if form_data: #zo**tv #if 'uagent' in form_data[0]: #form_data[0] = ('uagent',urllib.quote(self.s.headers['User-Agent'])) #if len(form_data) > 4 and 'Cookie' in form_data[4]: #headers['Cookie'] = form_data[4][1] #del form_data[4] #headers['Content-Type'] = 'application/x-www-form-urlencoded' #headers['User-Agent'] = self.s.headers['User-Agent'] #lib.common.log("JairoX10:" + form_data[0][1]) r = self.s.post(url, headers=headers, data=form_data, timeout=20) else: try: r = self.s.get(url, headers=headers, timeout=20) except (requests.exceptions.MissingSchema): return 'pass' #many utf8 encodings are specified in HTTP body not headers and requests only checks headers, maybe use html5lib #https://github.com/kennethreitz/requests/issues/2086 if 'streamlive.to' in urlparse.urlsplit(url).netloc \ or 'sport365.live' in urlparse.urlsplit(url).netloc \ or 'vipleague' in urlparse.urlsplit(url).netloc \ or 'cinestrenostv.tv' in urlparse.urlsplit(url).netloc \ or 'batmanstream.com' in urlparse.urlsplit(url).netloc \ or 'sportcategory.com' in urlparse.urlsplit(url).netloc: r.encoding = 'utf-8' if 'lfootball.ws' in urlparse.urlsplit(url).netloc: r.encoding = 'windows-1251' response = r.text if 'beget=begetok' in response: # av _cookie = requests.cookies.create_cookie('beget','begetok',domain=urlparse.urlsplit(url).netloc,path='/') self.s.cookies.set_cookie(_cookie) r = self.s.get(url, headers=headers, timeout=20) response = r.text if 'fromCharCode,sucuri_cloudproxy_js' in response: # sebn from sucuri import sucuri_decode sucuri_name, sucuri_value = sucuri_decode(response) sucuri_cookie = requests.cookies.create_cookie(sucuri_name,sucuri_value,domain=urlparse.urlsplit(url).netloc,path='/', discard=False,expires=(time.time() + 86400)) self.s.cookies.set_cookie(sucuri_cookie) r = self.s.get(url, headers=headers, timeout=20) response = r.text if len(response) > 10: self.s.cookies.save(ignore_discard=True) self.s.close() return HTMLParser().unescape(response)