Imports System.Net
Imports System.IO
Imports System.Text
Imports System.Text.Regularexpressions
Imports System.Threading
Public Class Form1
Private wReq As HttpWebRequest
Private Regex As Regex
Private Matches, Matches2, Matches3, MatchesIMG As MatchCollection
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.Size = New Size(700, 700)
ImageList1.ImageSize = New Size(60, 60)
CheckForIllegalCrossThreadCalls = False
ListView1.Columns.Add("순위", 100)
ListView1.Columns.Add("제목", 300)
ListView1.Columns.Add("가수", 200)
ListView1.Dock = DockStyle.Fill
ListView1.View = View.Details
'ListView1.SmallImageList = ImageList1
ListView1.FullRowSelect = True
gogogo()
End Sub
Private Function gogogo() As Object
wReq = DirectCast(WebRequest.Create(("http://mnet.interest.me/chart/TOP100/2012110622")), HttpWebRequest)
wReq.Method = "GET"
Dim Html소스 As String = New StreamReader(Me.wReq.GetResponse.GetResponseStream, Encoding.UTF8).ReadToEnd
Dim 정규식1 As New Regex("s=""music"">(.*?)</a>", RegexOptions.IgnoreCase)
Dim 정규식2 As New Regex("""_self"">(.+?)</a> /", RegexOptions.IgnoreCase)
Dim 정규식3 As New Regex("target=""_self""><img src=(.*?) alt="""onerror=", RegexOptions.IgnoreCase)
Dim 정규식4 As New Regex("(.*?)</a>.*?title=""(.*?)""", RegexOptions.IgnoreCase)
Matches = 정규식1.Matches(Html소스)
Matches2 = 정규식2.Matches(Html소스)
MatchesIMG = 정규식3.Matches(Html소스)
' MsgBox(MatchesIMG.Item(5).Groups.Item(1).ToString)
For i As Integer = 0 To 49
wReq = WebRequest.Create(MatchesIMG.Item(i + 2).Groups.Item(1).ToString)
ImageList1.Images.Add(Image.FromStream(wReq.GetResponse.GetResponseStream))
ListView1.Items.Add(i + 1)
ListView1.Items.Item(i).SubItems.Add(Me.Matches.Item((i + 2)).Groups.Item(1).ToString)
Dim a As String = Matches2.Item((i + 2)).Groups.Item(1).ToString
Matches3 = 정규식4.Matches(a)
If (a.Length > 50) Then
Dim 초과1 As String = Me.Matches3.Item(0).Groups.Item(1).ToString
Dim 초과2 As String = Me.Matches3.Item(0).Groups.Item(2).ToString
Me.ListView1.Items.Item(i).SubItems.Add((초과1 & " & " & 초과2))
Else
Me.ListView1.Items.Item(i).SubItems.Add(a)
End If
주소를 http://mnet.interest.me/chart/top100/chart.asp?chartDate= 로 바꾸면 됩니다..
Next
Return vbEmpty
End Function
End Class
'프로그래밍언어 > VB.NET' 카테고리의 다른 글
해상도 및 컬러변경 (0) | 2013.01.24 |
---|---|
2013년 1월 24일 오전 06:21 (0) | 2013.01.24 |
VB6 -> C# 포팅, 네이버 로그인, 네이버 쪽지 전송, 네이버 메일 전송 (0) | 2013.01.24 |
타이머소스 (0) | 2013.01.24 |
VB.NET에서 엑셀 Application객체사용법 (0) | 2013.01.24 |