Message Boards Message Boards

Download a file with WebExecute?

Posted 4 years ago

Mathematica 12.0, Linux x86-64.

After starting a chrome web session (StartWebSession); and using WebExecute to login to a site, I retrieve a list of hyperlinks

WebExecute[session,"PageHyperlinks"]

and would like to download those using WebExecute (they are pdf documents).

WebExecute[session, "CapturePage"];

doesn't seem to operate on pdf files. is there a way to download those using WebExecute? I can't use Import because it's tied to a particular session (cookies).

Thank you

POSTED BY: jerome ibanes
Posted 2 years ago

Hello!

I recently encountered the same problem when writing a web crawler. After some research, I found that using the command line to call Internet Download Manager is a good way.

Hope this late reply is still helpful to you.

SetDirectory[dir];
Table[RunProcess[{"idman", "/d", "\"" <> url[[i]] <> "\"", "/p", 
   "\"" <> StringReplace[Directory[], "\\" -> "\\\\"] <> "\\\\\"", 
   "/f", "\"Your file name - " <> IntegerString[i, 10, 2] <> ".pdf" <>
     "\"", "/n"}];
 Pause[10], {i, 1, Length[url]}]

Tutorials about IDM's command line. Don't forget to add IDM's installation path to the environment variable PATH.

POSTED BY: Zihan Li
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract