using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace GetNhac320NCT
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Chilkat.SshTunnel tunnel = new Chilkat.SshTunnel();
Chilkat.HttpRequest req = new Chilkat.HttpRequest();
Chilkat.Http http = new Chilkat.Http();
Chilkat.Global chilkatGob = new Chilkat.Global();
string codeHTML, codeHTML2;
private void button1_Click(object sender, EventArgs e)
{
bool success = chilkatGob.UnlockBundle("Key bạn phải mua hoặc dùng key dùng thử trên mạng");
if (success != true)
{
MessageBox.Show("Error Unlock");
}
// Dùng hàm get HTML của Link nhaccuatui về
string getHTML = http.QuickGetStr(txtURL.Text);
// cắt token nhaccuatui
string pattern = "\"nofollow\" key=\"(.+?)\">Tải Nhạc 320 Kbps</a>";
Regex myRegex = new Regex(pattern);
Match m = myRegex.Match(getHTML);
for (int i = 0; m.Groups[i].Value != ""; i++)
{
codeHTML = m.Groups[i].Value;
}
string getHTML2 = http.QuickGetStr("http://www.nhaccuatui.com/download/song/" + codeHTML);
rtboutput1.Text = getHTML2;
string pattern1 = "{\"error_message\":\"Success\",\"data\":{\"stream_url\":\"(.+?)\",\"is_charge\":\"false\"},\"error_code\":0,\"STATUS_READ_MODE\":true}";
Regex myRegex1 = new Regex(pattern1);
Match m1 = myRegex1.Match(getHTML2);
for (int i = 0; m1.Groups[i].Value != ""; i++)
{
codeHTML2 = m1.Groups[i].Value;
}
// show URL download nhaccuatui
rtboutput1.Text = codeHTML2;
// Tải nhạc về bằng chrome
Process.Start("chrome.exe", codeHTML2);
}
}
}