Subversion Repositories yt_downloader

Rev

Rev 7 | Rev 10 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7 Rev 8
Line 1... Line 1...
1
#!/usr/bin/php
1
#!/usr/bin/php
2
<?php
2
<?php
3
 
3
 
4
// ViaThinkSoft YouTube Downloader Util 2.2
4
// ViaThinkSoft YouTube Downloader Util 2.2
5
// Revision: 2021-05-09
5
// Revision: 2021-07-15
6
// Author: Daniel Marschall <www.daniel-marschall.de>
6
// Author: Daniel Marschall <www.daniel-marschall.de>
7
// Licensed under the terms of the Apache 2.0 License
7
// Licensed under the terms of the Apache 2.0 License
8
//
8
//
9
// For syntax and other documentation, please read the file README.
9
// For syntax and other documentation, please read the file README.
10
 
10
 
Line 268... Line 268...
268
		$search = parse_quoting($search);
268
		$search = parse_quoting($search);
269
 
269
 
270
		$channel_url = parse_quoting($channel_url);
270
		$channel_url = parse_quoting($channel_url);
271
		$channel_id = curl_to_cid($channel_url);
271
		$channel_id = curl_to_cid($channel_url);
272
		if (!$channel_id) {
272
		if (!$channel_id) {
273
			fwrite(STDERR, "URL $channel_url is a valid YouTube channel oder username URL. Skipping\n");
273
			fwrite(STDERR, "URL $channel_url is a valid YouTube channel or username URL. Skipping\n");
274
		} else {
274
		} else {
275
			ytdwn_channel_id($channel_id, $search);
275
			ytdwn_channel_id($channel_id, $search);
276
		}
276
		}
277
	} else if ($resourceType == 'search') {
277
	} else if ($resourceType == 'search') {
278
		$searchterm = parse_quoting($resourceValue);
278
		$searchterm = parse_quoting($resourceValue);
Line 589... Line 589...
589
	return $allok;
589
	return $allok;
590
}
590
}
591
 
591
 
592
function curl_to_cid($channel_url) {
592
function curl_to_cid($channel_url) {
593
	$m = null;
593
	$m = null;
594
	if (preg_match("@https{0,1}://(www\\.|)youtube\\.com/user/(.*)(&|\\?)@ismU", $channel_url.'&', $m)) {
594
	if (preg_match("@https{0,1}://(www\\.|)youtube\\.com/user/(.*)(/|&|\\?)@ismU", $channel_url.'&', $m)) {
595
		$username = $m[2];
595
		$username = $m[2];
596
		$channel_id = yt_get_channel_id($username);
596
		$channel_id = yt_get_channel_id($username);
597
		return $channel_id;
597
		return $channel_id;
598
	} else if (preg_match("@https{0,1}://(www\\.|)youtube\\.com/channel/(.*)(&|\\?)@ismU", $channel_url.'&', $m)) {
598
	} else if (preg_match("@https{0,1}://(www\\.|)youtube\\.com/channel/(.*)(/|&|\\?)@ismU", $channel_url.'&', $m)) {
599
		$channel_id = $m[2];
599
		$channel_id = $m[2];
600
		return $channel_id;
600
		return $channel_id;
601
	} else {
601
	} else {
602
		return false;
602
		return false;
603
	}
603
	}