Added lot of junk laying around on harvie.cz
[mirrors/Programs.git] / php / skripty / wmvbot.php
diff --git a/php/skripty/wmvbot.php b/php/skripty/wmvbot.php
new file mode 100644 (file)
index 0000000..a6e706e
--- /dev/null
@@ -0,0 +1,78 @@
+<?php\r
+//Jyxo seek\r
+//<-Harvie (2oo7)\r
+\r
+function url_bot($url) {\r
+  $file = file($url);\r
+  $file = implode("\n", $file);\r
+  $file = spliti("http://", $file);\r
+  //print_r($file);\r
+  $urls[-1] = "";\r
+  $i = 0;\r
+  foreach($file as $url) {\r
+    $url = split(">| ", $url);\r
+    //print_r($url);\r
+    $url = $url[0];\r
+    if(eregi(".com", $url)) {\r
+      $urls[$i] = "http://".$url;\r
+      $i++;\r
+    }\r
+  }\r
+  //print_r($urls);\r
+  return($urls);\r
+}\r
+\r
+function wmv_bot($url, $ext) {\r
+  foreach(url_bot($url) as $url) {\r
+    $file = file($url);\r
+    $file[-1] = "";\r
+  $file = implode("\n", $file);\r
+  $file = spliti("http://", $file);\r
+  //print_r($file);\r
+  $urlz[-1] = "";\r
+  $i = 0;\r
+  foreach($file as $url) {\r
+    $url = explode(">", $url);\r
+    $url = $url[0];\r
+    if(eregi(".com", $url) && eregi($ext, $url) && !eregi(" |\"", $url)) {\r
+      $urlz[$i] = "http://".$url;\r
+      $i++;\r
+    }\r
+  }\r
+  print_r($urlz);\r
+  }\r
+  return($urlz);\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 = wmv_bot("http://www.loliti.com/cz/m/bonde19e_s_vodou_0.php", ".wmv");\r
+print_r($results);\r
+//download_url_array($results, "X:\\wmvBot"); //Automatic Download\r
+\r
+?>\r
This page took 0.122483 seconds and 4 git commands to generate.