命令行pornhub/youporn下载器

准备

虽然两个主站需要代¥理,不过视频地址不需要,只要解析出来用aria2c下载即可

代码

P1

@echo off
rem 使用pornhub.com/youporn.com
color 0a && mode con cols=55 lines=15
set version=1.0.1 && title=pornhub下载 %version%
if "%proxy%"=="" set proxy=127.0.0.1:1080
if "%downloads_folder%"=="" set downloads_folder=F:\Downloads

if "%target%"=="" set /p target=请粘贴目标网址:

:get_videourl
curl -k -L -s -x %proxy%  -o target_utf8.temp %target% -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36" 
if exist target_utf8.temp (
iconv -c -f UTF-8 -t GBK target_utf8.temp > target_gbk.temp
sed -i "s#\"#\n#g" target_gbk.temp
if exist *. del *.
sed "s##\n<title>#g" target_gbk.temp | egrep "^<title>" | sed "s#<title>##g;s###g;s# - Pornhub.com##g;s#[[:space:]]#_#g" > target_title.temp
egrep -A2 "videoUrl" target_gbk.temp | egrep "^http" | sed "s#\\/#/#g" | head -1 > target_videourl.temp
)

:get_video
for /f %%t in (target_title.temp) do (
for /f %%v in (target_videourl.temp) do (
echo 正在下载 %target%
aria2c --disk-cache=32M --file-allocation=none --realtime-chunk-checksum=true --check-integrity=true --split=16 --min-split-size=1M --max-connection-per-server=16 --piece-length=1M --allow-piece-length-change=true --auto-file-renaming=false --allow-overwrite=false --dir=%downloads_folder%  -o %%t.mp4 %%v
)
)
echo %target% >>pornhub_history.txt

将上面代码保存为pornhub.bat

P2

再制作一个批量添加链接和调用P1下载

@echo off
color 0a && mode con cols=55 lines=15
set version=1.0.1 && title=示例程序 %version%
if exist *. del *.
if exist *.temp del *.temp
if "%proxy%"=="" set proxy=127.0.0.1:1080
if "%download_folder%"=="" set download_folder=F:\Downloads
set /a sum=0


:RE
cls
if exist target_URL.temp cat -n target_URL.temp || echo. 2>target_URL.temp
set /p target_URL=请粘贴网址:
if /i "%target_URL%"=="Q" goto main
findstr "%target_URL%" pornhub_history.txt >nul && echo 警告:历史重复任务! && ping -n 3 127.0.0.1 >nul && goto re 
findstr "%target_URL%" target_URL.temp >nul && echo 警告:重复任务! && ping -n 3 127.0.0.1 >nul && goto re || echo %target_URL% >>target_URL.temp && set /a sum=%sum%+1
goto RE

:main
for /f %%i in (target_URL.temp) do (
echo 正在下载 %sum%:%%i
set target=%%i 
echo %target%|findstr /r "pornhub.com youporn.com" >nul
if %errorlevel%==0 call pornhub.bat
)

rem 清理缓存
if exist *. del *.
if exist *.temp del *.temp

你可能感兴趣的:(命令行pornhub/youporn下载器)