차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판이전 판
다음 판
이전 판
tech:wget [2016/11/01 09:45] V_Ltech:wget [2023/07/23 00:04] (현재) – [사이트 전체 받기] V_L
줄 11: 줄 11:
 wget은 느리거나 불안정한 네트워크 환경에서도 매우 잘 작동하는 견고한 프로그램이다. 네트워크 환경이 불안해서 도중에 연결이 끊겼다면, 연결이 끊긴 시점부터 다운로드 받는 기능도 가지고 있다. wget은 느리거나 불안정한 네트워크 환경에서도 매우 잘 작동하는 견고한 프로그램이다. 네트워크 환경이 불안해서 도중에 연결이 끊겼다면, 연결이 끊긴 시점부터 다운로드 받는 기능도 가지고 있다.
  
-http://coffeenix.net/board_print.php?bd_code=168+  * [[http://coffeenix.net/board_print.php?bd_code=168|도움말]] 
 +  * [[https://www.gnu.org/software/wget/manual/wget.html|GNU Wget 1.18 Manual]] 
 + 
 +[[웹집]]보다 나을 수도 ...
  
   wget -r -nv -nH -N ftp://211.45.156.111/public_html/data/pages -P /var   wget -r -nv -nH -N ftp://211.45.156.111/public_html/data/pages -P /var
줄 17: 줄 20:
   wget -r -nv -nH -N ftp://id:[email protected]/html/data/pages/info.txt -P /home/www   wget -r -nv -nH -N ftp://id:[email protected]/html/data/pages/info.txt -P /home/www
  
 +=====옵션=====
  
- =====사이트 전체 받기=====+ 
 + 
 + 
 +<file> 
 +  --recursive 
 +</file> 
 +Tells wget to recursively download pages, starting from the specified URL. 
 +<file> 
 +  --level=
 +</file> 
 +Tells wget to stop after one level of recursion. This can be changed to download more deeply, or set to 0 that means “no limit” 
 +<file> 
 +  --no-clobber 
 +</file> 
 +Skip downloads that would download to existing files 
 +<file> 
 +  --page-requisites 
 +</file> 
 +Tells wget to download all the resources (images, css, javascript, ...) that are needed for the page to work. 
 +<file> 
 +  --html-extension 
 +</file> 
 +Adds ”.html” extension to downloaded files, with the double purpose of making the browser recognize them as html files and solving naming conflicts for “generated” URLs, when there are no directories with “index.html” but just a framework that responds dynamically with generated pages. 
 +<file> 
 +  --convert-links 
 +</file> 
 +After the download is complete, convert the links in the document to make them suitable for local viewing. This affects not only the visible hyperlinks, but any part of the document that links to external content, such as embedded images, links to style sheets, hyperlinks to non-HTML content, etc. 
 +<file> 
 +  --no-parent 
 +</file> 
 +Do not ever ascend to the parent directory when retrieving recursively. 
 +<file> 
 +  --domains=www.example.com 
 +</file> 
 +Set domains to be followed. DOMAIN-LIST is a comma-separated list of domains. 
 + 
 +Avoiding imposed download limits 
 +Many web servers tend to limit the pages a user can download in a given amount of time, or the user-agents that can access given pages, etc. To avoid such limits, some extra options may be added. 
 + 
 +<file> 
 +  -U "Mozilla/5.0 (X11; U; Linux; en-US; rv:1.9.1.16) Gecko/20110929 Firefox/3.5.16" 
 +</file> 
 +Tells wget to use a fake user-agent, to emulate the one of a web browser (in this case, Firefox 3.5 on Linux) 
 +<file> 
 +  --wait=3 
 +</file> 
 +Tells wget to wait at least 3 seconds between retrievals. 
 +<file> 
 +  --random-wait 
 +</file> 
 +Tells wget to wait a random time between 0 and double the value specified with –wait between requests. 
 + 
 +<file> 
 +  -P prefix 
 +--directory-prefix=prefix 
 +</file> 
 + 
 +Set directory prefix to prefix.  The directory prefix is the 
 +directory where all other files and sub-directories will be 
 +saved to, i.e. the top of the retrieval tree.  The default 
 +is . (the current directory). 
 +=====예제===== 
 + ====사이트 전체 받기====
 [[http://www.linuxjournal.com/content/downloading-entire-web-site-wget|출처]] [[http://www.linuxjournal.com/content/downloading-entire-web-site-wget|출처]]
 <file> <file>
줄 30: 줄 96:
      --domains website.org \      --domains website.org \
      --no-parent \      --no-parent \
 +    --limit-rate=20k \
 +    --referer=125.209.222.141 \
          www.website.org/tutorials/html/          www.website.org/tutorials/html/
 </file> </file>
  
 +  --post-data=string
 +  
 +  
 +<file>
 +   --recursive: download the entire Web site.
 +   --domains website.org: don't follow links outside website.org.
 +   --no-parent: don't follow links outside the directory tutorials/html/.
 +   --page-requisites: get all the elements that compose the page (images, CSS and so on).
 +   --html-extension: save files with the .html extension.
 +   --convert-links: convert links so that they work locally, off-line.
 +   --restrict-file-names=windows: modify filenames so that they will work in Windows as well.
 +   --no-clobber: don't overwrite any existing files (used in case the download is interrupted and resumed).
 +</file> 
 +====사진 받기====
  
 +  wget -r -np --reject "*.txt" http://192.168.0.100/images
  
 +  * -r은 --recursive를 줄인 것. 
 +  * -l (소문자 엘) 옵션을 사용하면 하위폴더의 단계를 정한다. 기본적으로 wget에서는 5단계까지 하위폴더의 모든 파일을 다운로드 함.
 +  * -np라는 옵션은 no-parent. recursive 옵션을 주고 실행할 때 부모 디렉토리의 파일을 다운로드 하지 말라는 뜻.
 +  * 이미지와 텍스트가 포함된 폴더라고 가정하면 --reject 옵션으로 txt 파일을 제외한다. [[http://ngee.tistory.com/376|출처 ngee]]
 +
 +====여러 파일 받기====
 +
 +txt로 받을 파일의 주소(URL)을 한줄에 하나씩 넣은 뒤 '-i' 옵션을 사용하면 된다. 
 +
 +  wget -i halo.txt
 +
 +<file txt halo.txt>
 +http://cdn.p30download.com/?b=p30dl-console&f=Halo.3.ODST.iMARS.DVD1_p30download.com.part1.rar
 +http://cdn.p30download.com/?b=p30dl-console&f=Halo.3.ODST.iMARS.DVD1_p30download.com.part2.rar
 +http://cdn.p30download.com/?b=p30dl-console&f=Halo.3.ODST.iMARS.DVD1_p30download.com.part3.rar
 +http://cdn.p30download.com/?b=p30dl-console&f=Halo.3.ODST.iMARS.DVD1_p30download.com.part4.rar
 +http://cdn.p30download.com/?b=p30dl-console&f=Halo.3.ODST.iMARS.DVD1_p30download.com.part5.rar
 +http://cdn.p30download.com/?b=p30dl-console&f=Halo.3.ODST.iMARS.DVD1_p30download.com.part6.rar
 +http://cdn.p30download.com/?b=p30dl-console&f=Halo.3.ODST.iMARS.DVD1_p30download.com.part7.rar
 +http://cdn.p30download.com/?b=p30dl-console&f=Halo.3.ODST.iMARS.DVD2_p30download.com.part1.rar
 +http://cdn.p30download.com/?b=p30dl-console&f=Halo.3.ODST.iMARS.DVD2_p30download.com.part2.rar
 +http://cdn.p30download.com/?b=p30dl-console&f=Halo.3.ODST.iMARS.DVD2_p30download.com.part3.rar
 +http://cdn.p30download.com/?b=p30dl-console&f=Halo.3.ODST.iMARS.DVD2_p30download.com.part4.rar
 +http://cdn.p30download.com/?b=p30dl-console&f=Halo.3.ODST.iMARS.DVD2_p30download.com.part5.rar
 +http://cdn.p30download.com/?b=p30dl-console&f=Halo.3.ODST.iMARS.DVD2_p30download.com.part6.rar
 +http://cdn.p30download.com/?b=p30dl-console&f=Halo.3.ODST.iMARS.DVD2_p30download.com.part7.rar
 +</file>