--- /dev/null
+<?php\r
+//Jyxo seek\r
+//<-Harvie (2oo7)\r
+/*\r
+Tento skript vam umozni vyhledavat a automaticky stahovat\r
+multimedialni obsah parsovanim z vyhledavaciho enginu jyxo.cz.\r
+*/\r
+\r
+function url2filename($url) {\r
+ $url = explode("/", $url);\r
+ return $url[(sizeof($url)-1)];\r
+}\r
+//die(url2filename("http://johnys-pages.wbs.cz/03_-_Bob_Marley_-_No_woman_no_cry.mp3")); //Debug\r
+\r
+function jyxo_bot($q="",$d="mm",$ereg=".",$notereg="",$cnt=10000000000000,$page=1,$pmax=2,$o="nocls") {\r
+\r
+ $i = 0;\r
+ $results = "";\r
+ $results[$i] = "";\r
+ //$q = str_replace(" ", "+", $q);\r
+ $q = urlencode($q);\r
+ for(;$page<=$pmax;$page++) {\r
+ $request = ("http://jyxo.cz/s?q=$q&d=$d&o=$o&cnt=$cnt&page=$page");\r
+ $fp = fopen($request, "r") or die(" !!! Cannot connect !!!");\r
+ while(!feof($fp)) {\r
+ $line = fgets($fp);\r
+ if(eregi("<div class='r'>", $line) && ereg(" class=ri", $line)) {\r
+ $line = explode("<!--m--><div class='r'><A HREF=\"", $line);\r
+ $line = $line[1];\r
+ $line = explode("\" class=ri", $line);\r
+ $line = trim($line[0]);\r
+ $line = urldecode($line);\r
+ \r
+ if(@eregi($ereg, $line) && !@eregi($notereg, $line) && !in_array($line, $results)) {\r
+ echo("$line\n"); //Output\r
+ //echo("$i:$line\n"); //Indexed Output\r
+ //echo("<a href=\"$line\">$line</a><br />\n"); //XHTML Output\r
+ $results[$i] = $line;\r
+ $i++;\r
+ }\r
+ \r
+ }\r
+ }\r
+ fclose($fp);\r
+ }\r
+ echo("\nTotal: $i\n"); //Sumary Output\r
+ return $results;\r
+}\r
+\r
+//\r
+function download_url_array($results, $download_dir) {\r
+ //$download_dir = $GLOBALS["download_dir"];\r
+ $fails = 0; $done = 0;\r
+ echo("\nDownloading to $download_dir ...\n");\r
+ if(!is_dir($download_dir)) {\r
+ echo("Creating directory: $download_dir\n\n");\r
+ mkdir($download_dir);\r
+ } else { echo("\n"); }\r
+ foreach($results as $id => $url) {\r
+ $file = url2filename($url);\r
+ echo("Downloading $file (#$id)... ");\r
+ $file = "$download_dir\\$file";\r
+ if(!is_file($file) && @copy($url, $file)) {\r
+ echo("Done.\n");\r
+ $done++;\r
+ } else {\r
+ if(is_file($file)) { echo("File already exists "); }\r
+ echo("Failed!\n");\r
+ $fails++;\r
+ }\r
+ }\r
+ $totaldls = ($fails+$done);\r
+ echo("\n$done/$totaldls files successfully downloaded to $download_dir ($fails failed)\n");\r
+}\r
+\r
+///CODE//////////////////////////////////////////////////////////////////////////////////////\r
+$results = jyxo_bot("xavier baumaxa","mm","(.mp3|.ogg)",""); //Text2Search\r
+//print_r($results); //Array Output\r
+//var_dump($results); //Detail debug output\r
+//download_url_array($results, "X:\\JyxoBot"); //Automatic Download\r
+\r
+?>\r