eve11: (Default)
[personal profile] eve11
Here is what I did. This works for public entries. For private albums or folders you may have to use some extra arguments to curl. See this stackoverflow for more details.

Steps:
- Open up a plain text file on your computer
- For each album in your scrapbook, click on it, and click the "Add all pictures to Post" link at the top.
- Click "Add link to original" when prompted at the post and click "add pictures"
- Copy/paste the entire list of img links into the text file, one link per line.
- Save the text file: "ljpics.txt" or what-have-you into a directory in your Downloads folder or wherever you would like
- Install R (https://cran.r-project.org/bin/macosx/) if you don't have it already
- Open a terminal and cd to the directory where your text file lives.
- Open R, by typing "R" at the terminal
- Read in the text file as a data frame in R:

links <- read.table("ljpics.txt", header=F, sep="\n")

- Make a vector of the original picture links out of the html text as follows:

filenames <- unlist(lapply(strsplit(gsub("<a target=_blank href=", "", links[,1]), ">"), function(x){x[1]}))

(that first gsub statement should be whatever complete text appears before the file url name in the html link. It should be the same for all of the files that were copy-pasted)
- Read in each file name using a for() loop:

for(fname in filenames) {
download.file(fname, destfile = basename(fname), method="curl")
}


Et voila! It will loop through all your files and download them to your current directory. (And also, now you will have a very powerful and free statistical computing and graphing environment if you want to keep R around.)

For private files, you might be able to add extra command line statements into the loop using the argument ' extra = "-u (lj username)" ' after the "method" argument, though I'm not sure what format you need to provide the username in, but it should prompt you for a password according to this stackoverflow page.
This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

Profile

eve11: (Default)
eve11

December 2022

S M T W T F S
    123
45678910
11121314151617
18192021222324
25262728293031

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 8th, 2025 09:17 pm
Powered by Dreamwidth Studios