[c#]네이버 html 다운로드 받기 [콘솔]
반응형
네이버 html을 c#으로 html을 다운로드 받아보겠습니다.. WebClient만 알면 쉽게 만들어 볼 수 있습니다.
소스코드
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Net; namespace NaverHtml { class NaverHtml { static void Main(string[] args) { WebClient z = new WebClient(); z.Encoding = Encoding.UTF8; z.DownloadStringAsync(new Uri("http://www.naver.com")); z.DownloadStringCompleted += DownloadStringCompleted; while (true) { } } private static void DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { Console.WriteLine(e.Result); } } }
콘솔창에서 출력되는 네이버 html
네이버의 html들이 콘솔창에 출력되는걸 확인 할 수 있습니다. 이를 이용하면 파싱하는데 사용 할 수 있습니다.
반응형
'프로그래밍 > C#' 카테고리의 다른 글
c# 돋보기 프로그램 [윈폼] (0) | 2020.07.29 |
---|---|
C# 강좌 5-2.c# 자료형(2)C# 자료형과 리터럴 (0) | 2020.07.26 |
C# 강좌 5-1.C# 자료형(1)C# 자료형의 종류와 크기 (0) | 2020.07.25 |
C# 강좌 4.C# 변수에 대해서 (1) | 2020.07.23 |
C# 강좌 3.C# 기본 규칙(주석, 예약어, 식별자) (0) | 2020.07.23 |