豆包如何导出或者下载双语实时字幕

问题:如何把豆包的双语实时字幕抓取下来?这是豆包的双语实时字幕,目前没有下载字幕的功能,我如何下载?我会写程序,请用python语言帮我解决这个问题。

如何导出或者下载字幕

在这里插入图片描述
实现的效果:

在这里插入图片描述
capture-doubao-subtitles.ps1

param(
    [int]$X = 20,
    [int]$Y = 145,
    [int]$Width = 1180,
    [int]$Height = 815,
    [double]$IntervalSeconds = 1.0,
    [string]$OutputPath = "C:\Users\dannel\Documents\Codex\2026-06-08\new-chat\outputs\doubao-subtitles.txt",
    [string]$DebugImagePath = "C:\Users\dannel\Documents\Codex\2026-06-08\new-chat\work\last-subtitle-capture.png",
    [switch]$KeepDuplicateScreens,
    [switch]$Once
)

Add-Type -AssemblyName System.Drawing
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Runtime.WindowsRuntime

$null = [Windows.Globalization.Language, Windows.Foundation, ContentType = WindowsRuntime]
$null = [Windows.Media.Ocr.OcrEngine, Windows.Foundation, ContentType = WindowsRuntime]
$null = [Windows.Storage.StorageFile, Windows.Storage, ContentType = WindowsRuntime]
$null = [Windows.Graphics.Imaging.BitmapDecoder, Windows.Graphics, ContentType = WindowsRuntime]

$asTaskMethods = [System.WindowsRuntimeSystemExtensions].GetMethods() | Where-Object { $_.Name -eq "AsTask" }

function Await-WinRtOperation {
    param(
        [Parameter(Mandatory = $true)] $Operation,
        [Parameter(Mandatory = $true)] [Type] $ResultType
    )

    $method = $asTaskMethods |
        Where-Object {
            $_.IsGenericMethodDefinition -and
            $_.GetParameters().Count -eq 1 -and
            $_.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation`1'
        } |
        Select-Object -First 1

    if ($null -eq $method) {
        throw "Cannot find WindowsRuntimeSystemExtensions.AsTask for IAsyncOperation."
    }

    $task = $method.MakeGenericMethod($ResultType).Invoke($null, @($Operation))
    $task.Wait()
    return $task.Result
}

function Capture-Region {
    param(
        [int]$Left,
        [int]$Top,
        [int]$CaptureWidth,
        [int]$CaptureHeight,
        [string]$Path
    )

    $bitmap = New-Object System.Drawing.Bitmap $CaptureWidth, $CaptureHeight
    $graphics = [System.Drawing.Graphics]::FromImage($bitmap)
    try {
        $graphics.CopyFromScreen($Left, $Top, 0, 0, $bitmap.Size)
        $bitmap.Save($Path, [System.Drawing.Imaging.ImageFormat]::Png)
    }
    finally {
        $graphics.Dispose()
        $bitmap.Dispose()
    }
}

function Read-OcrText {
    param([string]$Path)

    $file = Await-WinRtOperation ([Windows.Storage.StorageFile]::GetFileFromPathAsync($Path)) ([Windows.Storage.StorageFile])
    $stream = Await-WinRtOperation ($file.OpenReadAsync()) ([Windows.Storage.Streams.IRandomAccessStreamWithContentType])
    try {
        $decoder = Await-WinRtOperation ([Windows.Graphics.Imaging.BitmapDecoder]::CreateAsync($stream)) ([Windows.Graphics.Imaging.BitmapDecoder])
        $softwareBitmap = Await-WinRtOperation ($decoder.GetSoftwareBitmapAsync()) ([Windows.Graphics.Imaging.SoftwareBitmap])

        $language = New-Object Windows.Globalization.Language "zh-Hans-CN"
        $engine = [Windows.Media.Ocr.OcrEngine]::TryCreateFromLanguage($language)
        if ($null -eq $engine) {
            $engine = [Windows.Media.Ocr.OcrEngine]::TryCreateFromUserProfileLanguages()
        }
        if ($null -eq $engine) {
            throw "Windows OCR engine is not available."
        }

        $result = Await-WinRtOperation ($engine.RecognizeAsync($softwareBitmap)) ([Windows.Media.Ocr.OcrResult])
        return ($result.Lines | ForEach-Object { $_.Text }) -join "`n"
    }
    finally {
        if ($stream) {
            $stream.Dispose()
        }
    }
}

function Remove-ToolbarText {
    param([string]$Text)

    $keptLines = foreach ($line in ($Text -split "`r?`n")) {
        $trimmed = $line.Trim()
        $compact = $trimmed -replace "\s+", ""

        if ([string]::IsNullOrWhiteSpace($trimmed)) {
            continue
        }
        if ($compact -match "^(翻译为[::]?中文|关闭原文|Aa.*字号|收起字幕|展开字幕)$") {
            continue
        }
        if ($compact.Length -le 1 -and $compact -match "^[^\p{L}\p{N}]$") {
            continue
        }

        $trimmed
    }

    return ($keptLines -join "`n").Trim()
}

