diff --git a/dl.php b/dl.php index a2d72f5..ce7b8ae 100644 --- a/dl.php +++ b/dl.php @@ -198,34 +198,34 @@ function zippy_fetch_dl($zippy_page_url, $folder_path, $file_index, $dl_response } } - function zippy_batch_dl($gh_zippy_links, $gh_folder_names, $gh_parent_folder = 'GH_DL', $start_folder = 0, $end_folder = 'end', $start_link = 0, $end_link = 'end', $dl_response_time=0, $dl_timeout=0, $sleep_between=2, $dl_fetch_delay=1, $overwrite=0) + function zippy_batch_dl($zippy_links, $folder_names, $parent_folder = 'DL', $start_folder = 0, $end_folder = 'end', $start_link = 0, $end_link = 'end', $dl_response_time=0, $dl_timeout=0, $sleep_between=2, $dl_fetch_delay=1, $overwrite=0) { - $folder_paths = $gh_folder_names; - array_walk($folder_paths, function(&$value, $key, $gh_parent_folder) {$value = "$gh_parent_folder\\$key.$value";}, $gh_parent_folder); + $folder_paths = $folder_names; + array_walk($folder_paths, function(&$value, $key, $parent_folder) {$value = "$parent_folder\\$key.$value";}, $parent_folder); create_folders($folder_paths); - $folder_end = $end_folder === 'end' ? count($gh_folder_names) - 1 : $end_folder; + $folder_end = $end_folder === 'end' ? count($folder_names) - 1 : $end_folder; $datetime = new DateTime(); $datetime = $datetime->format('d-m-Y H:i:s (P \U\T\C)'); - file_put_contents("$gh_parent_folder\\log.txt", "Session started: $datetime
\r\n", FILE_APPEND); - if (!(file_exists("$gh_parent_folder\\log.php"))) + file_put_contents("$parent_folder\\log.txt", "Session started: $datetime
\r\n", FILE_APPEND); + if (!(file_exists("$parent_folder\\log.php"))) { - $log_php = "\r\n\r\nGH DL Log\r\n\r\n\r\n\r\n"; - file_put_contents("$gh_parent_folder\\log.php", $log_php); + $log_php = "\r\n\r\nDL Log\r\n\r\n\r\n\r\n"; + file_put_contents("$parent_folder\\log.php", $log_php); } for ($i = $start_folder; $i <= $folder_end; $i++) { - $link_end = $end_link === 'end' ? count($gh_zippy_links[$gh_folder_names[$i]]) - 1 : $end_link; + $link_end = $end_link === 'end' ? count($zippy_links[$folder_names[$i]]) - 1 : $end_link; for ($j = $start_link; $j <= $link_end; $j++) { - file_put_contents("$gh_parent_folder\\log.txt", "zippy_fetch_dl({$gh_zippy_links[$gh_folder_names[$i]][$j]}, {$folder_paths[$i]}, $j, $dl_response_time, $dl_timeout, $dl_fetch_delay, ".(string)$overwrite.")
\r\n", FILE_APPEND); - $result = zippy_fetch_dl($gh_zippy_links[$gh_folder_names[$i]][$j], $folder_paths[$i], $j, $dl_response_time, $dl_timeout, $dl_fetch_delay, $overwrite); - file_put_contents("$gh_parent_folder\\log.txt", $result, FILE_APPEND); + file_put_contents("$parent_folder\\log.txt", "zippy_fetch_dl({$zippy_links[$folder_names[$i]][$j]}, {$folder_paths[$i]}, $j, $dl_response_time, $dl_timeout, $dl_fetch_delay, ".(string)$overwrite.")
\r\n", FILE_APPEND); + $result = zippy_fetch_dl($zippy_links[$folder_names[$i]][$j], $folder_paths[$i], $j, $dl_response_time, $dl_timeout, $dl_fetch_delay, $overwrite); + file_put_contents("$parent_folder\\log.txt", $result, FILE_APPEND); sleep($sleep_between); } } } - $gh_parent_folder = 'GH_DL'; + $parent_folder = 'GH_DL'; $start_folder = 0; $end_folder = 'end'; @@ -233,7 +233,7 @@ function zippy_batch_dl($gh_zippy_links, $gh_folder_names, $gh_parent_folder = ' $start_link = 0; $end_link = 'end'; - zippy_batch_dl($gh_zippy_links, $gh_folder_names, $gh_parent_folder, $start_folder, $end_folder, $start_link, $end_link); + zippy_batch_dl($zippy_links, $folder_names, $parent_folder, $start_folder, $end_folder, $start_link, $end_link); //to-do maybe: //add server to the file name diff --git a/file_list.php b/file_list.php index b7b0369..addfc91 100644 --- a/file_list.php +++ b/file_list.php @@ -21,33 +21,33 @@ function fix_bad_path_names($path) return str_replace($bad, '', $path); } - $gh_file = file_get_contents('GH_example.html'); //fetching a bunch of links and folders from a random site (only for testing purposes) + $file = file_get_contents('GH_example.html'); //fetching a bunch of links and folders from a random site (only for testing purposes) - preg_match_all('/([^\n<]+)<\/span>/i', $gh_file, $gh_folder_names); - $gh_folder_names = array_map('fix_bad_path_names',$gh_folder_names[1]); + preg_match_all('/([^\n<]+)<\/span>/i', $file, $folder_names); + $folder_names = array_map('fix_bad_path_names',$folder_names[1]); $table_delimiter = 'GH Zippyshare links:"; - print_r2($gh_zippy_links); + print_r2($zippy_links); ?> \ No newline at end of file