Subversion Repositories yt_downloader

Compare Revisions

Regard whitespace Rev 18 → Rev 19

/trunk/youtube_functions.inc.phps
1,7 → 1,7
<?php
 
// ViaThinkSoft YouTube Downloader Functions 2.3
// Revision: 2022-02-06
// Revision: 2022-12-19
// Author: Daniel Marschall <www.daniel-marschall.de>
// Licensed under the terms of the Apache 2.0 License
 
241,6 → 241,8
// <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.2
// Revision: 2022-09-21
// ViaThinkSoft YouTube Downloader Util 2.3.3
// Revision: 2022-12-19
// Author: Daniel Marschall <www.daniel-marschall.de>
// Licensed under the terms of the Apache 2.0 License
//
191,9 → 191,13
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");
}
}
}
 
// ------------------------------------------------------------------------------------------------
 
324,9 → 328,13
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);
}
 
370,6 → 378,8
$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;
}
388,6 → 398,8
// 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;
}
433,6 → 445,8
$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;
}
888,7 → 902,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 ".($m[1]+1)." time(s) with type $type", $cont);
"Video ID $video_id failed ".(((int)$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);