Ufizy Player
Introduction
I want to start with speaking about www.ufizy.com. First I should say www.ufizy.com is totally legal and it is using legal video websites to search songs. Like youtube.com,dailymotion.com etc... For example Ufizy.com takes link from youtube.com then it uses link with some string procedures. This article is about www.ufizy.com and how can we listen songs from there. Just for a once click www.ufizy.com and write your favorite song then click F! button. And searched list is in your front. So if you see and learn how can you listen songs with www.ufizy.com also you can listen them wtih this program.I used HTMLELEMENT class for all these progresses.Examine code parts please for wide expression.
And if you are a beginner I want to say something else.First open your explorer then navigate it 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 reach it with this id.Also 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 website http://msdn.microsoft.com/en-us/library/system.windows.forms.htmlelement.aspx you can get detailed information about it's methods. HTML elements can have childs you can reach them with Children collection. "GetAttiribute
" and "SetAttiribute
" methods helps 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 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.
This is the most important function which we can get links in searched list from ufizy.com
private void Form1_Load(object sender, EventArgs e) { web.Navigate("http://www.ufizy.com"); //We Should reach Documents of website. lstTag.Dock = DockStyle.Fill; grpUst.Visible = false; lstTag.Items.Add("LUTFEN YÜKLENIRKEN BEKLEYINIZ.."); } //These code parts for Textbox and Search button of this website.And if you examine //these codes you can understand how can you enter your search with C#. foreach (HtmlElement el in web.Document.All) { switch (el.Id) { //innertext means the text which behind of visible website. case "s": el.InnerText = txtSarkiAdi.Text; break; } } foreach (HtmlElement el in web.Document.All) { switch (el.Name) { //InvokeMember() class runs an input's method in website like "dinle". case "dinle": el.InvokeMember("click"); break; } } //The timer will help us to get "href" attiribute of songs in searched list. private void LinkVeTagAl() { HtmlElementCollection tags = web.Document.Links; foreach (HtmlElement item in web.Document.Links) { //Invisible listbox to get important 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)) { //Visible listbox to show users our songs lstTag.Items.Add(tags[i].OuterText); } } for (int i = 0; i < lstilk.Items.Count; i++) { string dnm = lstilk.Items[i].ToString(); // in this php there is a link part like // <a href="http://www.ufizy.com/#1QP-SIW6iKY/r/!/" // style="text-decoration: none; color: rgb(0, 76, 213); ">#1QP-SIW6iKY</a>. // Look bottom to learn how can it help us. if (dnm.Contains("player2.php")) { string[] parcalar = dnm.Split(new Char[] { '=' }, 11); lstLinkler.Items.Add("http://www.ufizy.com/#" + 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 take a 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 another things.WebBrowser component helped us to listen songs^^.I used 2 webbrowser first one for search it's invisible.And second one is the Player.
Post Comment
Fv9qa3 Great, thanks for sharing this blog article. Will read on...