從 HTTP 鏈接提取 ZIP 文件我已經發布了 ZIP 文件,並希望以編程方式提取它們並使用 JSL 存儲到我的 PC 上。 我事先不知道會有多少文件。
JSL 可以做到這一點嗎?

回复:從 HTTP 鏈接提取 ZIP 文件很高興你能從中得到一些東西! 我很確定該模式可以在速度方面得到改進。 對於只有幾千個鏈接的目錄來說可能沒有什麼區別,但 len(1) 部分可以更快地跳過非鏈接文本。 更靈活的鏈接模式也會更好。
@bryan_boone @歐內斯特帕索爾@paul_vezzetti
回复:從 HTTP 鏈接提取 ZIP 文件感謝克雷格的全面答复。 我將採納這兩個建議的元素,並將其合併到一個通用函數中,以滿足我當前和未來的需求。
我知道我必須使用 REGEXP 來查找來自 HTTP 源的鏈接,但希望 zip 部分有一個 '<< saveLink' 函數。 
不過這會工作得很好。
很好的答案
回复:從 HTTP 鏈接提取 ZIP 文件或者這可能更接近您的要求:
path="https://www.vsp.virginia.gov/downloads/"; // a page with an index of files. Yours may be different format, adjust pattern below.
html = loadtextfile(path); // get the HTML text so we can scrape the links
// somewhat custom pattern for scraping the links, may be specific to this page
urls = {}; // this list will collect the urls
rc = patmatch(html,
patpos(0)+ // make sure the pattern matches from the start
patrepeat( // this is the loop that extracts the urls from the html
(
// the urls look like <A href="https://community.jmp.com/2017%20Virginia%20Firearms%20Dealers%20Procedrures%20Manual.pdf" target="_blank">
// and we want just the part between the quotation marks. Quickly scan forward (patBreak)
// for a < then see if it matches. >>url grabs the text between quotation marks.
(patbreak("<") + "</A><A href="\!""" target="_blank" rel="nofollow noopener noreferrer">> url + pattest(insertinto(urls,url);1))
| // OR
patlen(1) // skip forward one character
)
+
patfence() // fence off the successfully matched text. There is no need to backtrack if something goes wrong.
) +
patrepeat(patnotany("<"),0) + // any trailing bits of html are consumed here
patrpos(0) // make sure the pattern matches to the end
);
if(rc==0, throw("pattern did not match everything"));
show(nitems(urls),urls[6]); // pick item 6. You'll have a different strategy.
fullpath = path||regex(urls[6],"%20"," ",GLOBALREPLACE);// minimal effort to fix up the url, might need more work
pdfblob = loadtextfile(fullpath,blob); // download item 6, it is a pdf when this was written...
savetextfile("$temp/example.pdf",pdfblob); // save it somewhere</A>回复:從 HTTP 鏈接提取 ZIP 文件
zip 文件來自@威爾卡普推介會
za=open("https://community.jmp.com/kvoqx44227/attachments/kvoqx44227/virtual-jug/12/1/VJUG%20July%202015.zip","zip");
zipfiles=za<
有幾點需要注意
- 文件被下載到您的臨時目錄;打開的“zip”選項返回一個 zip 存檔對象
- 您可以使用 <
- 您可以使用帶有 zip 存檔的 blob 格式來讀取 JMP 表等二進制數據
- 第三行使用第二個參數告訴 open 該 blob 是 JMP 數據表
- 如果重新運行整個腳本,則需要清除 za 變量; zip 存檔對象可防止臨時目錄中的文件被重複使用。
- 您可以使用 loadtextfile/savetextfile 和 blob 將 zip 文件下載到您選擇的位置(完成後將其刪除),然後使用 zip 存檔來處理該文件。
- 我已經看到存檔目錄中的第四項是 JMP 數據表