home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 109 / EnigmaAmiga109CD.iso / software / on-line / getallhtml / getallhtml.doc < prev    next >
Text File  |  2000-01-30  |  15KB  |  333 lines

  1. GetAllHTML v0.66ß  Copyright 1998-2000 Christoper S Handley
  2. ===========================================================
  3. Latest News
  4. -----------
  5. If ARexx says the program is faulty, please read my warning below about text
  6. editors.
  7.  
  8. I HAVE CHANGED MY EMAIL ADDRESS *AGAIN*!  Back to my old address!
  9.  
  10. NOTICE!  If you have emailed me but got no reply, it may be because I lost your
  11. only email in a program crash :( .  Please get in touch!
  12.  
  13. Should now work on even more HTML pages due to minor improvements.  Added the
  14. NOBASEINDEX switch.  Minor speed-up, especially for RESUME.  Removed author
  15. info, as was pointless.
  16.  
  17. Introduction
  18. ------------
  19. Have you ever visited a cool web site & wanted to keep a copy of some/all of it,
  20. but it would takes ages to find & download all the respective pages/files?
  21.  
  22. This is the answer!
  23.  
  24. You supply this ARexx script with the start page URL, and a destination
  25. directory (which should be empty), and maybe a few other options - and off it
  26. goes!  Note that it needs HTTPResume v1.3+ to work (get from Aminet).
  27.  
  28. The idea for this came from a PC Java program called PageSucker - sadly it is
  29. over 1Mb in size & buggy (& can't be run on the Amiga, yet!).  Although my
  30. implementation may not have quite as many features, it is does do the job quite
  31. fast, & has relatively low memory overheads.
  32.  
  33. Requirements
  34. ------------
  35.  o HTTPResume v1.3+ (but v1.7 is recommended!)
  36.  
  37.  o An Amiga capable of running ARexx programs
  38.  
  39.  o Libs:Rexxsupport.library
  40.  
  41.  o Modem with TCP/IP stack (like Genesis, Miami, or AmiTCP)
  42.  
  43. Usage
  44. -----
  45. 1.Before running it for the first time you must (text) edit (say using C:ED) it
  46. to know where your copy of HTTPResume is located.  Go to line 19 where it says:
  47.     HTTPResume='Programs:Utils/Comms/HTTPResume'
  48. Alter the file path between the 'quotes' to where you keep HTTPResume, and save.
  49.  
  50. 2.Run your TCP/IP stack (e.g.AmiTCP/Genesis or Miami).
  51.  
  52. 3.Run it from a Shell using:
  53.  
  54.     Sys:RexxC/Rx GetAllHTML arguments
  55.  
  56. Where the arguments are:
  57.  
  58. "URL"/A, "DestDir"/A, NOASK/S, ARC/S, PIC/S, RESUME/S, PAUSE/S, DEPTH=/N/K,
  59. NOBASEINDEX, PORT=/K, BASEURL=/K, BROKELINKS/S
  60.  
  61. Note - The destination dir must be empty of any previous attempt at downloading
  62. that web page (unless using the RESUME switch).  And that both URL & DestDir
  63. *must* be enclosed in "double quotes" - and that the BASEURL must NOT be
  64. surrounded by quotes!
  65.  
  66. *Note* you may have several GetAllHTMLs & HTTPResumes running at the same time
  67. (not on the same URL!), and that if you use the PORT argument then you will need
  68. HTTPResume running first.
  69.  
  70. See the file GetAllHTML_ex.script for an example usage - it will download all of
  71. Squid's on-line artwork (hope he gets a few more sales of his wonderful 'other
  72. world' artwork from this :-).
  73.  
  74. Behaviour
  75. ---------
  76. It's default behaviour is to find all links in each HTML page, and download them
  77. if:
  78.  
  79. -the URL path is a sub-directory of the original URL path; this stops
  80. downloading irrelevant pages on different topics, different servers, etc.., AND
  81.  
  82. -if they are HTML pages (name ends in .html, etc), OR
  83.  
  84. -if not HTML pages then it will ask if the file should be downloaded; if answer
  85. does not begin with an "n" then it does (download).  If the file has the same
  86. suffix as the last positively confirmed download, then 'intelligently' assumes
  87. should download...
  88.  
  89. This behaviour is modified by various switches:
  90.  
  91. RESUME    - Should downloading of pages have been interupted (maybe a crash), run
  92.     GetAllHTML with *exactly* the same options, except with this switch too.
  93.     It will take a while to reach the same place as all previous HTML pages
  94.     must be scanned - and some additional memory usage is incured.
  95.  
  96.      I suggest you don't go on-line until it has reached the previously
  97.     interupted point (it wait for you to press return).
  98.  
  99.     *NOTE* that this mode is flawed due to the way GetAllHTML.rexx works,
  100.     so that it will sometimes think it has reached the previously finished
  101.     point, when it has not in fact.  Still RESUME is very useful!  And an
  102.     AmigaE version would fix this.
  103.  
  104. PIC    - Will identify links to pictures & download them rather than ask.
  105.  
  106. ARC    - Will identify links to archives & download them rather than ask.
  107.  
  108. NOASK    - Do not ask user if should download a file, assume should not.
  109.  
  110. PAUSE   - DO ask user to "press <return>" if we get an empty URL or couldn't
  111.     download a file.  Always asked to by the RESUME function.
  112.  
  113. TERSE    - Only outputs very important text, so it won't report strange URLs,
  114.     failure to download files, non-http links, etc...
  115.  
  116. PORT    - Supplies the ARexx port of a *running* HTTPResume; if supplied then
  117.     does not try to launch HTTPResume from AmigaDOS.  See *Note* below.  If
  118.     no port name is supplied then it sees if the current ARexx port is
  119.     already set to some HTTPResume - if not then an error is generated, else
  120.     it just uses that port.
  121.  
  122. DEPTH    - This allows you to specify how many URL links to follow in sequence;
  123.     i.e.the depth of the search.  DEPTH=2 means download only the links from
  124.     the original page, and so on for DEPTH=3, etc..  See *Note* below.  If
  125.     no number is supplied then the user is asked for a number.
  126.  
  127. NOBASEINDEX - This prevents GetAllHTML from following links to the index of the
  128.     original URL path.  Is useful for web sites which are fairly 'flat'
  129.     (ie.do not have many sub-directories), which also have banners at the
  130.     top of pages to take you straight to the site's main page (which will
  131.     has links you are not interested in).  Probably very rarely needed.
  132.  
  133. BASEURL - This allows you to override the semi-intelligent default, and tell
  134.     GetAllHTML the base URL - that is, what the URL must start with for it
  135.     to even consider downloading it.  This is useful if you wish to download
  136.     from a particular page deep down the directory structure, but which
  137.     references images (or maybe pages) that are further up.
  138.  
  139. BROKENLINKS - This causes attempted downloading of pages that are not
  140.     sub-directories of the original URL.  These will be downloaded to "T:"
  141.     (which is usually "RAM:T") & then deleted.  If download failed then you
  142.     will be told that there was a broken link.  See suggested uses below.
  143.  
  144. *Note* that both DEPTH & PORT must be followed by an equals sign ("=") and then
  145. the data, _without_ any spaces between anything.  This is due to a limitation of
  146. ARexx, for which an AmigaE version would fix.
  147.  
  148. SOLUTIONS TO FREQUENT PROBLEMS
  149. ------------------------------
  150. 1.If ARexx complains there is an error in the GetAllHTML code (when you try to
  151. run it), then it is VERY likely that the problem comes from editing GetAllHTML
  152. in a text editor.
  153.  
  154. Many text editors seem to be EXTREMELY badly coded, so that they can't handle
  155. the very long lines I have in GetAllHTML; they usually end up splitting a line
  156. in 2, or even deleting everything past a certain point on the line...
  157.  
  158. I strongly suggest buying CygnusEd (v3.5 or v4), as this is what I use, and I
  159. have never had any problems with it; it can even load in binary files, and save
  160. them back without loosing anything!
  161.  
  162. Suggested uses
  163. --------------
  164. 1.There's a big web site with lots of pictures/music/archives/information that
  165. interests you.  Depending on what you want, you will need to use the PIC, ARC,
  166. and NOASK switches.
  167.  
  168. For instance, if you are only interested in pictures then use PIC & NOASK.  If
  169. you are only interested in archives then use ARC & NOASK.  If you are interested
  170. in something else than pictures or archives (in addition to the web pages), then
  171. don't use any of those three switches - GetAllHTML will ask you if something
  172. should be downloaded.
  173.  
  174.  
  175. 2.You have your own home-page on the web, and it includes lots of links to other
  176. sites for which take hours to check they are all valid.  Point GetAllHTML at
  177. your web site with the BROKENLINKS switch.  Note it will never try to download a
  178. link twice, even withOUT using RESUME.
  179.  
  180. In fact, if you have your web site in a directory on your HD, then you could
  181. RESUME with that directory as your download directory; this will be MUCH faster
  182. since none of your pages will (or should) be downloaded :-)) .  First time you
  183. try this, do it on a back-up copy to ensure GetAllHTML does not do anything
  184. strange (I won't be held responsible for extra files 'magically' appearing!)..
  185.  
  186.  
  187. 3.I haven't tried this out myself, but it should be really cool:
  188.  
  189. If you have a favourite news page then you can use GetAllHTML to download just
  190. the latest news.  Suggest use NOASK, possibly with PIC if you want pictures too.
  191. You will obviously need to delete (or rename) the main news-page file, to force
  192. GetAllHTML to download the latest index which contains links to the new news.
  193.  
  194. I don't think you need to use RESUME, but...
  195.  
  196.  
  197. Any other ideas?
  198.  
  199. Bugs & other unwelcome features
  200. -------------------------------
  201.  o The RESUME feature *may* cause some files to be missed, but this depends on
  202. how ARexx treats funny characters for variable names.  An AmigaE version would
  203. fix any problems.
  204.  
  205.  o Interpretation of the HTML & URLs is based on observation rather than any
  206. specification of these standards - thus there will probably be rare cases in
  207. which it may misinterpret them; as long as these are reported (along with the
  208. responsible HTML file(s)), fixes will probably be forth coming.
  209.  
  210. But it really seems to work fine for the sites I have tried :-)
  211.  
  212.  o You cannot go above a depth of 42; this is to protect against an ARexx
  213. limitation which will cause problems above a depth of about 45.  An AmigaE
  214. version would fix this.
  215.  
  216. Technical info
  217. --------------
  218. GetAllHTML uses a depth-first tree search, via recursion, and uses the existance of
  219. (downloaded) files as a super-fast (for ARexx!) record of whether a page has
  220. been visited or not.
  221.  
  222. When RESUMEing, existance of files cannot be used to record if a page has been
  223. visited, so an alternate method is used - this is slower, and could fail with
  224. certain combinations of strangely named URLs (very unlikely); a far slower
  225. method would avoid this, but was considered unnecessary.
  226.  
  227. I used the INTERPRET command to do some magic with ARexx to make the arbitarily
  228. long linked-lists (really branches) possible - they were required for storing
  229. what pages have been visited.  Although this method is not very memory efficient
  230. (many duplicate entries of the same URL), it is quite fast - and more
  231. importantly it *works* in ARexx.  I had thought it would be virtually impossible
  232. to make arbitarily extended link-lists in ARexx, but the interpretive nature of
  233. ARexx means you can effectively create ARexx commands on-the-fly.
  234.  
  235. Future
  236. ------
  237. Little development of the *ARexx* version of GetAllHTML is likely - my efforts
  238. are now on the super-fast AmigaE version:  This will vastly speed-up RESUMEing,
  239. use far less memory & CPU usage, and may even give substantial speed-ups to
  240. normal operations as well (as the time between downloading files will be reduced
  241. to almost nothing).  I hope it will eventually support multiple downloads at
  242. once, to minimise the total download time.
  243.  
  244. Do not expect the AmigaE version any time soon, as my work on the base classes
  245. (that it & other programs will use) is taking a long time (too little spare time
  246. to work on them).  Sorry.
  247.  
  248. Note that I do not recommend anyone uses my ARexxComm module (on Aminet), as
  249. since reading the official ARexx docs I realised my module is extremely limited
  250. - although I have plans for a kick-ass replacement.  Hardly started programming
  251. it though.
  252.  
  253. About the Author
  254. ----------------
  255. NOTE MY EMAIL ADDRESS HAS CHANGED *AGAIN*!  Back to my old address!
  256.  
  257. My name is Christopher S Handley, my (permanent) email address is
  258. Chris.S.Handley@BTInternet.com.  You don't really want to know about me do you?
  259.  
  260. Contacting the Author
  261. ---------------------
  262. Email: Chris.S.Handley@BTInternet.com
  263.  
  264. You may still be able to reach me on my old email address
  265. (Chris.S.Handley@Talk21.com) for a while.
  266.  
  267. I am not yet sure about giving my snail mail address to all & sundry - sorry
  268. about that :-(I know how I felt when people did that before I had email access).
  269.  
  270. Thanks to
  271. ---------
  272.  o Andrija Antonijevic for HTTPResume
  273.  
  274.  o the Amiga community for sticking with the Amiga, and continuing to innovate.
  275.   Give your backing to KOSH (originally proposed by Fleecy Moss).
  276.  
  277.  o CU Amiga for becoming the greatest Amiga mag over the last year, before
  278.   passing away.  I did not like AF's Xmas issue at all (and AF didn't appear to
  279.   like my criticism of it either...)
  280.  
  281.  o whoever design the Rexx language - Rexx is great for 'user utilities'.
  282.  
  283. History
  284. -------
  285. v0.66ß (30-01-00) - Updated docs with new email address, warning about text
  286.             editors causing problems, and other small changes.
  287. v0.65ß (16-10-99) - Now searches from "HREF=" not "<A HREF=" which will give
  288.             dramatic improvement on some pages!  Rewrote how "./"s are
  289.             interpreted, which seems to be much better (perfect?).
  290.             Added the NOBASEINDEX switch.  Removed uses of Translate()
  291.             since it was doing nothing - so a small speed-up (esp.for
  292.             RESUME).
  293. v0.64ß (04-04-99) - Put back the 'extra' END that I removed in v0.61 .  Now
  294.             BROKENLINKS will always only try to download external links
  295.             once.  Removed NOENV argument of HTTPResume so proxy
  296.             settings may work.  Minor changes.
  297. v0.63ß (04-04-99) - Removed spurious non-visible ASCII (27) characters that
  298.            caused some text editors to go loopy.
  299. v0.62ß (03-04-99) - Add the BROKENLINKS switch.  Replaced NOPAUSE by PAUSE
  300.            switch.  Now always warns if a file could not be downloaded
  301.            (not just pages).  If you used all the arguments then it
  302.            would miss the last one.
  303. v0.61ß (28-03-99) - Possible fix for RESUME problem done, plus stupidly left an
  304.            extra END where it broke GetAllHTML.
  305. v0.60ß (27-03-99) - First stand-alone Aminet release.  Damn!  There were 3 big
  306.            mistakes...  (a)some files expected as directories,
  307.            (b)local-path expansion was too complex & probably wrong
  308.            (hope right now), (c)implicit InDeX.hTmL files were not
  309.            scanned for files.  Also asked user to press return but
  310.            really wanted a key first!
  311. v0.55ß (14-12-98) - Damn!  All this fast programming has introduced some bugs,
  312.            but they are fixed now; included the "~" interpretation was
  313.            completely wrong (removed), and fixed a long standing bug
  314.            where a URL beginning with a slash was mis-understood.  Also
  315.            added the BASEURL feature which is really useful sometimes.
  316. v0.54ß (12-12-98) - Given I couldn't download the KOSH pages (www.kosh.net), I
  317.            added basic frame support, and fixed a long standing bug
  318.                    where root html pages could appear as empty directories!
  319.            Two more long standing bugs fixed (ARC & PIC switches had
  320.            inverted sense).  Add fix for paths with "~" in, so will
  321.            align path correctly.  Add semi-intelligence so that won't
  322.            ask about downloading a file with the same suffix as the
  323.            last file that was confirmed.  Add the TERSE function.
  324. v0.53ß (10-12-98) - The DEPTH feature now works, added the PORT feature,
  325.            added the NOPAUSE feature.  Fixed long standing bug of NOASK
  326.            not being recognised.  Now removes text in URL after "?"s.
  327. v0.52ß ( 8-12-98) - Basically update documentation ready for it's first Aminet
  328.                    release, for when packaged along with HTTPResume.  Added an
  329.            untested DEPTH feature in the special v0.52aß.
  330. v0.51ß (??-??-98) - Internal speed-up (may be much faster downloading small pages)
  331.                   - minor fix of arguments given to HTTPResume
  332. v0.5ß  (??-??-98) - Initial release to a few people.  No bugs, honest =:)
  333.