Changeset 44494
- Timestamp:
- 01/05/20 02:26:21 (3 years ago)
- Location:
- titan/mediathek/localhoster
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/mediathek/localhoster/flashx.py
r40037 r44494 5 5 from lib.net import Net 6 6 import lib.common as common 7 import lib.fx_gmu as fx_gmu 8 9 FX_SOURCE = 'https://offshoregit.com/tvaresolvers/fx_gmu.py' 10 FX_PATH = '' 7 import urllib2 11 8 12 9 class FlashxResolver(object): … … 16 13 17 14 def __init__(self): 18 # print "1111111111111"19 15 self.net = Net() 20 # print "2222222222222" 16 url = str(sys.argv[1]) 17 return self.get_media_url(url) 21 18 22 url = str(sys.argv[1]) 23 # print "3333333333333" 24 25 host = self.get_host_and_id(url)[0] 26 # print "4444444444444" 27 28 media_id = self.get_host_and_id(url)[1] 29 # print "5555555555555" 30 31 return self.get_media_url(host, media_id) 32 33 def get_host_and_id(self, url): 34 r = re.search(self.pattern, url, re.I) 35 if r: 36 return r.groups() 37 else: 38 return False 39 40 def get_fx_code(self): 41 try: 42 headers = self.net.http_HEAD(FX_SOURCE).get_headers(as_dict=True) 43 old_etag = self.get_setting('etag') 44 new_etag = headers.get('Etag', '') 45 old_len = self.__old_length() 46 new_len = int(headers.get('Content-Length', 0)) 47 if old_etag != new_etag or old_len != new_len: 48 self.set_setting('etag', new_etag) 49 new_py = self.net.http_GET(FX_SOURCE).content 50 if new_py: 51 with open(FX_PATH, 'w') as f: 52 f.write(new_py) 53 else: 54 print 'Reusing existing fx_gmu.py: |%s|%s|%s|%s|' % (old_etag, new_etag, old_len, new_len) 55 except Exception as e: 56 print 'Exception during flashx code retrieve: %s' % e 57 58 def __old_length(self): 59 try: 60 with open(FX_PATH, 'r') as f: 61 old_py = f.read() 62 old_len = len(old_py) 63 except: 64 old_len = 0 65 return old_len 66 67 def get_media_url(self, host, media_id): 68 # try: 69 # if self.get_setting('auto_update') == 'true': 70 # self.get_fx_code() 71 # with open(FX_PATH, 'r') as f: 72 # py_data = f.read() 73 # import fx_gmu 74 # print "aaaaaaaaaaaa" 75 76 web_url = self.get_url(host, media_id) 77 # print "bbbbbbbbbbbb", web_url 78 79 print fx_gmu.get_media_url(web_url) 80 # print "cccccccccccc" 81 82 # except Exception as e: 83 # print 'error' 84 85 def get_url(self, host, media_id): 86 return 'http://%s/embed.php?c=%s' % (host, media_id) 87 19 def get_media_url(self, url): 20 html = self.net.http_GET(url).content 21 js_data = re.findall('(eval\(function.*?)</script>', html.replace('\n', '')) 22 23 for i in js_data: 24 try: html += jsunpack.unpack(i) 25 except: pass 26 print "html", html 27 88 28 sys.stdout = FlashxResolver() -
titan/mediathek/localhoster/hoster.sh
r44491 r44494 156 156 flashx() 157 157 { 158 $BIN $CMD/flashx.py $INPUT 158 TMPURL=$(echo $INPUT | sed "s!\.tv/!\.tv/embed-!") 159 $curlbin "$TMPURL" -o $TMP/cache.$FILENAME.1 160 TMPURL=`cat $TMP/cache.$FILENAME.1 | sed -nr "s/.*location.href='([^']+)'.*/\1/p" ` 161 $BIN $CMD/flashx.py $TMPURL > $TMP/cache.$FILENAME.2 162 cat $TMP/cache.$FILENAME.2 | grep "video/mp4" | sed -nr "s/.*src:\\\'([^']+)\\\'.*/\1/p" 159 163 } 160 164
Note: See TracChangeset
for help on using the changeset viewer.