Files
httrack/html/scripting.html
Xavier Roche 58e8aec88f The doc footer drops the patents chicklet, and two pages escape the check (#1157)
* The doc footer drops the patents chicklet, and two pages escape the check

The shipped doc footer had drifted from httrack.com's: no End Software
Patents chicklet, no <small> around the copyright line so it rendered a
size larger than the site's, and a .5rem top margin holding it off the
panel's black edge. doc.css now takes site.css's .sitefooter shape (flex
row, line-height 1.3, no top margin), with the chicklet at the far end.

The chicklet ships as html/images/esp_chicklet.png and is referenced
relatively rather than by the site's absolute src, since these pages are
read off the install directory where that would be a broken image and an
outbound request from a local page. The link points at the canonical
https://endsoftwarepatents.org/innovating-without-patents/, where the
site's http URL lands after two redirects, and uses target="_blank"
because _new is not a target keyword.

The footer also becomes its own doc-chrome region, as the masthead did in
#1154. It used to sit inside the generated bottom region, which index.html
and guide.html do not have: both build their own sidebar and take the
masthead alone, so their footers were hand-maintained and unchecked.
Corrupting index.html's footer text passes --check on master and fails
after this; a page that loses the markers is reported rather than crashing
the generator.

The year stays hardcoded: --check diffs the regenerated chrome against the
shipped bytes, so computing it would red CI every 1st of January.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>

* Report a malformed chrome region per page instead of aborting the run

A page whose region markers are half-present reached region()'s bare
SystemExit, which named no page and stopped the sweep, so a drift on any
later page went unreported. Catch it per page, print the page, and carry
on. A duplicate marker pair is now rejected too: region() substitutes the
first pair only, so a trailing second one shipped unchecked on any region,
the masthead included.

Also add rel="noopener" to the chicklet link, and reword two comments: the
footer's contrast note no longer claims .8em now that <small> nests inside
it, and doc.css points at site.css's .sitefooter as the shape it mirrors.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>

---------

Signed-off-by: Xavier Roche <roche@httrack.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 11:28:05 +00:00

214 lines
5.9 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<!-- doc-chrome:head -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Driving the httrack command-line program from shell and batch scripts.">
<link rel="stylesheet" href="doc.css">
<script src="doc.js" defer></script>
<!-- /doc-chrome:head -->
<title>Scripting HTTrack</title>
</head>
<body>
<!-- doc-chrome:top -->
<!-- doc-chrome:masthead -->
<a class="skip" href="#main">Skip to content</a>
<header class="masthead">
<img src="images/wordmark.svg" width="400" height="36" alt="HTTrack Website Copier">
<div class="tagline">Free software offline browser</div>
</header>
<!-- /doc-chrome:masthead -->
<div class="wrap">
<nav class="toc" aria-label="Documentation">
<h2>Start here</h2>
<ul>
<li><a href="guide.html">Interface guide</a></li>
<li><a href="faq.html">FAQ and troubleshooting</a></li>
<li><a href="abuse.html">Using HTTrack responsibly</a></li>
</ul>
<h2>Command line</h2>
<ul>
<li><a href="cmdguide.html">Command-line guide</a></li>
<li><a href="httrack.man.html">Option reference</a></li>
<li><a href="filters.html">Filter syntax</a></li>
</ul>
<h2>Developers</h2>
<ul>
<li><a href="dev.html">Programming</a></li>
<li><a href="library.html">libhttrack API</a></li>
<li><a href="plug.html">Callbacks</a></li>
<li><a href="scripting.html" aria-current="page" class="here">Scripting</a></li>
<li><a href="cache.html">Cache format</a></li>
<li><a href="changes.html">Change report format</a></li>
</ul>
<h2>More</h2>
<ul>
<li><a href="fcguide.html">Users Guide (3.10)</a></li>
<li><a href="contact.html">Contact and credits</a></li>
<li><a href="index.html">All documentation</a></li>
</ul>
</nav>
<main id="main">
<!-- /doc-chrome:top -->
<h1>HTTrack Programming page - scripting</h1>
<br>
We will see here several examples, written in batch script (can be adapted to almost all batch script languages) or in C.
<br><br>
<br><br>
<table width="100%" border="0" background="img/fade.gif">
<tr><td>
<b>How to get one single file</b><br><br>
<tt>
httrack --get http://localhost/
</tt>
</td></tr>
</table>
<br><br>
<table width="100%" border="0" background="img/fade.gif">
<tr><td>
<b>How to get one single file and pipe it to stdout</b><br><br>
<tt>
httrack --quiet --get http://localhost/ -O tmpget -V "cat \$0" | grep -iE "TITLE"
rm -rf tmpget
</tt>
</td></tr>
</table>
<br><br>
<table width="100%" border="0" background="img/fade.gif">
<tr><td>
<b>How to search in all HTML files on a website</b><br><br>
<tt>
httrack --skeleton http://localhost/ -V "if grep -iE \"TITLE\" \"\$0\">/dev/null; then echo \"Match found at \$0\"; fi"<br>
rm -rf tmpget<br>
</tt>
<br>Same thing but matches only the first file:<br>
<tt>
httrack --skeleton http://localhost/ -V "if grep -iE \"TITLE\" \"\$0\">/dev/null; then echo \"Match found at \$0\"; kill -9 \$PPID; fi"<br>
rm -rf tmpget<br>
</tt>
</td></tr>
</table>
<br><br>
<table width="100%" border="0" background="img/fade.gif">
<tr><td>
<b>Indexing a website, and using the index as a search engine</b><br><br>
<tt>httrack localhost -%I</tt><br>
Will generate an index.txt file, which contains all detected keywords, sorted and indexed using this format:<br>
<br>
<table border="0" bgcolor="white"><tr><td>
<i>keyword</i><br>
&lt;tab&gt; &nbsp; <i>number_of_hits_in_current_page_for_this_keyword</i> &nbsp; <i>page_location</i><br>
&lt;tab&gt; &nbsp; <i>number_of_hits_in_current_page_for_this_keyword</i> &nbsp; <i>page_location</i><br>
&lt;tab&gt; &nbsp; <i>number_of_hits_in_current_page_for_this_keyword</i> &nbsp; <i>page_location</i><br>
...<br>
=<i>total_number_of_hits_for_this_keyword</i><br>
(<i>(total_number_of_hits_for_this_keyword*1000)/total_number_of_keywords</i>)<br>
</td></tr></table>
<br>
Example:
<table border="0" bgcolor="white"><tr><td>
<pre>
abilities
1 localhost/manual/mod/index-2.html
1 localhost/manual/mod/index.html
1 localhost/manual/mod/mod_negotiation.html
=3
(0)
ability
2 localhost/manual/misc/FAQ.html
2 localhost/manual/suexec.html
1 localhost/manual/handler.html
1 localhost/manual/misc/security_tips.html
1 localhost/manual/mod/mod_rewrite.html
1 localhost/manual/mod/mod_setenvif.html
1 localhost/manual/multilogs.html
1 localhost/manual/netware.html
1 localhost/manual/new_features_1_3.html
1 localhost/manual/windows.html
=12
(0)
able
4 localhost/manual/dso.html
4 localhost/manual/mod/core.html
3 localhost/manual/dns-caveats.html
3 localhost/manual/mod/mod_auth.html
3 localhost/manual/mod/mod_rewrite.html
3 localhost/manual/upgrading_to_1_3.html
2 localhost/manual/misc/API.html
2 localhost/manual/misc/FAQ.html
2 localhost/manual/misc/windoz_keepalive.html
2 localhost/manual/mod/mod_auth_db.html
2 localhost/manual/mod/mod_auth_dbm.html
1 localhost/manual/misc/descriptors.html
1 localhost/manual/misc/fin_wait_2.html
1 localhost/manual/misc/security_tips.html
1 localhost/manual/mod/mod_auth_digest.html
1 localhost/manual/mod/mod_cern_meta.html
1 localhost/manual/mod/mod_env.html
1 localhost/manual/mod/mod_example.html
1 localhost/manual/mod/mod_unique_id.html
1 localhost/manual/mod/mod_usertrack.html
1 localhost/manual/stopping.html
1 localhost/manual/suexec.html
1 localhost/manual/vhosts/ip-based.html
1 localhost/manual/windows.html
=43
(0)
</pre>
...
</td></tr></table>
<br>
Script example:
<a href="div/search.sh">search.sh</a>
</td></tr>
</table>
<br><br>
<!-- doc-chrome:bottom -->
</main>
</div>
<dialog id="zoom" aria-label="Enlarged image"><img src="" alt=""></dialog>
<!-- /doc-chrome:bottom -->
<!-- doc-chrome:footer -->
<footer>
<small>&copy; 1998-2026 Xavier Roche &amp; other contributors - Web Design: Leto Kauler.</small>
<a href="https://endsoftwarepatents.org/innovating-without-patents/" target="_blank" rel="noopener" title="This site is innovating without patents!"><img src="images/esp_chicklet.png" width="91" height="17" alt="End Software Patents"></a>
</footer>
<!-- /doc-chrome:footer -->
</body>
</html>