URL substitutions

Author Message
ER 06/29/2011 02:48 pm
Is there an example that walks through using a variable? I want to set up a macro that downloads a series of files, and the URL has a year in it (e.g., 1998). I'd like to set it up so that it downloads that year, then I can go in and change the value of the "year" variable to, say, 1999, and download that year.

Also, can you use more than one variable in a URL?
Oleg Chernavin 06/29/2011 03:35 pm
Yes, there are any number of variables and macros supported for URLs. Please let me know few examples of links you want to download and I will advise you on the macros to use.

You can also read the Help file - URL Macros topic.

Best regards,
Oleg Chernavin
MP Staff
ER 06/29/2011 05:48 pm
Hi, thank you. Here are a few of the URL's:

http://cyber.playboy.com/members/playmates/files/1980/01/imx/1980-01-01-xl.jpg
http://cyber.playboy.com/members/playmates/files/1980/01/imx/1980-01-02-xl.jpg

http://cyber.playboy.com/members/playmates/files/1980/02/imx/portfolio-PM198002A1-01-lrg.jpg
http://cyber.playboy.com/members/playmates/files/1980/02/imx/portfolio-PM198002A1-02-lrg.jpg
http://cyber.playboy.com/members/playmates/files/1980/02/imx/portfolio-PM198002A1-03-lrg.jpg

I believe all of the files for the various years follow one or the other of these two formats.

Since there are several variables here - the year, the month, and the construction of the file name - I thought the best approach would be to use a variable for the year, and download one year at a time. I was also thinking I would use macros like {:01..30} to iterate through the file names.

I read through URL Macros and Substitutions topics and tried a few things, but couldn't get the variable substitutions to work at all, and using just macro substitutions like {:01..30} seemed pretty labor intensive.

If there's a better approach to this, please let me know.

Thanks for your help!
Oleg Chernavin 06/29/2011 05:54 pm
What do you mean Labor Intensive? You can use several macros easily together that will generate up to 1 million URLs. It will make some delay when you start the download, but it is OK.

http://cyber.playboy.com/members/playmates/files/19{:80..99#year}/{:01..12#month}/imx/19{:#year}-{:#month}-{:01..30}-xl.jpg

The above took less than a second to generate all links and start the download on a laptop.

http://cyber.playboy.com/members/playmates/files/19{:80..99#year}/{:01..12#month}/imx/portfolio-PM19{:#year}{:#month}A1-{:01..30}-lrg.jpg

Pretty easy to use, I think. Maybe you tried it some other way?

Oleg.
ER 07/04/2011 05:44 am
Hi, thank you for your help! What I didn't understand was the use of #year and #month. Without those, the macros I wrote generate many meaningless URLs - e.g.:

http://cyber.playboy.com/members/playmates/files/1980/01/imx/1981-01-xl.jpg
http://cyber.playboy.com/members/playmates/files/1980/01/imx/1981-02-xl.jpg

In these URLs, the year for the image doesn't match the year being downloaded. Without the variables it would generate hundreds of these and would take forever to download. So I was thinking of using macros for part of the URL, but then manually copying and modifying parts of it as well - that's what I meant by labor intensive. I was sure there was a way to get around that, but I didn't know what it was, until you showed me.

Is there a place this is explained in the documentation? I couldn't find it, but might not have known where to look.

Thanks again for your help, this solved my problem.
Oleg Chernavin 07/04/2011 05:45 am
Yes, this is explained in the Help file - Using URL Macros topic. The variables are described pretty well, I think. But it needs to be written better or something should be added to that text, please let me know.

Oleg.
ER 10/31/2011 02:50 pm
Hi, I have another site I'm trying to download from, but the kind of substitutions you provided last time don't work because the path changes in an apparently random way for each file. I'd like to download zips and movie files from this site:

www.errotica-archives.com

A few examples of the paths to the files are:

http://members.errotica-archives.com/download/2467/antea_s54_l
http://members.errotica-archives.com/download/2448/antea_s53_l
http://members.errotica-archives.com/download/2318/antea_melisa_v01_wmv
http://members.errotica-archives.com/download/1431/bijou_s17_l
http://members.errotica-archives.com/download/1367/bijou_s16_l
http://members.errotica-archives.com/download/1506/bijou_v03_wmv

Do you see any way to set up a macro that would download the zips and movie files from this site?

Thanks!

ER
Oleg Chernavin 11/03/2011 04:11 pm
Yes, randoms are not supported for macros. Offline Explorer would not know how to guess the URLs. You will have to download the full site.

Oleg.