How can I download the pages referenced by me bookmarks as html files?

4

3

I have lots of bookmarks (guitar chords of songs) , saved in Google Chrome, and also a nice program called XMarks It works great, but one problem is, some of the old webpages is getting deleted, so I want to save a local copy of them. And I dont want to

for(i=0; i<infinity; i++)
{
 open page;
 right click;
 save page;
 etc;
}

so is there a software or browser extension that allows me to download all the bookmark pages?

(a php script or similar could also work, I just want the files, and I want to be able to do it regularly) Thanks for any help!

Edit: And I want to preserve the folder structure as the bookmarks folder, too.

Edit 2: : I am not trying to export my bookmarks. I am trying to save every page referenced by my bookmarks (thanks for the edit on the title), so I need a program that opens all my bookmarks, presses Ctrl + S , and saves it (hopefully with the same folder structure as my bookmarks) . see my little code joke above :)

Edit 3 : "Thanks for any help!" means I'm not downvoting any answers, since there is the intention of help.

void

Posted 2013-05-02T15:08:35.613

Reputation: 51

Answers

6

Export your bookmark list as HTML, then use wget to download every page linked to, and all of the images and scripts necessary to display those pages:

wget --recursive --level 1 --page-requisites --convert-links --force-html --input-file bookmarks_7_7_14.html

--level 1 limits the recursive downloading to following one link, from your bookmarks page to the bookmarked website.

--page-requisites means to download the files required to display each page (images, styles, javascript, etc).

--convert-links will change the links to relative ones that work locally if the files are downloaded (images etc) and will change the links to absolute ones (links to other pages) if they aren't.

--force-html will tell wget to treat the input file as an html page rather than a list of URLs.

If you do this repeatedly, some further care will need to be taken to avoid overwriting old downloads with new downloads.

NOTE: This will only download the page you have bookmarked, not other pages on the same site. More complex solutions would be required if you want to mirror some or all of the target sites, and more complex still if you want to be picky about which ones get mirrored how much.

Sparr

Posted 2013-05-02T15:08:35.613

Reputation: 911

and where should i run this command? in the command prompt? Can I turn this into a php code? Because really I need an "automatic" way for this. Since my bookmark list is changing constantly. – void – 2013-05-02T15:23:50.283

yes. wget is available for most OSes, and it's a command line program. – Sparr – 2013-05-02T15:24:38.233

@void you could just do exec('wget ...') in php if you want to keep using wget. you'll probably have to do something to make sure the downloaded files go into a writeable directory, etc. – Sparr – 2013-05-02T15:28:51.030

Instead of using PHP I would recommend creating a Scheduled Task (windows) or cron job (linux, osx) or launchd (osx) that runs the wget command on a schedule. – Sparr – 2013-05-02T15:30:11.737

oh. i didn't read your code. it takes bookmarkfile.html as input. so it is probably what I'm seeking. Thank you very much ! – void – 2013-05-02T15:30:47.787

an easy way to get wget for windows is through the GOW toolkit, though there's standalone distributions of wget as well

– Journeyman Geek – 2013-05-02T15:39:04.890

@Sparr, thank you again. I had to go suddenly, now I'm back, I will try wget in windows' cmd. But I'm wondering, will this preserve the folder structure ? is there any arguments to wget to accomplish this? – void – 2013-05-02T16:50:02.640

@JourneymanGeek: GOW contains wget 1.11.4 which is ancient. Why bother when wget 1.14 has been available for months now? – Karan – 2013-05-03T21:58:51.597

ease of use, mainly. I have gow installed on most of my systems simply cause it installs a bunch of nix style tools to path, so they work similarly to how they would on linux – Journeyman Geek – 2013-05-03T23:35:47.477

1

If you want to download some pages of actual site then you will need some tool to copy a website. One free tool that I use frequently is httrack

But if you Google you will probably find number tools that does similar things... some are free some are paid.

JackLock

Posted 2013-05-02T15:08:35.613

Reputation: 600