Subversion Repositories yt_downloader

Compare Revisions

Regard whitespace Rev 19 → Rev 18

/trunk/youtube_functions.inc.phps
1,7 → 1,7
<?php
 
// ViaThinkSoft YouTube Downloader Functions 2.3
// Revision: 2022-12-19
// Revision: 2022-02-06
// Author: Daniel Marschall <www.daniel-marschall.de>
// Licensed under the terms of the Apache 2.0 License
 
241,8 → 241,6
// <link rel="canonical" href="https://www.youtube.com/channel/UCp4LfMtDfoa29kTlLnqQ5Mg">
// https://www.youtube.com/impaulsive
// <link rel="canonical" href="https://www.youtube.com/channel/UCGeBogGDZ9W3dsGx-mWQGJA">
// https://www.youtube.com/@KosmonautMusicSpecials
// <link rel="canonical" href="https://www.youtube.com/channel/UCayYOQ0DEIpcTgO9z_b-K1A">
 
$cont = @file_get_contents($custom_url);
if ($cont === false) {
/trunk/ytdwn
1,8 → 1,8
#!/usr/bin/php
<?php
 
// ViaThinkSoft YouTube Downloader Util 2.3.3
// Revision: 2022-12-19
// ViaThinkSoft YouTube Downloader Util 2.3.2
// Revision: 2022-09-21
// Author: Daniel Marschall <www.daniel-marschall.de>
// Licensed under the terms of the Apache 2.0 License
//
191,13 → 191,9
fwrite(STDERR, "Invalid resource '$resource' (you are missing the prefix, e.g. vurl: or vid:). Skipping.\n");
} else {
list($resourceType, $resourceValue) = explode(':', $resource, 2);
try {
ytdwn_handle_resource($resourceType, $resourceValue);
} catch(Exception $e) {
fwrite(STDERR, "Error at '$resourceType:$resourceValue': ".$e->getMessage()."\n");
}
}
}
 
// ------------------------------------------------------------------------------------------------
 
328,13 → 324,9
fwrite(STDERR, "Invalid resource '$line' (you are missing the prefix, e.g. vurl: or vid:). Skipping.\n");
} else {
list($resourceType, $resourceValue) = explode(':',$line,2);
try {
ytdwn_handle_resource($resourceType, $resourceValue);
} catch(Exception $e) {
fwrite(STDERR, "Error at line '$line': ".$e->getMessage()."\n");
}
}
}
array_pop($listFilenameStack);
}
 
378,8 → 370,6
$out[$key]['results'] = yt_channel_items($channel_id);
}
if (!$out[$key]['results']) {
// TODO: If a channel has deleted all videos, then this message comes.
// However, technically this is not an error.
fwrite(STDERR, "Cannot get result for channel with ID '$channel_id'\n");
return;
}
398,8 → 388,6
// Now download
 
if (!$out[$key]['results']) {
// TODO: If a channel has deleted all videos, then this message comes.
// However, technically this is not an error.
fwrite(STDERR, "Cannot get result for channel with ID '$channel_id'\n");
return;
}
445,8 → 433,6
$out[$key]['count'] = $videocount;
$out[$key]['results'] = yt_playlist_items($playlist_id);
if (!$out[$key]['results']) {
// TODO: If a playlist has deleted all videos, then this message comes.
// However, technically this is not an error.
fwrite(STDERR, "Cannot get result for playlist with ID '$playlist_id'\n");
return;
}
902,7 → 888,7
$m = null;
if (preg_match("@Video ID ".preg_quote($video_id,'@')." failed (\d+) time\(s\) with type ".preg_quote($type,'@')."@ismU", $cont, $m)) {
$cont = preg_replace("@Video ID ".preg_quote($video_id,'@')." failed (\d+) time\(s\) with type ".preg_quote($type,'@')."@ismU",
"Video ID $video_id failed ".(((int)$m[1])+1)." time(s) with type $type", $cont);
"Video ID $video_id failed ".($m[1]+1)." time(s) with type $type", $cont);
file_put_contents($file, $cont);
} else {
file_put_contents($file, "Video ID $video_id failed 1 time(s) with type $type\n", FILE_APPEND);