function Format-SubtitleText {
    param([string]$Text)

    $cjk = "[\u3400-\u9FFF\uF900-\uFAFF]"
    $cjkOrAscii = "[\u3400-\u9FFF\uF900-\uFAFF0-9A-Za-z%]"
    $cjkPunctuation = "[\u3001\u3002\uff0c\uff1a\uff1b\uff01\uff1f\uff09\uff1d]"
    $openingPunctuation = "[\uff08]"

    $formattedLines = foreach ($line in ($Text -split "`r?`n")) {
        $value = $line.Trim()
        if ([string]::IsNullOrWhiteSpace($value)) {
            continue
        }

        $value = $value -replace "(?<=$cjkOrAscii)\s+(?=$cjk)", ""
        $value = $value -replace "(?<=$cjk)\s+(?=$cjkOrAscii)", ""
        $value = $value -replace "\s+($cjkPunctuation)", '$1'
        $value = $value -replace "($cjkPunctuation)\s+(?=$cjkOrAscii)", '$1'
        $value = $value -replace "($openingPunctuation)\s+", '$1'
        $value
    }

    return ($formattedLines -join "`n").Trim()
}

function Normalize-SubtitleLine {
    param([string]$Line)

    return ($Line.ToLowerInvariant() -replace "[^\p{L}\p{N}]+", "").Trim()
}

function Get-NewSubtitleLines {
    param(
        [string]$Text,
        [hashtable]$SeenLines
    )

    $newLines = New-Object System.Collections.Generic.List[string]

    foreach ($line in ($Text -split "`r?`n")) {
        $trimmed = $line.Trim()
        if ([string]::IsNullOrWhiteSpace($trimmed)) {
            continue
        }

        $key = Normalize-SubtitleLine $trimmed
        if ($key.Length -lt 4) {
            continue
        }

        if (-not $SeenLines.ContainsKey($key)) {
            $SeenLines[$key] = $true
            $newLines.Add($trimmed)
        }
    }

    return ($newLines -join "`n").Trim()
}

New-Item -ItemType Directory -Force -Path (Split-Path -Parent $OutputPath) | Out-Null
New-Item -ItemType Directory -Force -Path (Split-Path -Parent $DebugImagePath) | Out-Null

$lastText = ""
$seenLines = @{}

Write-Output "Saving subtitles to: $OutputPath"
Write-Output "Press Ctrl+C to stop."

while ($true) {
    Capture-Region -Left $X -Top $Y -CaptureWidth $Width -CaptureHeight $Height -Path $DebugImagePath
    $text = Format-SubtitleText (Remove-ToolbarText (Read-OcrText -Path $DebugImagePath))

    $textToSave = $text
    if (-not $KeepDuplicateScreens) {
        $textToSave = Get-NewSubtitleLines -Text $text -SeenLines $seenLines
    }

    if (-not [string]::IsNullOrWhiteSpace($textToSave) -and ($KeepDuplicateScreens -or $text -ne $lastText)) {
        Add-Content -Path $OutputPath -Encoding UTF8 -Value $textToSave
        Add-Content -Path $OutputPath -Encoding UTF8 -Value ""
        Write-Output $textToSave
        $lastText = $text
    }

    if ($Once) {
        break
    }

    Start-Sleep -Milliseconds ([int]($IntervalSeconds * 1000))
}

format-doubao-subtitles.ps1

param(
    [string]$InputPath = "C:\Users\dannel\Documents\Codex\2026-06-08\new-chat\outputs\doubao-subtitles.txt",
    [string]$OutputPath = "C:\Users\dannel\Documents\Codex\2026-06-08\new-chat\outputs\doubao-subtitles-formatted.txt"
)

function Format-SubtitleText {
    param([string]$Text)

    $cjk = "[\u3400-\u9FFF\uF900-\uFAFF]"
    $cjkOrAscii = "[\u3400-\u9FFF\uF900-\uFAFF0-9A-Za-z%]"
    $cjkPunctuation = "[\u3001\u3002\uff0c\uff1a\uff1b\uff01\uff1f\uff09\uff1d]"
    $openingPunctuation = "[\uff08]"

    $formattedLines = foreach ($line in ($Text -split "`r?`n")) {
        $value = $line.Trim()
        if ([string]::IsNullOrWhiteSpace($value)) {
            continue
        }
        if ($value -match "^\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\]$") {
            continue
        }

        $value = $value -replace "(?<=$cjkOrAscii)\s+(?=$cjk)", ""
        $value = $value -replace "(?<=$cjk)\s+(?=$cjkOrAscii)", ""
        $value = $value -replace "\s+($cjkPunctuation)", '$1'
        $value = $value -replace "($cjkPunctuation)\s+(?=$cjkOrAscii)", '$1'
        $value = $value -replace "($openingPunctuation)\s+", '$1'
        $value
    }

    return ($formattedLines -join "`n").Trim()
}

$text = Get-Content -Path $InputPath -Raw
Format-SubtitleText $text | Set-Content -Path $OutputPath -Encoding UTF8
Write-Output $OutputPath

start-doubao-subtitle-capture.cmd

