使用 vlc 下载受密码保护的视频

问题描述 投票:0回答:1

我已经学会了如何通过“开放网络流”GUI 使用 VLC 下载视频,并且我已经这样做了数十次。我曾经不得不添加一个 http-referrer,但除此之外,我从来没有遇到过这个方法的太多麻烦。

现在我想下载这个视频,只有在登录该网站后才能访问。我确实有观看视频的适当凭据,请放心。我只想剪辑一个我喜欢的短场景 – 正如我倾向于做的那样。

自然,vlc 只会抛出 403 错误。

访问错误:HTTP 403错误
http 错误:本地流 1 错误:取消 (0x8)

从消息窗口:

main debug: resolving video-course.coolsite.com ...
gnutls debug: TLS handshake: Resource temporarily unavailable, try again.
gnutls debug: TLS handshake: Resource temporarily unavailable, try again.
gnutls debug: TLS handshake: Resource temporarily unavailable, try again.
gnutls debug: TLS handshake: Resource temporarily unavailable, try again.
gnutls debug: TLS handshake: Success.
gnutls debug: - safe renegotiation (RFC5746) enabled
gnutls debug: - extended master secret (RFC7627) enabled
gnutls debug: - false start (RFC7918) enabled
http debug: out SETTINGS (0x04) frame of 30 bytes, flags 0x00, global
http debug: out HEADERS (0x01) frame of 209 bytes, flags 0x05, stream 1
http debug: in SETTINGS (0x04) frame of 18 bytes, flags 0x00, global
http debug: setting: Concurrent streams (0x0003): 128
http debug: setting: Initial window size (0x0004): 65536
http debug: setting: Frame size (0x0005): 16777215
http debug: out SETTINGS (0x04) frame of 0 bytes, flags 0x01, global
http debug: in WINDOW_UPDATE (0x08) frame of 4 bytes, flags 0x00, global
http debug: in SETTINGS (0x04) frame of 0 bytes, flags 0x01, global
http debug: in HEADERS (0x01) frame of 227 bytes, flags 0x04, stream 1
http debug: stream 1 10 headers:
http debug: :status: "403"
http debug: server: "CloudFront"
http debug: date: "Tue, 17 Oct 2023 19:13:56 GMT"
http debug: content-type: "text/xml"
http debug: content-length: "146"
http debug: x-cache: "Error from cloudfront"
http debug: via: "1.1 etc.cloudfront.net (CloudFront)"
http debug: x-amz-cf-pop: "ABABCDCD-P3"
http debug: x-amz-cf-id: "ABCDEF=="
http debug: cache-control: "max-age=3600"
access error: HTTP 403 error
http error: local stream 1 error: Cancellation (0x8)
http debug: out RST_STREAM (0x03) frame of 4 bytes, flags 0x00, stream 1
http debug: local shutdown

考虑到此密码保护、必要的 cookie 和其他标头,我已设法通过curl 请求下载播放列表(

*.ts
文件)。这对我来说这在技术上应该是可行的。

curl 'https://video-course.coolsite.com/video.m3u8' \
  -H 'authority: video-course.coolsite.com' \
  -H 'accept: */*' \
  -H 'accept-language: en-US,en;q=0.9,de;q=0.8' \
  -H 'cache-control: no-cache' \
  -H 'cookie: CloudFront-Key-Pair-Id=ABCDEF; cf_clearance=LONGSTRINGCONTINUES; FUP_vid=12345; etc.' \
  -H 'dnt: 1' \
  -H 'origin: https://www.coolsite.com' \
  -H 'pragma: no-cache' \
  -H 'referer: https://www.coolsite.com/' \
  -H 'sec-ch-ua: "Chromium";v="118", etc.' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "Linux"' \
  -H 'sec-fetch-dest: empty' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-site: same-site' \
  -H 'user-agent: Mozilla/5.0 etc.' \
  --compressed

但是我不知道如何将那组参数翻译成vlc。我已经通过 GUI 以及

vlc
cvlc
CLI 命令尝试了各种变体……例如
:cookie='…'
:set-cookie='…'
:http-cookie='…'
。但我只是不知道 vlc 参数的名称 - 更不用说它们是否会从 curl 进行 1:1 翻译。

这就是我得到的:

cvlc 'https://video-course.coolsite.com/video.m3u8' \
   :???='video-course.coolsite.com' (authority) \
   :???='*/*' (accept) \
   :???='en-US,en;q=0.9,de;q=0.8' (accept-language) \
   :???='no-cache' (cache-control) \
   :???='CloudFront-Key-Pair-Id=ABCDEF; cf_clearance=LONGSTRINGCONTINUES; FUP_vid=12345; etc.' (cookie) \
   :???=1 (dnt) \
   :???='https://www.coolsite.com' (origin) \
   :???='no-cache' (pragma) \
  :http-referrer='https://www.coolsite.com/' \
   :???='"Chromium";v="118", etc.' (sec-ch-ua) \
   :???='?0' (sec-ch-ua-mobile) \
   :???='"Linux"' (sec-ch-ua-platform) \
   :???='empty' (sec-fetch-dest) \
   :???='cors' (sec-fetch-mode) \
   :???='same-site' (sec-fetch-site) \
  :http-user-agent='Mozilla/5.0 etc.'

研究

authentication cookies httprequest vlc
1个回答
0
投票

我最终通过curl下载了

*.m3u8
*.ts
文件,然后可以使用我已经熟悉的ffmpeg进行合并:

$ cat segment1_0_av.ts segment2_0_av.ts segment3_0_av.ts > all.ts $ ffmpeg -i all.ts -acodec copy -vcodec copy all.mp4
虽然我无法告诉 GUI 加载多个本地文件并将其保存到单个文件,但 CLI 端的 VLC 也可以根据 

此文档页面 执行此操作。我还没试过那个。

> "%PROGRAMFILES%\VideoLAN\VLC\vlc.exe" file1.ps file2.ps file3.ps --sout "#gather:std{access=file,mux=ts,dst=all.ts}" --no-sout-all --sout-keep
    
© www.soinside.com 2019 - 2024. All rights reserved.