HTTrack Website Copier
Free software offline browser

Mirror a site behind a login or a CAPTCHA

Some sites show their pages only after you log in, or only after you pass a check such as a CAPTCHA. HTTrack cannot fill in a login form and cannot solve a CAPTCHA. But it can use the session of a browser where you already logged in, so the site accepts HTTrack as that browser. Since version 3.51, WinHTTrack, WebHTTrack and the Android app each have a button that does this in a few clicks.

When to use this method

Use it when one of these is true:

Some sites ask for a user name and a password in a small browser window (HTTP Basic authentication). For these sites, you do not need this method. Put the user name and the password in the address, for example https://user:password@example.com/. See the FAQ.

WinHTTrack: log in with the built-in browser

  1. Start a new project. On the page with the address box, click "Add URL...".
  2. Type the address of the site, then click "Log in with a browser...". A browser window opens on this address.
  3. Log in to the site as usual. If there is a CAPTCHA, solve it. Then go to the first page that you want to copy, and click "Done".
  4. WinHTTrack tells you how many cookies it collected. The address box now shows the page where the browser stopped. Click "OK" to keep the login, or "Cancel" to discard it.

If the browser stops on another site than the one you started from, WinHTTrack warns you. Check the address before you go on.

The button needs the Microsoft Edge WebView2 Runtime, which Windows 10 and 11 already have. It does not work on Windows 7. When the button is greyed out, its tooltip tells you why.

WebHTTrack: paste the request of your browser

WebHTTrack runs in your browser, so it can take the login from that browser.

  1. Log in to the site in another tab of the same browser.
  2. Press F12 to open the developer tools, and open the "Network" tab. Reload the page.
  3. Right-click the first request in the list (the page itself), and choose "Copy as cURL (bash)". Firefox calls it "Copy as cURL", or "Copy as cURL (POSIX)" on Windows.
  4. In WebHTTrack, on the page where you type the addresses, click "Log in with a browser...". Paste the text and click "Go". Check the number of cookies, then click "OK".

A cookies.txt file works too: type the site address first in the address box, then paste the content of the file.

Android: log in inside the app

  1. Start a new project. Give it a name, and type the address of the site. The address must start with https://.
  2. Tap "Log in with a browser", under the address field.
  3. Log in to the site as usual, then tap "Use this login". Google accounts do not work in this window.

The app confirms how many cookies it saved. It also sets 2 connections and skips logout links, so that your login lasts.

The app keeps the login in its private storage, so you never see a file. To delete it, tap "Forget the saved login" in the menu of the login window, or delete the project. "Forget the saved login" also signs you out of all the sites in the browser of the app.

What HTTrack keeps, and what to do next

WinHTTrack and WebHTTrack save the login in the project folder, in a file named after the site, for example example.com.hts. It holds the cookies and the User-Agent of the browser. They also add #httrack-bundle=example.com to the address, so the mirror uses this login. HTTrack sends the login only to this site and its subdomains.

Then start the mirror. In WinHTTrack and WebHTTrack, two settings protect your session:

Treat the .hts file like a password. A person who has it can use your login. Do not share it, and delete it when the copy is done. Also remove #httrack-bundle=... from the project address, because HTTrack stops when this file is missing.

Without the button: export the cookies by hand

Use these steps with an older version of HTTrack, or when the button cannot log in.

Step 1: export the cookies

  1. Log in to the site with your usual browser. If there is a CAPTCHA, solve it. Then open a page that you want to copy, to make sure that you are logged in.
  2. Save the cookies of this site to a cookies file named cookies.txt, in the Netscape format. Use a browser extension:
    • Chrome, Edge or Brave: install the extension "Get cookies.txt LOCALLY". It is open source. It writes the file on your computer and sends nothing to other computers. Open the site, click the extension, and export only the cookies of this site.
    • Firefox: install the extension "cookies.txt" or "Get cookies.txt LOCALLY". Export the cookies of the site in the same way.

Be careful with cookie extensions. An extension that reads your cookies can access all your accounts. An older extension with a similar name, "Get cookies.txt" (without "LOCALLY"), sent the data of its users to a remote server. It was removed from the Chrome Web Store in 2023. Do not install it.

A cookies file is as good as your password. A person who has the file can use your session. Do not share it, and delete it when the copy is done. Also delete cookies.txt.bak, which HTTrack writes next to it. If HTTrack was stopped early, also delete files like cookies.txt.1234.tmp and cookies.txt.bak.1234.tmp.

Most session cookies are marked "HttpOnly" (not readable by scripts). In a cookies file, some tools (curl, yt-dlp) start the lines of these cookies with #HttpOnly_. HTTrack versions newer than 3.50.5 read these lines. Older versions treat them as comments and ignore them, so the login does not work. With an older version, remove #HttpOnly_ from the start of these lines.

Step 2: find the User-Agent of your browser

The User-Agent is the text that tells the site which browser it talks to. Some sites accept a cookie only from the browser that received it. Use the same browser that you logged in with:

Copy the full text, with no change. It starts with Mozilla/5.0.

Step 3: run WinHTTrack or WebHTTrack

Start a new project and type the site address. Then click "Set options":

Or: run httrack on the command line

Instead of the interface, you can use the command line. Give the cookies file with --cookies-file (-%K) and the User-Agent with --user-agent (-F):

httrack https://example.com/members/ -O mysite --cookies-file cookies.txt --user-agent "PASTE-YOUR-USER-AGENT" --sockets=2 "-*logout*" "-*signout*" "-*sign-out*"

Limits