private static void ShowPirateBay() { Console.WriteLine("<style>"); Console.WriteLine("img { border: 0; }"); //Console.WriteLine("ol { -moz-column-count: 2; }"); Console.WriteLine(@" embed { width: 100%; height: 100%; position: absolute; left: 0; top: 0; z-index: 0; } ol { display: block; width: 100%; height: 100%; position: absolute; left: 0; top: 0; z-index: 1; overflow: scroll; } li { color: white; cursor:hand; } body{ text-align: center; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:.7em; margin: 10px; color: #fff; background: #fff; min-width: 520px; overflow: hidden; } a{ color: #009; text-decoration: none; border-bottom: 1px dotted #4040D9; } a:hover{ text-decoration: none; border-bottom: 1px solid #009; } li { text-align: left; margin: 1em;} "); Console.WriteLine("</style>"); var DefaultLink = new { Link = "", Title = "", Text = "" }; var DefaultImage = new { Source = "", Alt = "", Title = "" }; var ParseLink = DefaultLink.ToAnonymousConstructor( (string element) => { var Link = ""; var Title = ""; var Text = ""; element. ParseAttribute("href", value => Link = value). ParseAttribute("title", value => Title = value). ParseContent(value => Text = value). Parse(); return new { Link, Title, Text }; } ); var ParseImage = DefaultImage.ToAnonymousConstructor( (string element) => { var Source = ""; var Alt = ""; var Title = ""; element. ParseAttribute("src", value => Source = value). ParseAttribute("alt", value => Alt = value). ParseAttribute("title", value => Title = value). ParseContent(null). Parse(); return new { Source, Alt, Title }; } ); var crawler = new BasicWebCrawler("thepiratebay.org", 80); var search = new BasicPirateBaySearch(crawler); crawler.AllHeadersReceived += delegate { Native.API.set_time_limit(10); }; search.Loaded += ForEachEntry => { //Console.WriteLine("<hr />"); //var logo = "http://static.thepiratebay.org/img/tpblogo_sm_ny.gif"; //Console.WriteLine(logo.ToImage().ToLink("http://tineye.com/search?url=" + logo)); // http://code.google.com/apis/youtube/chromeless_example_1.html Console.WriteLine("<embed wmode='transparent' id='tv' src='http://www.youtube.com/apiplayer?enablejsapi=1&playerapiid=tv' allowScriptAccess='always' width='400' height='300' />"); //Console.WriteLine("<h2>Top Movies</h2>"); Console.WriteLine("<ol>"); ForEachEntry( (entry, entryindex) => { //if (entryindex > 2) // return; var Type = ParseLink(entry.Type); var Name = ParseLink(entry.Name); var SmartName = new BasicFileNameParser(Name.Text); var c = new BasicGoogleVideoCrawler(); var Video = ""; var VideoSource = ""; c.VideoSourceFound += (video, src) => { Video = video; VideoSource = src; }; Native.API.set_time_limit(6); //Thread.Sleep(1500); c.Search(SmartName.Title + " trailer"); Console.WriteLine("<li onmouseover='if (getElementById(\"tv\").getPlayerState() != 1) getElementById(\"tv\").loadVideoById(\"" + Video + "\")'>"); Console.WriteLine("<b>" + SmartName.Title.ToLink(k => "http://www.imdb.com/find?s=tt;site=aka;q=" + k) + "</b>"); if (!string.IsNullOrEmpty(SmartName.Season)) { Console.WriteLine(" | Season <i>" + SmartName.Season + "</i>"); } if (!string.IsNullOrEmpty(SmartName.Episode)) { Console.WriteLine(" | Episode <i>" + SmartName.Episode + "</i>"); } if (!string.IsNullOrEmpty(SmartName.SubTitle)) { Console.WriteLine(" | <b>" + SmartName.SubTitle + "</b>"); } if (!string.IsNullOrEmpty(SmartName.Year)) { Console.WriteLine(" | <i>" + SmartName.Year + "</i>"); } Console.WriteLine(" | "); Console.WriteLine("<b>"); Console.WriteLine("trailer".ToLink(VideoSource, Video)); Console.WriteLine("</b>"); Console.WriteLine("<br />"); Console.WriteLine("<small>"); Console.WriteLine(SmartName.ColoredText.ToString().ToLink("http://thepiratebay.org" + Name.Link) + "<br />"); Console.WriteLine(Type.Text.ToLink("http://thepiratebay.org" + Type.Link)); entry.Links.ParseElements( (tag, index, element) => { if (tag == "a") { var a = ParseLink(element); Console.WriteLine(" | " + "torrent".ToLink(a.Link)); } if (tag == "img") { var img = ParseImage(element); if (img.Title.Contains("comment")) { Console.WriteLine(" | " + img.Title.ToLink("http://thepiratebay.org" + Name.Link)); } else { Console.WriteLine(" | " + img.Title); } } } ); Console.WriteLine(" | " + entry.Size); Console.WriteLine(" | " + entry.Seeders); Console.WriteLine(" | " + entry.Leechers + "<br />"); Console.WriteLine("</small>"); //Console.WriteLine("</div>"); Console.WriteLine("</li>"); } ); Console.WriteLine("</ol>"); }; crawler.Crawl("/top/200"); }