|
某(Dou)音直播录制软件,教程附送在7z压缩包文件中(附加的图片里有具体信息)。
蓝奏云地址:
文件校验信息:
MD5: 2203644206298D01C5B1D48EBDDB5F31
SHA1:888AE9B64C4E40D05E888A875EE081D6B30D7877
CRC32:6CA77C25
代码是参考github上这个页面:https://github.com/wbt5/real-url(具体信息在附加的图片中),感谢github上那位大佬的分享。
软件已经在自己电脑上试运行过了,现在最大的不确定性是编译出来的exe能不能在每台windows系统的电脑上运行,如果出现问题我估计还要调整。
不过如果真的能用,相比网上收费像土匪一样的软件就可以省下不少钱(见附加的图片)
附上我修改过后的python代码(就是用pyinstaller将以下内容编译为“某(Dou)音直播链接提取并下载.exe”的):
[Python] 纯文本查看 复制代码print('程序正在初始化,请等待......')import requestsimport reimport pyperclipimport sysimport timeimport osdef get_real_url(rid): try: if 'v.douyin.com' in rid: room_id = re.findall(r'(\d{19})', requests.get(url=rid).url)[0] else: room_id = rid room_url = 'https://webcast-hl.amemv.com/webcast/room/reflow/info/?room_id={}&live_id=1'.format(room_id) response = requests.get(url=room_url).json() hls_pull_url = response.get('data').get('room').get('stream_url').get('hls_pull_url') rtmp_pull_url = response.get('data').get('room').get('stream_url').get('rtmp_pull_url') real_url = [rtmp_pull_url, hls_pull_url] except: real_url = '直播间不存在或未开播或参数错误' return real_urldef get_urls(str): step01=re.findall('http.+',str) step02=step01[0] return step02os.system("cls")print("\b")print('★初始化完毕!☆')print('正在监测剪切板,如检测到剪切板有变化,程序自动开始。在此期间千万不要复制无关内容!')pyperclip.copy('test')str='test'while str=='test': str=pyperclip.paste() time.sleep(0.1)if str.isdigit(): rid=str real_url=get_real_url(rid) if real_url=='直播间不存在或未开播或参数错误': print('直播间不存在或未开播或参数错误') print('操作已结束,5秒钟后退出程序') time.sleep(5) sys.exit(0) else: pyperclip.copy(real_url[0]) print('该直播间源地址为:') print(real_url) print('flv备用地址已复制进剪切板,下面启动程序') f1=open(r'temp\01.txt',mode='w') f1.write('quicklaunch') f1.close() f2=open(r'temp\02.txt',mode='w') f2.write(real_url[1]) f2.close() os.system(r'start 最新录制程序(针对抖音直播).bat&exit') f3=open('信息.txt',mode='w') f3.writelines([line+'\n' for line in real_url]) f3.close() print('具体信息已复制进 信息.txt 文件, 8秒后自动打开txt文件') time.sleep(8) os.system(r'start 信息.txt&exit') print('操作已结束,5秒钟后退出程序') time.sleep(5) sys.exit(0) else: rid=get_urls(str) real_url = get_real_url(rid) if real_url=='直播间不存在或未开播或参数错误': print('直播间不存在或未开播或参数错误') print('操作已结束,5秒钟后退出程序') time.sleep(5) sys.exit(0) else: pyperclip.copy(real_url[0]) print('该直播间源地址为:') print(real_url) print('flv备用地址已复制进剪切板,下面启动程序') f1=open(r'temp\01.txt',mode='w') f1.write('quicklaunch') f1.close() f2=open(r'temp\02.txt',mode='w') f2.write(real_url[1]) f2.close() os.system(r'start 最新录制程序(针对抖音直播).bat&exit') f3=open('信息.txt',mode='w') f3.writelines([line+'\n' for line in real_url]) f3.close() print('具体信息已复制进 信息.txt 文件, 8秒后自动打开txt文件') time.sleep(8) os.system(r'start 信息.txt&exit') print('操作已结束,5秒钟后退出程序') time.sleep(5) sys.exit(0)
还有我自己的批处理的代码:
1.最新录制程序(针对某(Dou)音直播).bat
[PowerShell] 纯文本查看 复制代码@echo offsetlocal enabledelayedexpansiontitle *下载控制台set core=ffmpeggoto check:check%core% -Lif %errorlevel%==0 (echo 恭喜,ffmpeg通过检测!&goto status_check) else (goto try):tryfor /f "delims=" %%t in (配置信息\把ffmpeg.exe的完整路径输入此文件,并确保ffmpeg.exe不移动路径.txt) do (set core=%%t)%core% -Lif %errorlevel%==0 (echo 恭喜,ffmpeg通过检测!&goto status_check) else (goto set01):set01echo.set choice=配置信息\把ffmpeg.exe的完整路径输入此文件,并确保ffmpeg.exe不移动路径.txtgoto check:status_checkfor /f "delims=" %%t in (temp\01.txt) do (set fastboot=%%t)if "%fastboot%"=="quicklaunch" (goto quicklaunch) else (goto saved_path_check):quicklaunchfor /f "delims=" %%t in (temp\02.txt) do (set b=%%t)for /f "delims=" %%t in (配置信息\常用直播标题.txt) do (set a=%%t)set E=tsset optimized_command_1=-fflags +discardcorruptset optimized_command_2=-reconnect_delay_max 30 -reconnect_streamed -reconnect_at_eof -rw_timeout 20000000 -c copy -fflags +genpts -correct_ts_overflow 1for /f "delims=" %%q in (配置信息\常用视频输出路径.txt) do (set runpath=%%q)if exist "%runpath%" (goto excute) else (goto emergency_type_in_path):emergency_type_in_pathecho ★☆输入自定义文件导出路径(举例:D:\downloads,不要在两边加双引号)set /p r=if exist "%r%" (set runpath=%r%&goto excute) else (echo 路径输入错误或路径不存在&goto emergency_type_in_path):saved_path_checkfor /f "delims=" %%q in (配置信息\常用视频输出路径.txt) do (set r=%%q)if exist "%r%" (goto ask01) else (goto type_in_path):ask01echo.set xa=配置信息\常用视频输出路径.txtgoto type_information:type_informationset xb=temp\01.txtstart cmd /k "title !a!录制中,按键盘上的“q”键即可停止录制&&%core% -protocol_whitelist crypto,file,http,https,tcp,tls,udp,rtp %optimized_command_1% -i "!b!" %optimized_command_2% "%runpath%\!a! %date:~0,4%-%date:~5,2%-%date:~8,2% %time:~0,2%-%time:~3,2%-%time:~6,5%.%E%"&title 录制结束,5秒钟后自动退出&ping -n 5 127.0.0.1 >nul&exit||color 04&echo 出错,接下来自动退出&ping -n 1 127.0.0.1 >nul&exit"title ★☆!a! 下载控制台★☆goto ask03:emergency_retryecho ★☆输入直播源地址(http://*.*.*.[sample],[sample]处为文件类型,例如:m3u8、flv、mp4等)★☆set /p b=pausegoto excute:ask03echo.set xz=
2.某(Dou)音直播备用录制程序-FLV+URLhelper模式.bat
[PowerShell] 纯文本查看 复制代码@echo offsetlocal enabledelayedexpansiontitle *下载控制台set core01=ffmpegset core02=special_ffmpegset core03=special_ffprobegoto 01-check:01-check%core01% -Lif %errorlevel%==0 (goto 02-check) else (goto 01-try):01-tryfor /f "delims=" %%t in (配置信息\把ffmpeg.exe的完整路径输入此文件,并确保ffmpeg.exe不移动路径.txt) do (set core01=%%t)%core01% -Lif %errorlevel%==0 (goto 02-check) else (goto 01-set-step1):01-set-step1echo.set choice=配置信息\把ffmpeg.exe的完整路径输入此文件,并确保ffmpeg.exe不移动路径.txtgoto 01-check:02-check%core02% -Lif %errorlevel%==0 (goto 03-check) else (goto 02-try):02-tryfor /f "delims=" %%t in (配置信息\把special_ffmpeg.exe的完整路径输入此文件,并确保special_ffmpeg.exe不移动路径.txt) do (set core02=%%t)%core02% -Lif %errorlevel%==0 (goto 03-check) else (goto 02-set):02-setecho.echo 找不到special_ffmpeg.exe,未配置special_ffmpeg.exe路径或者手动输入的special_ffmpeg.exe路径有问题echo ★☆在下方输入(或重新输入)“special_ffmpeg.exe”这个文件的完整路径(举例"D:\...\组件\特制ffmpeg\bin\special_ffmpeg.exe",带上双引号),special_ffmpeg.exe路径的设置会被保存在“把special_ffmpeg.exe的完整路径输入此文件,并确保special_ffmpeg.exe不移动路径.txt”文档中,供以后的运行使用set /p core02=echo %core02%>配置信息\把special_ffmpeg.exe的完整路径输入此文件,并确保special_ffmpeg.exe不移动路径.txtgoto 02-check:03-setecho.echo 找不到special_ffprobe.exe,未配置special_ffprobe.exe路径或者手动输入的special_ffprobe.exe路径有问题echo ★☆在下方输入(或重新输入)“special_ffprobe.exe”这个文件的完整路径(举例"D:\...\组件\特制ffmpeg\bin\special_ffprobe.exe",带上双引号),special_ffmpeg.exe路径的设置会被保存在“把special_ffmpeg.exe的完整路径输入此文件,并确保special_ffmpeg.exe不移动路径.txt”文档中,供以后的运行使用set /p core03=echo %core03%>配置信息\把special_ffprobe.exe的完整路径输入此文件,并确保special_ffprobe.exe不移动路径.txtgoto 03-check:03-check%core03% -Lif %errorlevel%==0 (echo 恭喜,所有组件通过检测!&goto saved_path_check) else (goto 03-try):03-tryfor /f "delims=" %%t in (配置信息\把special_ffprobe.exe的完整路径输入此文件,并确保special_ffprobe.exe不移动路径.txt) do (set core03=%%t)%core03% -Lif %errorlevel%==0 (echo 恭喜,所有组件通过检测!&goto saved_path_check) else (goto 03-set):saved_path_checkfor /f "delims=" %%q in (配置信息\常用视频输出路径.txt) do (set r=%%q)if exist "%r%" (goto ask01) else (goto type_in_path):ask01echo.set xa=常用视频输出路径.txtgoto type_information_2:type_information_2echo ★☆输入频道/直播信息(可以加上编号区别;这个主要是给输出的文件取名用的,不输入也没问题)★☆set /p a=echo ★☆输入直播源地址(http://*.*.*.[sample],[sample]处为文件类型,例如:m3u8、flv、mp4等)★☆set /p b=pausegoto format_recognition_step1_read:format_recognition_step1_read%core03% -show_format !b!>temp\01.txtfindstr "format_name=flv" temp\01.txt>temp\02.txtset /a num=0for /f "delims=" %%i in (temp\02.txt) do ( set /a num+=1 set str=%%i if !num! equ 1 goto format_recognition_step1_compare):format_recognition_step1_compareif "%str%"=="format_name=flv" (goto format_recognition_step2_read) else (goto cfg_4):format_recognition_step2_read%core03% -show_streams !b!>temp\01.txtfindstr "codec_name=hevc" temp\01.txt>temp\02.txtset /a num=0for /f "delims=" %%i in (temp\02.txt) do ( set /a num+=1 set str=%%i if !num! equ 1 goto format_recognition_step2_compare_1):format_recognition_step2_compare_1if "%str%"=="codec_name=hevc" (goto cfg_1) else (goto format_recognition_step2_compare_2):format_recognition_step2_compare_2findstr "codec_name=h264" temp\01.txt>temp\02.txtset /a num=0for /f "delims=" %%i in (temp\02.txt) do ( set /a num+=1 set str=%%i if !num! equ 1 goto format_recognition_step2_compare_3):format_recognition_step2_compare_3if "%str%"=="codec_name=h264" (goto cfg_2) else (goto cfg_3):cfg_1set selected_core=%core02%set E=flvset optimized_command_1=-f live_flv -thread_queue_size 1024 -discard none -avoid_negative_ts make_zeroset optimized_command_2=-reconnect_delay_max 30 -reconnect_streamed -reconnect_at_eof -rw_timeout 20000000 -c copy -g 30 -flvflags add_keyframe_index -correct_ts_overflow 1goto check_before_run_step1:cfg_2set selected_core=%core01%set E=tsset optimized_command_1=-f live_flv -thread_queue_size 1024 -fflags +discardcorrupt set optimized_command_2=-reconnect_delay_max 30 -reconnect_streamed -reconnect_at_eof -rw_timeout 20000000 -c copy -f mpegts -correct_ts_overflow 1goto check_before_run_step1:cfg_3set selected_core=%core01%set E=flvset optimized_command_1=-f live_flv -thread_queue_size 1024 -discard none -avoid_negative_ts make_zeroset optimized_command_2=-reconnect_delay_max 30 -reconnect_streamed -reconnect_at_eof -rw_timeout 20000000 -c copy -g 30 -flvflags add_keyframe_index -correct_ts_overflow 1goto check_before_run_step1:cfg_4set selected_core=%core01%set E=tsset optimized_command_1=-thread_queue_size 1024 -fflags +discardcorrupt -avoid_negative_ts make_zeroset optimized_command_2=-reconnect_delay_max 30 -reconnect_streamed -reconnect_at_eof -rw_timeout 20000000 -c copy -correct_ts_overflow 1goto check_before_run_step1:check_before_run_step1echo 写入一个片段测试文本文档是否为空>>temp\01.txtset /a num=0for /f "delims=" %%i in (temp\01.txt) do ( set /a num+=1 set str=%%i if !num! equ 1 goto check_before_run_step2):check_before_run_step2if "%str%"=="写入一个片段测试文本文档是否为空" (goto connection_error) else (goto excute):connection_errorecho 检测到连接错误,是否重新连接?(Enter:地址不变重新连接;1:重新输入地址再试一遍;2:不改变文件输出路径和扩展名配置,换一个直播下载;3:更改所有配置,从头再来一次,换一个直播下载)set /p xx=if not defined xx goto format_recognition_step1_readif "%xx%"=="1" goto emergency_retryif "%xx%"=="2" goto type_information_2if "%xx%"=="3" goto saved_path_checkecho 输入错误的选项或值,重新输入^^!^^!goto connection_error:excutestart cmd /k "title !a!录制中,按键盘上的“q”键即可停止录制&&%selected_core% -protocol_whitelist crypto,file,http,https,tcp,tls,udp,rtp %optimized_command_1% -i "!b!" %optimized_command_2% "%runpath%\!a! %date:~0,4%-%date:~5,2%-%date:~8,2% %time:~0,2%-%time:~3,2%-%time:~6,5%.%E%"&title 录制结束,5秒钟后自动退出&ping -n 5 127.0.0.1 >nul&exit||color 04&echo 出错,接下来自动退出&ping -n 1 127.0.0.1 >nul&exit"title ★☆!a! 下载控制台★☆goto ask03:emergency_retryecho ★☆输入直播源地址(http://*.*.*.[sample],[sample]处为文件类型,例如:m3u8、flv、mp4等)★☆set /p b=pausegoto format_recognition_step1_read:ask03echo.set xz=
3.★☆首先运行这个★☆--信息配置.bat
[PowerShell] 纯文本查看 复制代码@echo offsetlocal enabledelayedexpansiongoto type_in_path:type_in_pathecho ★☆输入自定义文件导出路径(举例:D:\downloads,不要在两边加双引号),按“Enter”继续set /p r=if exist "%r%" (goto save01) else (echo 路径输入错误或路径不存在&goto type_in_path):save01echo %r%>配置信息\常用视频输出路径.txtgoto save02:save02echo ★☆输入常用直播标题(这个主要是给输出的文件取名用的,不输入按“Enter”也没问题)★☆set /p A=if not defined A goto otherecho %A%>配置信息\常用直播标题.txtecho ★☆配置完成,按任意键退出★☆pauseexit:othercd.>配置信息\常用直播标题.txtecho ★☆配置完成,按任意键退出★☆pauseexit
|
|