如何编辑/创建新的批处理脚本来设置从一系列链接进行批量下载(带脚本)

如何编辑/创建新的批处理脚本来设置从一系列链接进行批量下载(带脚本)

几周前,我发布了这个问题并得到了一个精彩的答案。

我尝试将以下代码集所用的技术应用于另一个网站,但失败了。命令提示符窗口会立即打开并关闭。所以我又回来了。

代码:

@echo off
call set /p link=paste the link:
call set last=%%link:~-1,1%% 
rem call set folder="%~dp0\videos\\"
set folder=M:\\LiveStreamer\LiveStreamer\L
If Not Exist %folder% MD %folder%
call set livestreamer="%~dp0\tools\livestreamer\\"
call "%~dp0\tools\php5.4\php.exe" hotstarlivestreamer.php "%%link%%"
IF  %last% NEQ c GOTO:nocollection
call set /p id=enter the Id of the video (example write 1000021386):
call "%~dp0\tools\php5.4\php.exe" hotstarlivestreamer.php "%%link%%" "%%id%%"
call set /p quality=write quality (example write 720p):
call "%~dp0\tools\php5.4\php.exe" hotstarlivestreamer.php "%%link%%" "%%id%%" "%%quality%%" "%%folder%%" "%%livestreamer%%"
GOTO end1
:nocollection
rem call set /p quality=write quality (example write 720p):
Set quality=1080p
rem call set /p choice=play or download? (write p or d):
set choice=d
call "%~dp0\tools\php5.4\php.exe" hotstarlivestreamer.php "%%link%%" "%%quality%%" "%%folder%%" "%%livestreamer%%" "%%choice%%"
:end1
pause
:end

非常感激任何帮助。

==== 编辑 5/7/16,更新代码如下:

@echo off
setlocal enabledelayedexpansion
set "folder=C:\\Hotstar\H"
if not exist %folder% md %folder%
set livestreamer="%~dp0\tools\livestreamer\\"
"%~dp0\tools\php5.4\php.exe" hotstarlivestreamer.php "%%link%%"
set /p id=enter the Id of the video (example write 1000021386):
"%~dp0\tools\php5.4\php.exe" hotstarlivestreamer.php "%%link%%" "%%id%%"
"%~dp0\tools\php5.4\php.exe" hotstarlivestreamer.php "%%link%%" "%%id%%" "%%quality%%" "%%folder%%" "%%livestreamer%%"
Set quality=1080p
set choice=d
set last=%%link:~-1,1%% 
for /f "usebackq tokens=*" %%i in (`type links.txt`) do (
  echo "%~dp0\tools\php5.4\php.exe" hotstarlivestreamer.php "%%i" "%id%" "%link%" "%quality%" "%folder%" "%livestreamer%" "%choice%"
  )
endlocal

但是,当我这样做时出现错误:

Notice: Trying to get property of non-object in C:\hotstarsportslivestreamer-master\hotstarlivestreamer.php on line 135

Notice: Trying to get property of non-object in C:\hotstarsportslivestreamer-master\hotstarlivestreamer.php on line 139

Notice: Trying to get property of non-object in C:\hotstarsportslivestreamer-master\hotstarlivestreamer.php on line 141

Notice: Trying to get property of non-object in C:\hotstarsportslivestreamer-master\hotstarlivestreamer.php on line 143
Available streams:
enter the Id of the video (example write 1000021386):

有问题的 php 错误按相应顺序引用这些行:

$contentInfo=$resultObj->{'contentInfo'};

$contentTitle = $contentInfo2->contentTitle; $contentTitle=str_replace(" ","-",$contentTitle);

$episodeTitle = $contentInfo2->episodeTitle; $episodeTitle=str_replace(" ","-",$episodeTitle);

$episodeNumber= $contentInfo2->episodeNumber; $episodeNumber="episode$episodeNumber";

不过,我不确定如何自动输入“ID”。这是一个典型的 URL:

http://www.hotstar.com/tv/bahu-humari-rajni-kant/7326/kuhus-birthday-party/1000093419

ID 是 URL 的最后一部分 - 1000093419;即使我手动输入数字,也会出现以下错误:

php 文件的第 191 行和 200 行中的偏移量未定义,指的是(我已编辑该文件以指出这些行):

if(isset($argv[2])){
    **<line 191>** if(isset($argv[2]) AND ($argv[5]=='d')){


    echo "Starting livestreamer...\n\n";
    echo shell_exec("$argv[4]livestreamer  \"$m3u8\" \"$argv[2]\" -o \"$argv[3]$filename.ts\" &");
    echo "Done.\n";
    }
    else{ 
    echo "Starting livestreamer...\n\n";
    **<line 192>** echo shell_exec("$argv[4]livestreamer  \"$m3u8\" \"$argv[2]\"  &");
    echo "Done.\n";
    }
    }
    else{ echo "Available streams: $bitrate\n";

相关内容