如何使用blob url下载视频?

vin*_*esh 135 download

我正在尝试使用 src url 下载视频blob:https%3A//www.youtube.com/23aea5c8-9ae2-40dc-9417-e675ea99b386

是否有可以遵循的过程来下载所有此类视频?

mad*_*adx 89

我找到了一种使用blob urlin下载视频的方法Vimeo在这里阅读我了解如何做到这一点)。我在这里写了简单的步骤。我正在使用谷歌浏览器:

  1. 打开More Tools?Developer Tools
  2. 检查视频标签中是否有这样的内容:

    <video preload="" src="blob:https://player.vimeo.com/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"></video>
    
    Run Code Online (Sandbox Code Playgroud)
  3. 复制 iframe 标签的 src,如果有的话,http://player.vimeo.com/video/XYZ如果你找到它,你可以直接转到第 7 点,否则按照步骤 4、5、6。
  4. 现在https://skyfire.vimeocdn.com/.../master.json?base64_init=1在页面中寻找这个字符串(使用开发者视图),你应该在一个 javascript 函数中找到它,像这样:

    (function(e,a){var t={"cdn_url":"https://f.vimeocdn.com","view":1,"request":{"files":{"dash":{"origin":"gcs","url":"https://48skyfiregce-a.akamaihd.net/.../master.json?base64_init=1","cdn":"
    
    Run Code Online (Sandbox Code Playgroud)
  5. 复制新 Chrome 标签上的 url 字段内的链接,例如https://48skyfiregce-a.akamaihd.net/.../master.json?base64_init=1用浏览器打开它,它会打开一个 json 文件,如下所示:

    {
        "clip_id": XYZ,
        "base_url": "../",
        "video": [
                     { ... ... ...
    
    Run Code Online (Sandbox Code Playgroud)
  6. 现在用你的 id 编写一个 url,XYZ如下所示:https://player.vimeo.com/video/XYZ

  7. blob:https://player.vimeo.com/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXvideo 标签内部替换为最后一个 url(在上一步 #6 中创建的那个)。
  8. 现在您会注意到,视频标签内的 src 字段神奇地发生了变化(如果没有,请多次尝试步骤 7)...

    <video preload="none" src="https://fpdl.vimeocdn.com/vimeo-prod-skyfire-std-us/XX/XXX/X/XXXXXXXX/XXXXXXXXX.mp4?token=abcdefg"></video>
    
    Run Code Online (Sandbox Code Playgroud)
  9. 使用那个新链接直接下载它,它是这样的:https ://fpdl.vimeocdn.com/vimeo-prod-skyfire-std-us/XX/XXX/X/XXXXXXXX/XXXXXXXXX.mp4?token=abcdefg

  • 目前,对于 Vimeo,它要容易得多,并且不需要所有步骤。只需打开一个 Vimeo 视频,在开发工具 DOM 结构中找到 `&lt;video&gt;` 标签,并将 `src` 属性从 `blob:...` 更改为 `x`。什么都不会发生 - 这没关系。现在再次将其更改为`y`。Chrome 会像步骤 8 或 9 一样“神奇地”将其转换为 URL。:-) (43认同)
  • 感人的。你是怎么想出来的? (9认同)
  • 工作完美,但诀窍是有时您必须多次替换“src”值才能生成下载链接。 (6认同)
  • 在第 7 步中,“html 中的最后一个 url”是什么意思? (3认同)
  • @StanE 它在 Firefox 中也很有魅力,而且绝对更快...... (3认同)
  • @StanE 我不知道你是怎么找到它的,但它就像一个魅力!Nota Bene:他提到的“x”和“y”实际上是您可以输入的确切值,它们不代表任何其他内容。 (2认同)

Vla*_*čík 27

<video src="blob:https://www.example.tv/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx">
  <source src="https://cdn.example.tv/api/media/tv/xyzxyz/index" type="application/x-mpegurl">
</video>
Run Code Online (Sandbox Code Playgroud)

我在 中也有blob:URL video/@src,但是通过在播放过程中观看Developer tools>Network发现这video/source/@srcm3u8播放列表的URL 。

一个m3u8-backed视频可以通过很容易地下载:

  • ffplay -i "https://cdn.example.tv/api/media/tv/xyzxyz/1080/index.m3u8"
  • ffmpeg -i "https://cdn.example.tv/api/media/tv/xyzxyz/1080/index.m3u8" -codec copy file.mkv

tl; dr - blob URL 听起来像您想要获取的二进制文件,但可能有更简单的方法来获取视频。只需在播放视频时查看开发工具中的网络选项卡,即可查看实际获取的内容。

  • 在我的机器上工作!您可以使用`-i &lt;URL&gt; -i &lt;URL&gt; -i &lt;URL&gt;` 提供多种流输入,将视频、音频和字幕合并为一个输出:) (2认同)
  • @mcandre 是的,这是一个很好的提示。您还可以找到 `m3u8` *metalist* (即引用其他 m3u8 文件的 m3u8 文件),并且 ffmpeg 将正确下载并合并它,因此您不需要手动指定多个输入 `-i`。 (2认同)

Pir*_*e X 12

此答案适用于 Twitter URL -

  1. 右键单击视频并单击检查元素 -

你会发现这样的代码

<div id="playerContainer" class="player-container full-screen-enabled" data-config="{&quot;is_360&quot;:false,&quot;duration&quot;:28617,&quot;scribe_widget_origin&quot;:true,&quot;heartbeatEnabled&quot;:true,&quot;video_url&quot;:&quot;https:\/\/video.twimg.com\/ext_tw_video\/844504104512749568\/pu\/pl\/e91Du5N2TZ09ZaW_.m3u8&quot;,&quot;disable_embed&quot;:&quot;0&quot;,&quot;videoInfo&quot;:{&quot;title&quot;:null,&quot;description&quot;:null,&quot;publisher&quot;:{&quot;screen_name&quot;:&quot;MountainButorac&quot;,&quot;name&quot;:&quot;Mountain Butorac&quot;,&quot;profile_image_url&quot;:&quot;https:\/\/pbs.twimg.com\/profile_images\/808318456701521920\/vBvlAASx_normal.jpg&quot;}},&quot;cardUrl&quot;:&quot;https:\/\/t.co\/SdSorop3uN&quot;,&quot;content_type&quot;:&quot;application\/x-mpegURL&quot;,&quot;owner_id&quot;:&quot;14120461&quot;,&quot;looping_enabled&quot;:true,&quot;show_cookie_override_en&quot;:true,&quot;visit_cta_url&quot;:null,&quot;scribe_playlist_url&quot;:&quot;https:\/\/twitter.com\/MountainButorac\/status\/844505243538931714\/video\/1&quot;,&quot;source_type&quot;:&quot;consumer&quot;,&quot;image_src&quot;:&quot;https:\/\/pbs.twimg.com\/ext_tw_video_thumb\/844504104512749568\/pu\/img\/FFt3qkbeOh0RlGfZ.jpg&quot;,&quot;heartbeatIntervalInMs&quot;:5000.0,&quot;use_tfw_live_heartbeat_event_category&quot;:true,&quot;video_loading_timeout&quot;:45000.0,&quot;status&quot;:{&quot;created_at&quot;:&quot;Wed Mar 22 11:05:14 +0000 2017&quot;,&quot;id&quot;:844505243538931714,&quot;id_str&quot;:&quot;844505243538931714&quot;,&quot;text&quot;:&quot;Took my Goddaughter to meet the pope. She stole his hat! https:\/\/t.co\/SdSorop3uN&quot;,&quot;truncated&quot;:false,&quot;entities&quot;:{&quot;hashtags&quot;:[],&quot;symbols&quot;:[],&quot;user_mentions&quot;:[],&quot;urls&quot;:[],&quot;media&quot;:[{&quot;id&quot;:844504104512749568,&quot;id_str&quot;:&quot;844504104512749568&quot;,&quot;indices&quot;:[57,80],&quot;media_url&quot;:&quot;http:\/\/pbs.twimg.com\/ext_tw_video_thumb\/844504104512749568\/pu\/img\/FFt3qkbeOh0RlGfZ.jpg&quot;,&quot;media_url_https&quot;:&quot;https:\/\/pbs.twimg.com\/ext_tw_video_thumb\/844504104512749568\/pu\/img\/FFt3qkbeOh0RlGfZ.jpg&quot;,&quot;url&quot;:&quot;https:\/\/t.co\/SdSorop3uN&quot;,&quot;display_url&quot;:&quot;pic.twitter.com\/SdSorop3uN&quot;,&quot;expanded_url&quot;:&quot;https:\/\/twitter.com\/MountainButorac\/status\/844505243538931714\/video\/1&quot;,&quot;type&quot;:&quot;photo&quot;,&quot;sizes&quot;:{&quot;small&quot;:{&quot;w&quot;:340,&quot;h&quot;:604,&quot;resize&quot;:&quot;fit&quot;},&quot;thumb&quot;:{&quot;w&quot;:150,&quot;h&quot;:150,&quot;resize&quot;:&quot;crop&quot;},&quot;large&quot;:{&quot;w&quot;:576,&quot;h&quot;:1024,&quot;resize&quot;:&quot;fit&quot;},&quot;medium&quot;:{&quot;w&quot;:576,&quot;h&quot;:1024,&quot;resize&quot;:&quot;fit&quot;}}}]},&quot;source&quot;:&quot;\u003ca href=\&quot;http:\/\/twitter.com\/download\/iphone\&quot; rel=\&quot;nofollow\&quot;\u003eTwitter for iPhone\u003c\/a\u003e&quot;,&quot;in_reply_to_status_id&quot;:null,&quot;in_reply_to_status_id_str&quot;:null,&quot;in_reply_to_user_id&quot;:null,&quot;in_reply_to_user_id_str&quot;:null,&quot;in_reply_to_screen_name&quot;:null,&quot;geo&quot;:null,&quot;coordinates&quot;:null,&quot;place&quot;:null,&quot;contributors&quot;:null,&quot;retweet_count&quot;:0,&quot;favorite_count&quot;:0,&quot;favorited&quot;:false,&quot;retweeted&quot;:false,&quot;possibly_sensitive&quot;:false,&quot;lang&quot;:&quot;en&quot;},&quot;show_cookie_override_all&quot;:true,&quot;video_session_enabled&quot;:false,&quot;media_id&quot;:&quot;844504104512749568&quot;,&quot;view_counts&quot;:null,&quot;statusTimestamp&quot;:{&quot;local&quot;:&quot;4:05 AM - 22 Mar 2017&quot;},&quot;media_type&quot;:1,&quot;user&quot;:{&quot;screen_name&quot;:&quot;MountainButorac&quot;,&quot;name&quot;:&quot;Mountain Butorac&quot;,&quot;profile_image_url&quot;:&quot;https:\/\/pbs.twimg.com\/profile_images\/808318456701521920\/vBvlAASx_bigger.jpg&quot;},&quot;watch_now_cta_url&quot;:null,&quot;tweet_id&quot;:&quot;844505243538931714&quot;}" data-source-type="consumer">
Run Code Online (Sandbox Code Playgroud)

2.在notepad++中复制粘贴上面的代码。替换记事本++中的所有&quot;with"\/wth /。(使用 CTRL+H)

你会得到类似的东西

{
    "is_360": false,
    "duration": 28617,
    "scribe_widget_origin": true,
    "heartbeatEnabled": true,
    "video_url": "https://video.twimg.com/ext_tw_video/844504104512749568/pu/pl/e91Du5N2TZ09ZaW_.m3u8",

    "disable_embed": "0",
    "videoInfo": {
        "title": null,
        "description": null,
        "publisher": {
            "screen_name": "MountainButorac",
            "name": "Mountain Butorac",
            "profile_image_url": "https://pbs.twimg.com/profile_images/808318456701521920/vBvlAASx_normal.jpg"
        }
    },
    "cardUrl": "https://t.co/SdSorop3uN",
    "content_type": "application/x-mpegURL",
    "owner_id": "14120461",
    "looping_enabled": true,
    "show_cookie_override_en": true,
    "visit_cta_url": null,
    "scribe_playlist_url": "https://twitter.com/MountainButorac/status/844505243538931714/video/1",
    "source_type": "consumer",
    "image_src": "https://pbs.twimg.com/ext_tw_video_thumb/844504104512749568/pu/img/FFt3qkbeOh0RlGfZ.jpg",
    "heartbeatIntervalInMs": 5000.0,
    "use_tfw_live_heartbeat_event_category": true,
    "video_loading_timeout": 45000.0,
    "status": {
        "created_at": "Wed Mar 22 11:05:14 +0000 2017",
        "id": 844505243538931714,
        "id_str": "844505243538931714",
        "text": "Took my Goddaughter to meet the pope. She stole his hat! https://t.co/SdSorop3uN",
        "truncated": false,
        "entities": {
            "hashtags": [],
            "symbols": [],
            "user_mentions": [],
            "urls": [],
            "media": [{
                "id": 844504104512749568,
                "id_str": "844504104512749568",
                "indices": [57, 80],
                "media_url": "http://pbs.twimg.com/ext_tw_video_thumb/844504104512749568/pu/img/FFt3qkbeOh0RlGfZ.jpg",
                "media_url_https": "https://pbs.twimg.com/ext_tw_video_thumb/844504104512749568/pu/img/FFt3qkbeOh0RlGfZ.jpg",
                "url": "https://t.co/SdSorop3uN",
                "display_url": "pic.twitter.com/SdSorop3uN",
                "expanded_url": "https://twitter.com/MountainButorac/status/844505243538931714/video/1",
                "type": "photo",
                "sizes": {
                    "small": {
                        "w": 340,
                        "h": 604,
                        "resize": "fit"
                    },
                    "thumb": {
                        "w": 150,
                        "h": 150,
                        "resize": "crop"
                    },
                    "large": {
                        "w": 576,
                        "h": 1024,
                        "resize": "fit"
                    },
                    "medium": {
                        "w": 576,
                        "h": 1024,
                        "resize": "fit"
                    }
                }
            }]
        },
        "source": "\u003ca href=\"http://twitter.com/download/iphone\" rel=\"nofollow\"\u003eTwitter for iPhone\u003c/a\u003e",
        "in_reply_to_status_id": null,
        "in_reply_to_status_id_str": null,
        "in_reply_to_user_id": null,
        "in_reply_to_user_id_str": null,
        "in_reply_to_screen_name": null,
        "geo": null,
        "coordinates": null,
        "place": null,
        "contributors": null,
        "retweet_count": 0,
        "favorite_count": 0,
        "favorited": false,
        "retweeted": false,
        "possibly_sensitive": false,
        "lang": "en"
    },
    "show_cookie_override_all": true,
    "video_session_enabled": false,
    "media_id": "844504104512749568",
    "view_counts": null,
    "statusTimestamp": {
        "local": "4:05 AM - 22 Mar 2017"
    },
    "media_type": 1,
    "user": {
        "screen_name": "MountainButorac",
        "name": "Mountain Butorac",
        "profile_image_url": "https://pbs.twimg.com/profile_images/808318456701521920/vBvlAASx_bigger.jpg"
    },
    "watch_now_cta_url": null,
    "tweet_id": "844505243538931714"
}
Run Code Online (Sandbox Code Playgroud)

从上面的 JSON 格式,看到值video_url

https://video.twimg.com/ext_tw_video/844504104512749568/pu/pl/e91Du5N2TZ09ZaW_.m3u8
Run Code Online (Sandbox Code Playgroud)

这里的问题是,在 2016 年 8 月 1 日之后,Twitter 不再使用 .mp4 视频,而是转换为新的 HLS、自适应流格式,文件扩展名为.m3u8

.m3u8 文件基本上只是一个文本文件包装器,它们非常小(300-500 字节),当您使用文本编辑器打开它们时,它们包含指向不同视频大小的链接

  1. 在记事本++中打开文件m3u8,它会包含这样的代码

EXTM3U EXT-X-INDEPENDENT-SEGMENTS EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=256000,RESOLUTION=180x320,CODECS="mp4a.40.2,avc1.42001f" /ext_tw508175957595 180x320 / _Z42SY5zwMlLdFYx.m3u8 EXT-X-STREAM-INF:PROGRAM-ID = 1,带宽= 832000,RESOLUTION =为360x640,CODECS = “mp4a.40.2,avc1.42001f” / ext_tw_video / 844504104512749568 / PU / PL /为360x640 / - Phfjbbx2yinirLi.m3u8

  1. 根据您的分辨率需要从上面复制相应的链接。重复相同的步骤,直到您拥有.ts文件。下载.ts文件(视频文件)。

  • 嘿,在第 4 步中,“复制相应链接”是什么意思?它不是一个有效的 URL,我无法找到如何使用它获取视频。编辑:好的,对,我找到了。你应该提到你必须在它前面加上“https://video.twimg.com”并访问 URL。 (4认同)