Changeset 39352 for titan/mediathek/localhoster
- Timestamp:
- 11/19/16 14:22:57 (7 years ago)
- Location:
- titan/mediathek/localhoster
- Files:
-
- 5 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/mediathek/localhoster/flashx.py
r39076 r39352 5 5 from lib.net import Net 6 6 import lib.common as common 7 import lib.fx_gmu as fx_gmu 8 import lib.fx_gmu as fx_gmu 9 10 FX_SOURCE = 'https://offshoregit.com/tvaresolvers/fx_gmu.py' 11 FX_PATH = '' 7 12 8 13 class FlashxResolver(object): … … 26 31 return False 27 32 33 def get_fx_code(self): 34 try: 35 headers = self.net.http_HEAD(FX_SOURCE).get_headers(as_dict=True) 36 old_etag = self.get_setting('etag') 37 new_etag = headers.get('Etag', '') 38 old_len = self.__old_length() 39 new_len = int(headers.get('Content-Length', 0)) 40 if old_etag != new_etag or old_len != new_len: 41 self.set_setting('etag', new_etag) 42 new_py = self.net.http_GET(FX_SOURCE).content 43 if new_py: 44 with open(FX_PATH, 'w') as f: 45 f.write(new_py) 46 else: 47 print 'Reusing existing fx_gmu.py: |%s|%s|%s|%s|' % (old_etag, new_etag, old_len, new_len) 48 except Exception as e: 49 print 'Exception during flashx code retrieve: %s' % e 50 51 def __old_length(self): 52 try: 53 with open(FX_PATH, 'r') as f: 54 old_py = f.read() 55 old_len = len(old_py) 56 except: 57 old_len = 0 58 return old_len 59 28 60 def get_media_url(self, host, media_id): 29 web_url = self.get_url(host, media_id) 30 resp = self.net.http_GET(web_url) 31 html = resp.content 32 cfdcookie = resp._response.info()['set-cookie'] 33 cfduid = re.search('cfduid=(.*?);', cfdcookie).group(1) 34 file_id = re.search("'file_id', '(.*?)'", html).group(1) 35 aff = re.search("'aff', '(.*?)'", html).group(1) 36 headers = {'User-Agent': common.IE_USER_AGENT, 37 'Referer': web_url, 38 'Cookie': '__cfduid=' + cfduid + '; lang=1'} 39 surl = re.search('src="(.*?' + file_id + ')', html, re.IGNORECASE).group(1) 40 dummy = self.net.http_GET(url=surl, headers=headers).content 41 headers = {'User-Agent': common.IE_USER_AGENT, 42 'Referer': web_url, 43 'Cookie': '__cfduid=' + cfduid + '; lang=1; file_id=' + file_id + '; aff=' + aff} 44 html = self.net.http_GET(url=web_url, headers=headers).content 45 fname = re.search('name="fname" value="(.*?)"', html).group(1) 46 hash = re.search('name="hash" value="(.*?)"', html).group(1) 47 fdata = {'op': 'download1', 48 'usr_login': '', 49 'id': media_id, 50 'fname': fname, 51 'referer': '', 52 'hash': hash, 53 'imhuman': 'Proceed to video'} 54 furl = 'http://www.flashx.tv/dl'# + media_id 55 time.sleep(5) 56 html = self.net.http_POST(url=furl, form_data=fdata, headers=headers).content 61 # try: 62 # if self.get_setting('auto_update') == 'true': 63 # self.get_fx_code() 64 # with open(FX_PATH, 'r') as f: 65 # py_data = f.read() 66 # import fx_gmu 67 web_url = self.get_url(host, media_id) 68 print fx_gmu.get_media_url(web_url) 69 # except Exception as e: 70 # print 'error' 71 72 def get_url(self, host, media_id): 73 return 'http://%s/embed.php?c=%s' % (host, media_id) 57 74 58 js_data = re.findall('(eval\(function.*?)</script>', html.replace('\n', ''))59 60 for i in js_data:61 try: html += jsunpack.unpack(i)62 except: pass63 64 print self.get_best_source(html)65 66 def get_url(self, host, media_id):67 return 'http://www.flashx.tv/%s.html' % media_id68 69 70 def get_best_source(self, html):71 stream = re.search('file:"([^"]*/high.*)",label', html)72 if stream:73 return re.search('file:"([^"]*/high.*)",label', html).group(1)74 else:75 stream = re.search('file:"([^"]*/normal.*)",label', html)76 if stream:77 return re.search('file:"([^"]*/normal.*)",label', html).group(1)78 else:79 stream = re.search('file:"([^"]*/low.*)",label', html)80 if stream:81 return re.search('file:"([^"]*/low.*)",label', html).group(1)82 else:83 stream = re.search('file:"([^"]*)",label', html)84 if stream:85 return re.search('file:"([^"]*)",label', html).group(1)86 87 75 sys.stdout = FlashxResolver() -
titan/mediathek/localhoster/movshare.py
r39232 r39352 1 1 2 import random 2 3 import re 3 4 import urllib 4 5 import sys 5 6 from lib.net import Net 7 from lib import helpers 6 8 7 9 class MovshareResolver(object): … … 27 29 def get_media_url(self, host, media_id): 28 30 web_url = self.get_url(host, media_id) 29 h tml = self.net.http_GET(web_url).content30 try:31 32 r = re.search('flashvars.filekey=(.+?);', html)33 if r:34 r = r.group(1)35 try: filekey = re.search('var\s+%s\s*=\s*"([^"]+)' % (r), html).group(1)36 except: filekey = r37 player_url = 'http://%s/api/player.api.php?key=%s&file=%s' % (host, urllib.quote(filekey), media_id)38 html = self.net.http_GET(player_url).content39 r = re.search('url=(.+?)&', html)40 if r:41 stream_url = r.group(1)42 43 try:44 r = re.search('id="player"[^>]+src="([^"]+)', html, re.DOTALL)45 if r:46 stream_url = r.group(1)31 headers = {'User-Agent': common.FF_USER_AGENT} 32 html = self.net.http_GET(web_url, headers=headers).content 33 stream_url = '' 34 match = re.search('<video.*?</video>', html, re.DOTALL) 35 if match: 36 links = re.findall('<source[^>]+src="([^"]+)', match.group(0), re.DOTALL) 37 if links: 38 stream_url = random.choice(links) 39 40 if not stream_url: 41 match = re.search('fkzd="([^"]+)', html) 42 if match: 43 query = {'pass': 'undefined', 'key': match.group(1), 'cid3': 'undefined', 'cid': 0, 'numOfErrors': 0, 'file': media_id, 'cid2': 'undefined', 'user': 'undefined'} 44 api_url = 'http://www.wholecloud.net//api/player.api.php?' + urllib.urlencode(query) 45 html = self.net.http_GET(api_url, headers=headers).content 46 match = re.search('url=([^&]+)', html) 47 if match: 48 stream_url = match.group(1) 47 49 48 50 if stream_url: 49 print '%s|Referer=%s' % (stream_url, web_url) 51 headers.update({'Referer': web_url, }) 52 print stream_url + helpers.append_headers(headers) 50 53 51 54 def get_url(self, host, media_id): 52 55 if 'vidgg' in host: 53 return 'http://%s/embed/?id=%s' % (host, media_id)56 template = 'http://{host}/embed/?id={media_id}' 54 57 else: 55 return 'http://%s/embed/?v=%s' % (host, media_id) 58 template = 'http://{host}/embed/?v={media_id}' 59 print self._default_get_url(host, media_id, template) 56 60 57 61 sys.stdout = MovshareResolver()
Note: See TracChangeset
for help on using the changeset viewer.