|
|
|
@ -67,6 +67,8 @@ def UrielGetPage():
|
|
|
|
|
|
|
|
|
|
post_scheme = netloc + "/" + urllib.quote(path) |
|
|
|
|
post_scheme = post_scheme.replace('//','/') |
|
|
|
|
if url_comp.query != '': |
|
|
|
|
post_scheme += '?'+url_comp.query |
|
|
|
|
url = scheme + "://" + post_scheme |
|
|
|
|
pagedata = subprocess.Popen('wget -q -O - -U "' + Uriel.user_agent + '" "' + url + '" 2>/dev/null', shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE).communicate()[0] |
|
|
|
|
filedata = UrielPreProcess(pagedata, url) |
|
|
|
@ -149,6 +151,8 @@ def UrielNavBack():
|
|
|
|
|
|
|
|
|
|
post_scheme = netloc + "/" + urllib.quote(path) |
|
|
|
|
post_scheme = post_scheme.replace('//','/') |
|
|
|
|
if url_comp.query != '': |
|
|
|
|
post_scheme += '?'+url_comp.query |
|
|
|
|
url = scheme + "://" + post_scheme |
|
|
|
|
filesize = len(filedata) |
|
|
|
|
if filesize>0: |
|
|
|
@ -203,6 +207,8 @@ def UrielNavFwd():
|
|
|
|
|
|
|
|
|
|
post_scheme = netloc + "/" + urllib.quote(path) |
|
|
|
|
post_scheme = post_scheme.replace('//','/') |
|
|
|
|
if url_comp.query != '': |
|
|
|
|
post_scheme += '?'+url_comp.query |
|
|
|
|
url = scheme + "://" + post_scheme |
|
|
|
|
filesize = len(filedata) |
|
|
|
|
if filesize>0: |
|
|
|
@ -260,6 +266,8 @@ def UrielThumb():
|
|
|
|
|
|
|
|
|
|
post_scheme = netloc + "/" + urllib.quote(path) |
|
|
|
|
post_scheme = post_scheme.replace('//','/') |
|
|
|
|
if url_comp.query != '': |
|
|
|
|
post_scheme += '?'+url_comp.query |
|
|
|
|
url = scheme + "://" + post_scheme |
|
|
|
|
tmp_thumb = '/tmp/' + str(uuid.uuid4()) + '.bmp' |
|
|
|
|
while os.path.exists(tmp_thumb): |
|
|
|
@ -290,9 +298,13 @@ def UrielPreProcess(htm1, l_url):
|
|
|
|
|
title_text = '' |
|
|
|
|
hb_header = '$WW,1$$BLACK$$MA+LIS,"[Close]",LM="U_CloseBrowser;"$ $MA+LIS,"[Back]",LM="U_HistNav(0);"$ $MA+LIS,"[Fwd]",LM="U_HistNav(1);"$ $MA+LIS,"[Go]",LM="U_Browser(GetStr(\\"\nURL> \\"));"$ ' + title_text + '\n\n' |
|
|
|
|
|
|
|
|
|
if htm1.upper().find('<HTML') == -1: |
|
|
|
|
dl_link = '$AN,"",A="BINARY"$Click $MA+LIS,"[Here]",LM="U_Download(\\"' + l_url + '\\");"$ to download the file:\n\n' + l_url |
|
|
|
|
return hb_header + dl_link |
|
|
|
|
doc_detect = False |
|
|
|
|
if htm1.upper().find('<HTML') != -1: |
|
|
|
|
doc_detect = True |
|
|
|
|
if htm1.upper().find('<!DOCTYPE HTML') != -1: |
|
|
|
|
doc_detect = True |
|
|
|
|
if doc_detect == False: |
|
|
|
|
return '$AN,"",A="BINARY"$' |
|
|
|
|
|
|
|
|
|
htm1 = htm1[htm1.upper().find('<HTML'):] |
|
|
|
|
htm1 = htm1.replace('$', '$$') |
|
|
|
@ -331,7 +343,7 @@ def UrielPreProcess(htm1, l_url):
|
|
|
|
|
if tag.name.upper() != 'IMG': |
|
|
|
|
tag.decompose() |
|
|
|
|
|
|
|
|
|
remove_tags = [ 'svg', 'embed', 'head', 'noscript', 'object', 'param', 'script', 'option' ] |
|
|
|
|
remove_tags = [ 'style', 'svg', 'embed', 'head', 'noscript', 'object', 'param', 'script', 'option' ] |
|
|
|
|
for tag in remove_tags: |
|
|
|
|
[s.extract() for s in soup1(tag)] |
|
|
|
|
|
|
|
|
|