@echo off
powershell -ExecutionPolicy Bypass -File "%~dp0capture-doubao-subtitles.ps1" -X 20 -Y 145 -Width 1180 -Height 815 -IntervalSeconds 1
pause

实现的效果并不是太完美,感兴趣的coder可以一起完善。

源码直接下载地址: https://pan.quark.cn/s/95437fdf229e Intel I-219V网卡驱动是一款专门为Intel的I-219V千兆以太网控制器而研发的驱动程序,其主要作用在于保障在Ubuntu 16.04操作系统环境下的正常运作以及优化系统性能。Intel I-219V作为一款广泛应用的内置网络接口控制器(NIC),常被集成在台式机及笔记本电脑的主板上,负责提供高速的网络连接服务。Intel公司所提供的e1000e驱动是与此硬件相配套的开源驱动解决方案,其中版本3.3.5.3是专门针对该硬件设备的定制版本。此驱动包含了不可或缺的源代码部分,赋予开发者和系统管理者按照特定需求进行编译和定制的权限,从而能够适应多样化的系统配置或针对特定情形进行问题解决。源代码的可用性同样表明用户有能力依据Linux内核的更新情况来升级驱动,确保与最新技术标准的兼容性。在Ubuntu 16.04系统中成功编译的驱动意味着它已经通过了严苛的测试流程,并能够与该版本的Linux内核实现良好兼容。Ubuntu 16.04,其代号为Xenial Xerus,是一个长期支持(LTS)的版本,因此对于那些追求系统稳定性和安全保障的用户群体而言具有特殊的意义。驱动程序的兼容性保障了I-219V网卡能够在该系统平台上实现无缝运行,提供稳定可靠的网络连接,这既包括局域网(LAN)的连接,也可能涵盖通过Wi-Fi桥接实现的无线网络连接。驱动程序的核心职责涵盖了网络接口的初始化与管理、数据包的接收与发送处理,以及错误检测与纠正功能的执行。在Linux操作系统架构中,驱动通常以模块的形式加载至内核之中,这种设计允许在非必要时期进行卸载操作,以此来有效节省系统资源。e1000e驱...
内容概要:本文围绕基于共识的捆绑算法(CBBA)在多智能体系统中的多任务分配问题展开研究,重点应用于远程太空船交会与维修的相对轨道操作(RPO)规划。通过Matlab代码实现了CBBA算法,系统地解决了多个航天器在复杂空间环境下协同执行多目标任务时的任务分配、路径规划与动态协商问题。研究详细展示了算法在任务分解、竞标机制、共识达成及冲突消解等方面的核心逻辑,验证了其在分布式决策、通信受限条件下的高效性与鲁棒性,并结合航天工程实际背景突出了算法的应用价值。该资源不仅提供完整的仿真代码,还包含详细的流程解析,有助于深入理解多智能体协同机制的设计原理。; 适合人群:具备控制理论、航天器动力学、多智能体系统或分布式优化背景的研究生、科研人员及航空航天领域工程技术人员,熟练掌握Matlab编程者尤佳。; 使用场景及目标:①应用于在轨服务、空间碎片清除、多航天器编队飞行、星座维护等多智能体协同任务的任务分配与规划;②为研究人员提供CBBA算法的实现范例,支撑其开展分布式任务规划算法的改进与扩展研究;③作为教学案例用于高级课程中讲解多智能体协同决策机制。; 阅读建议:建议结合Matlab代码逐模块分析算法实现过程,重点关注任务打包、竞标更新、共识收敛等关键环节,可尝试引入通信延迟、故障容错或障碍规避机制以进一步提升算法实用性。
内容概要:本文介绍了一种基于关键场景辨别算法的两阶段鲁棒微网优化调度方法,旨在有效应对风电等可再生能源出力不确定性带来的调度挑战。通过Matlab代码实现,构建了包含预调度与实时调整的两阶段鲁棒优化模型,第一阶段制定初始调度计划以应对不确定性,第二阶段根据实际运行数据进行修正,从而提升微网运行的经济性与可靠性。该方法结合场景生成与缩减技术,识别关键不确定性场景,降低计算复杂度,同时增强了调度方案的鲁棒性。文中还探讨了该方法与智能优化算法、机器学习及电力系统仿真工具的集成应用,展现了其在复杂综合能源系统中的广阔应用前景。; 适合人群:具备一定电力系统基础知识和Matlab编程能力,从事新能源、微网优化、不确定性建模与鲁棒调度等领域研究的科研人员、工程技术人员及研究生。; 使用场景及目标:①应用于高比例可再生能源接入的微电网优化调度,提高系统对源荷不确定性的适应能力与运行稳定性;②为科研人员提供可复现的两阶段鲁棒优化建模与求解范例,支撑高水平学术论文的复现、算法改进与创新研究。; 阅读建议:建议结合提供的Matlab代码与网盘资料,动手实践关键场景生成、不确定性建模、两阶段优化建模与求解全过程,重点关注鲁棒优化框架的设计逻辑与关键场景辨别的实现机制,同时参考文中提及的多种算法与工具,拓展研究思路与应用场景。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

RunningBComeOn

你的鼓励是我最大的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值