# -*- coding: utf-8 -*-
import clr
import sys
import System

sys.path.append(UI.StartupPath+'\Script\Module\dll')
clr.AddReferenceToFile("EasyScript.dll")
from EasyScript import *
EasyScript = EasyScript()

URL="http://www.speedshare.org/"

UI.UpdateLog("※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※")
UI.UpdateLog("※【免空科學研究所 　ｔｉｇｅｒｍａｘ．ｄｙｎｄｎｓ．ｏｒｇ】※")
UI.UpdateLog("※～㊣　　　　　　　　 　　傻Ｂ　　製作分享　　　　　　　㊣～※")
UI.UpdateLog("※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※")
UI.UpdateLog("【腳本更新】：2013.03.13")
UI.UpdateLog("【上傳空間】：speedshare.org")
UI.UpdateLog("【上傳大小】：1,024 MB")
UI.UpdateLog("【砍檔時間】：未知")
UI.UpdateLog("【腳本功能】：無帳號上傳")
UI.UpdateLog("＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝",2)

HTML=HTTP.GetURL(URL)
UI.UpdateLog("開始進入上傳頁面…",2)
UP_LINK=EasyScript.GetstrToVariable(HTML,';" action="','"',1)
sessionid=EasyScript.GetstrToVariable(HTML,'sessionid" value="','"',1)
UploadSession=EasyScript.GetstrToVariable(HTML,'UploadSession" value="','"',1)
AccessKey=EasyScript.GetstrToVariable(HTML,'AccessKey" value="','"',1)
maxfilesize=EasyScript.GetstrToVariable(HTML,'maxfilesize" value="','"',1)
phpuploadscript=EasyScript.GetstrToVariable(HTML,'phpuploadscript" value="','"',1)
returnurl=EasyScript.GetstrToVariable(HTML,'returnurl" value="','"',1)
HTTP.AddUpParam("sessionid",sessionid)
HTTP.AddUpParam("UploadSession",UploadSession)
HTTP.AddUpParam("AccessKey",AccessKey)
HTTP.AddUpParam("maxfilesize",maxfilesize)
HTTP.AddUpParam("phpuploadscript",phpuploadscript)
HTTP.AddUpParam("returnurl",returnurl)
HTTP.AddUpParam("uploadmode","1")
HTTP.AddUpParam("send","Upload")
HTTP.AddFileReference("uploadfile_0")
HTML=UI.UpFile(UP_LINK)
T_URL=EasyScript.GetstrToVariable(HTML,"location.href='","'",1)
T_URL=EasyScript.ReplaceVariable(T_URL,"%2F","/")
T_URL=EasyScript.ReplaceVariable(T_URL,"%3A",":")
HTML=HTTP.GetURL(T_URL)
HTTP.AddPostParam("UploadSession",UploadSession)
HTTP.AddPostParam("AccessKey",AccessKey)
HTTP.AddPostParam("uploadmode","1")
HTTP.AddPostParam("submitnums","0")
HTML=HTTP.PostURL("http://www.speedshare.org/emaillinks.php",HTTP.PostData)
DL_LINK=EasyScript.GetstrToVariable(HTML,'downloadurl">','<',1)
DE_LINK=EasyScript.GetstrToVariable(HTML,'filedel">','<',1)
if DL_LINK!=False:
	UI.UpdateLog("＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝",2)
        UI.UpdateLog("下載連結：",4)
        UI.UpdateLog(DL_LINK)
        UI.UpdateLog("刪檔連結：",3)
        UI.UpdateLog(DE_LINK)
        UI.AddShareLink(DL_LINK)
        UI.ProceSuccess()
else:
        UI.UpdateLog("無法取得網址",3)
        UI.ProceFalse()