{
string baihat
= textBox1
.Text;
WebClient webClient
= new WebClient
(); string link
= "http://mp3.zing.vn/tim-kiem/bai-hat.html?q=" + baihat
;
WebResponse objResponse;
WebRequest objRequest = System.Net.HttpWebRequest.Create(link);
objResponse = objRequest.GetResponse();
StreamReader sr
= new StreamReader
(objResponse
.GetResponseStream()); int stchuyendoitenbai
= html
.IndexOf(@"search_song"" title=" + '"'); int endchuyendoitenbai
= html
.IndexOf(" - "); string chuyendoiten
= html
.Substring(stchuyendoitenbai
+ 20, baihat
.Length);
int start
= html
.IndexOf(@"href=""/bai-hat/"); int end
= html
.IndexOf('"' + ">" + chuyendoiten
+ "</a>"); string laylink
= "http://mp3.zing.vn" + html
.Substring(start
+ 6, end
- start
- 6);
//Getinfo
WebResponse objResponse1;
WebRequest objRequest1 = System.Net.HttpWebRequest.Create(laylink);
objResponse1 = objRequest1.GetResponse();
StreamReader sr1
= new StreamReader
(objResponse1
.GetResponseStream()); string html1
= sr1
.ReadToEnd();
//GetComposer
int start1
= html1
.IndexOf(@"class=""txtBlue"">"); int end1
= html1
.IndexOf(@"</a></a>"); string nhacsi
= html1
.Substring(start1
+16, end1
- (start1
+16)); label3.Text = "Nhạc sĩ : " + nhacsi;
//GetSinger
int start2
= html1
.IndexOf(chuyendoiten
); int end2
= html1
.IndexOf(@"| 320 lyrics"); string casi
= html1
.Substring(start2
+chuyendoiten
.Length+3,end2
-(start2
+chuyendoiten
.Length+3)); label2.Text = "Ca sĩ : " + casi;
//GetNumber
int start3
= html1
.IndexOf("Lượt nghe:"); int end3
= html1
.IndexOf("</p>" + "\n" + " <div class"); string luotnghe
= html1
.Substring(start3
+10,end3
-(start3
+10)); label4.Text = "Lượt nghe : " + luotnghe;
//
label5.Text = "Tên bài nhận từ mp3zing : " + chuyendoiten;
//GetAlbum
int start4
= html1
.IndexOf("Album: <a title=")+1; int end4
= html1
.IndexOf('"'+" href="+'"'+"/album/"); string album
= html1
.Substring(start4
+ 16, end4
- (start4
+ 16)); label6.Text = "Album : " + album;
//Getlink
int start5
= html1
.IndexOf("xmlURL="); int end5
= html1
.IndexOf("&textad"); string xmllink
= html1
.Substring(start5
+7, end5
- (start5
+7)); webBrowser1.Navigate(xmllink);
linkLabel2.Text = LayNhacChatLuongCao(laylink);
//GetText
int start6
= html1
.IndexOf("></span></span>"); int end6
= html1
.IndexOf("</p>"+"\n"+" </div>")-start6
; string loihat
= html1
.Substring(start6, end6
).Replace("<br />",
"") ; }
Ở đây cả này :D