Estrai i file ZIP dal collegamento HTTPHo pubblicato file ZIP e desidero estrarli a livello di codice e archiviarli sul mio PC utilizzando JSL. Non so in anticipo quanti file saranno presenti.
È possibile con JSL?

Re: estrarre i file ZIP dal collegamento HTTPSono contento che tu possa ricavarne qualcosa! Sono abbastanza sicuro che lo schema potrebbe essere migliorato, in termini di velocità. Probabilmente non fa differenza per le directory di poche migliaia di collegamenti, ma la parte len(1) potrebbe saltare più velocemente il testo non collegato. E sarebbe anche meglio uno schema più flessibile per i collegamenti.
@bryan_boone @Ernest Pasour @paolo_vezzetti
Re: estrarre i file ZIP dal collegamento HTTPGrazie Craig per la risposta esauriente. Prenderò elementi di entrambi i suggerimenti e li fonderò in una funzione generica per soddisfare le mie esigenze attuali e future.
So che dovrei usare un REGEXP per trovare i collegamenti dalla sorgente HTTP, ma speravo in una funzione "<< saveLink" per la parte zip. 
Questo funzionerà perfettamente bene però.
Ottime risposte
Re: estrarre i file ZIP dal collegamento HTTPO forse questo è più vicino a quello che stai chiedendo:
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>Re: estrarre i file ZIP dal collegamento HTTP
zip da @wilkap presentazione
za=open("https://community.jmp.com/kvoqx44227/attachments/kvoqx44227/virtual-jug/12/1/VJUG%20July%202015.zip","zip");
zipfiles=za<
diverse cose da notare
- il file viene scaricato nella tua directory temporanea; l'opzione "zip" per aprire restituisce un oggetto archivio zip
- puoi ottenere un elenco di membri dall'archivio zip usando <
- puoi utilizzare il formato blob con archivio zip per leggere dati binari come le tabelle JMP
- la terza riga utilizza un secondo argomento per indicare a open che il blob è una tabella di dati JMP
- la cancellazione della variabile za è necessaria se si esegue nuovamente l'intero script; l'oggetto archivio zip impedisce il riutilizzo del file nella directory temp.
- puoi usare loadtextfile/savetextfile con i BLOB per scaricare il file zip in una posizione a tua scelta (ed eliminarlo al termine) e quindi utilizzare l'archivio zip per elaborare quel file.
- Ho già cercato di vedere che il quarto elemento nella directory dell'archivio era una tabella di dati JMP