Introduction
I want to start with speaking about www.ufizy.com. First, I should say www.ufizy.com is totally legal and it uses legal video websites to search songs like www.youtube.com, www.dailymotion.com, etc. For example, Ufizy.com takes a link from youtube.com, then it uses the link with some string procedures. This article is about www.ufizy.com and how we can listen to songs from there. ALSO I SHOULD SAY THIS APPLICATION IS ONLY AN INTERFACE FOR UFIZY! Just for once, click www.ufizy.com and write your favorite song, then click F! button. And the searched list is in front of you. So if you see and learn how you can listen to songs with www.ufizy.com, you can listen to them with this program. I used HTMLELEMENT class for all these progresses. Please examine the code parts for wide expression.
And if you are a beginner, I want to say something else. First, open your explorer, then navigate to www.ufizy.com and just right click to this website. And click "View Page Source". You can see a code part like this (<input id = "s" type="text" ...) that means "s" is their textbox's id. We can also reach it with this id. You can see this too (<input name="dinle" type="image"...) and that means our F! button's name is "dinle" and we can reach it with this name.
HTMLELEMENT
First of all, MSDN says:
"HtmlElement represents any possible type of element in an HTML document, such as BODY, TABLE, and FORM, among others. The class exposes the most common properties you can expect to find on all elements."
And at this link, you can get detailed information about its methods. HTML elements can have children, you can reach them with Children collection. "GetAttiribute" and "SetAttiribute" methods help you to set or get any attribute or property on a specific element. "InvokeMember" method provides access to any methods in HTML documents. HTML documents can be modified or can be changed. For this, you can use "CreateElement" method of HtmlDocument.
Using the Code
HTMLELEMENT class is very useful to get tags of a website or login a website and more. First of all, we should use a webbrowser component to enter the website. When this component finishes all load progresses, then we can reach all documents of loaded website. On form load, I did this job with 'web.Navigate(http://www.ufizy.com)' method. Just look at the bottom.
My Functions
First of all, I didn't use arraylists for you to show what is happening at the back. Also functions depend on htmlelement and some stream progresses for a user list.
private void Form1_Load(object sender, EventArgs e)
{
web.Navigate("http://www.ufizy.com"); lstTag.Dock = DockStyle.Fill;
grpUst.Visible = false;
lstTag.Items.Add("LUTFEN YÜKLENIRKEN BEKLEYINIZ..");
}
foreach (HtmlElement el in web.Document.All)
{
switch (el.Id)
{
case "s": el.InnerText = txtSarkiAdi.Text; break;
}
}
foreach (HtmlElement el in web.Document.All)
{
switch (el.Name)
{
case "dinle": el.InvokeMember("click"); break;
}
}
private void btnPlaylist_Click(object sender, EventArgs e) {
if (this.Size == new Size(547, 389) && lstplaylist.Items.Count==0)
{
MessageBox.Show("Kayitli Listeniz Varsa Lütfen Seçiniz."); if (opf.ShowDialog() == DialogResult.OK) {
if (opf.FileName != "" && opf.FileName != null)
{
plylststr.ListeOkuveEkle
(opf.FileName, lstplaylistlinkler, lstplaylist);
playlistyol = opf.FileName;
}
}
this.Size = new Size(547, 560);
}
else if (lstplaylist.Items.Count>0)
{
this.Size = new Size(547, 560);
}
else
{
this.Size = new Size(547, 389);
}
}
private void LinkVeTagAl() {
HtmlElementCollection tags = web.Document.Links;
foreach (HtmlElement item in web.Document.Links)
lstilk.Items.Add(item.GetAttribute("href"));
for (int i = 0; i < web.Document.Links.Count; i++)
{
if (tags[i].OuterText != null && Regex.IsMatch(tags[i].OuterText,
"[0-9]", RegexOptions.IgnoreCase)) lstTag.Items.Add(tags[i].OuterText);
}
for (int i = 0; i < lstilk.Items.Count; i++) {
string dnm = lstilk.Items[i].ToString();
if (dnm.Contains("player2.php")) {
string[] parcalar = dnm.Split(new Char[] { '=' }, 11);
lstLinkler.Items.Add("http://www.ufizy.com/index.php#" +
parcalar[1] + "/r/!/");
}
}
}
First www.ufizy.com gets links from a legal video website like youtube, then it uses links like this http://www.ufizy.com -->First Part /#bAsA00-5KoI/ -->Second r/ -->Third !/ --> and last. So we need # and 11 character from this #. When we search in ufizy.com, then 'player2.php' holds all of these links. We should get it and just clean it up. :)
Other functions are for Playlist or other things. WebBrowser component helps us to listen to songs. I used 2 webbrowsers; the first one for search is invisible and the second one is the Player.
Please examine ufizyplayer.com zip file for the source code.