Feeds:
文章
留言

Archive for 三月 14th, 2008

FreeGrab 下載模組 ZShare 0.0.6

ZShare 官方改的可真快,昨天我才改腳本,今天就不能下,還好這次改的更簡單,新腳本如下:

MODULE_NAME = "zshare"
MODULE_VERSION = "0.0.6"
MODULE_REQUIRE_VERSION = "1.2.3.4"
MODULE_AUTHOR = "cwchiu@hotmail.com"
MODULE_LAST_UPDATE = "2008/03/14"
DEFAULT_SAVEPATH = ‘h:\’
————————————————————————-
–local func
————————————————————————-
local function DownFile()
    if not GetHtml() then return false end
    if not Compile("link = ‘
http://([./%0-9a-zA-Z_-]+)’;") then return false end   
    local _,url = What()   
    return GetFile(‘
http://’ .. url );
end

————————————————————————-
–main
————————————————————————-
function Download()
    local url = GetUrl()
    if url:find( "zshare%.net/download" ) then
        return DownFile()
    else
        UpdateLog("網址有誤")
        return false
    end
end

function Upload()
    if not GetHtml("http://www.zshare.net/") then return false end
    if not Compile("<form name="upload" method="POST" action="([^"]+)"") then return false end
    local _,action = What()
    if not action then
        UpdateLog("找不到上傳表格,請檢查紀錄檔")
        CreateLogFile("zshare_upload_failed.html")
        return false
    end
    AddFormField("TOS","1")
    AddFormFile("file")
    UpdateLog("準備上傳…","info")
    if not UploadFile(action) then return false end
    if not Compile("Direct Link:.+?value="(http[^"]+)".+?Delete Link:.+?value="(http:[^"]+)"") then return false end
    local _,u1,u2 = What()
    if not u1 or not u2 then
        UpdateLog("找不到網址1/2,視為失敗,請檢查紀錄檔")
        CreateLogFile("zshare_upload_failed.html")
        return false
    end

    SetUrl(u1,u2)
    UpdateLog("上傳成功,網址1為檔案連結,網址2為刪除連結", "info")
    return true
end

Read Full Post »