Feeds:
文章
留言

Archive for 三月 13th, 2008

FreeGrab 下載模組 ZShare 0.0.5

今天使用時,發現無法下載,做了以下修正~ 需要者請自行下載取用

MODULE_NAME = "zshare"
MODULE_VERSION = "0.0.5"
MODULE_REQUIRE_VERSION = "1.2.3.4"
MODULE_AUTHOR = "cwchiu@hotmail.com"
MODULE_LAST_UPDATE = "2008/03/13"
DEFAULT_SAVEPATH = ‘h:\’
————————————————————————-
–local func
————————————————————————-
local function DownFile()
    if not GetHtml() then return false end
    if not Compile("name="download" type="hidden" id="download" value="([^"]+)">") then return false end
    local _,download = What()
    if not download then
        UpdateLog("找不到 download 欄位,請檢查紀錄檔")
        CreateLogFile("zshare_download_failed.html")
        return false
    end

    AddFormField("download",download)
    PostForm()

    –if not Compile("<meta http-equiv="Refresh".+?URL=([^"]+)">") then return false end
    if not Compile("link_enc=new Array((.*));link") then return false end

    local _,url = What()
    local link = "

    for word in string.gmatch(url, "'(.)’") do
        link = link .. word
    end
    url = link;

    if not url then
        if GetUrl():find(‘404%.html’) then
            UpdateLog("沒有這個檔案 ╭(─╴╴─)╮ ▃▇")
        else
            UpdateLog("找不到真實路徑,請檢查紀錄檔")
            CreateLogFile("zshare_download_failed.html")
        end
        return false
    end

    return GetFile(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 »