題 如何用blob url下載視頻?


我正在嘗試使用src url下載視頻 blob:https%3A//www.youtube.com/23aea5c8-9ae2-40dc-9417-e675ea99b386

是否有可以遵循下載所有此類視頻的流程?


74
2018-01-30 19:43


起源


如果您想下載YouTube視頻,請使用Video Downloadhelper(Firefox)等擴展程序 - Ganesh R.
我想從vimeo網址下載。 - vinesh
Vinesh,嘗試導航到vimeo網站並開始播放您需要下載的視頻。 Video DownloadHelper將檢測它並為您提供下載選項。我嘗試過這個。 - Ganesh R.
我會試試看。謝謝Ganesh。 - vinesh
沒運氣。當我開始播放視頻時,我看到你提到的每個大約2 MB的擴展中的多個視頻建議。當我下載一個部件時,我無法播放那個小文件。我收到文件已損壞的錯誤。 - vinesh


答案:


我找到了一種下載視頻的方法 blob url 在 Vimeo (讀 這裡 我明白這是怎麼做的)。我在這裡寫下簡單的步驟。 我正在使用Google Chrome:

  1. 打開 More Tools → Developer Tools
  2. 檢查視頻代碼中是否有類似這樣的內容:

    <video preload="" src="blob:https://player.vimeo.com/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"></video>
    
  3. 複製iframe標記的src(如果有的話) http://player.vimeo.com/video/XYZ 如果你找到它,你可以直接到第7點,否則按照步驟4,5,6。
  4. 現在尋找這個字符串 https://skyfire.vimeocdn.com/.../master.json?base64_init=1 在頁面內部(使用Developer View),您應該在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":"
    
  5. 例如,複製新Chrome標籤上的網址字段內的鏈接 https://48skyfiregce-a.akamaihd.net/.../master.json?base64_init=1 用瀏覽器打開它,它將打開一個像這樣的json文件:

    {
        "clip_id": XYZ,
        "base_url": "../",
        "video": [
                     { ... ... ...
    
  6. 現在用你的id組成一個url XYZ 像這樣: https://player.vimeo.com/video/XYZ

  7. 更換 blob:https://player.vimeo.com/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX 在視頻標籤內有最後一個網址(在上一步#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>
    
  9. 使用該新鏈接直接下載它,它是這樣的: https://fpdl.vimeocdn.com/vimeo-prod-skyfire-std-us/XX/XXX/X/XXXXXXXX/XXXXXXXXX.mp4?token=abcdefg


58
2017-10-02 10:39



令人印象深刻。你是怎麼想出來的? - gronostaj
在第7步中,你對“html中的最後一個url”是什麼意思? - joaorodr84
工作完美,但訣竅有時你必須多次替換“src”值才能生成下載鏈接。 - Ashrith
目前,對於Vimeo來說,它更容易,並且不需要所有步驟。只需打開Vimeo視頻,找到 <video> 在dev工具中標記DOM結構並進行更改 src 屬性來自 blob:... 至 x。什麼都不會發生 - 這沒關係。現在再改變它,到 y。 Chrome會將其“神奇地”轉換為網址,如步驟8或9中所示。:-) - StanE
@StanE它在Firefox中也像魅力一樣,並且肯定更快...... - ling


這個答案適用於Twitter網址 -

  1. 右鍵單擊視頻,然後單擊Inspect Elements -

你會找到這樣的代碼

<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">

2.複製粘貼在記事本++中的代碼上方。替換所有 &quot; 同 " 和 \/ 問心無愧 / 在記事本++中。 (使用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"
}

從上面的JSON格式,請參閱值 VIDEO_URL

https://video.twimg.com/ext_tw_video/844504104512749568/pu/pl/e91Du5N2TZ09ZaW_.m3u8

這裡的問題是,在2016年8月1日之後,Twitter不再使用.mp4視頻,而是轉換為新的HLS,自適應流式傳輸格式, .m3u8 文件擴展名。

.m3u8文件基本上只是一個文本文件包裝器,它們都是超級的   小(300-500字節),當你用文本編輯器打開它們時,它們   包含指向不同視頻大小的鏈接

  1. 在notepad ++中打開文件m3u8,它將包含這樣的代碼

EXTM3U EXT-X-INDEPENDENT-SEGMENTS   EXT-X-STREAM-INF:PROGRAM-ID = 1,帶寬= 256000,RESOLUTION = 180x320,CODECS =“mp4a.40.2,avc1.42001f”    /ext_tw_video/844504104512749568/pu/pl/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 文件(視頻文件)。

7
2018-03-22 12:48



你是什​​麼意思,“你會得到類似的東西” - 從哪裡來? - User
@User從它上面的代碼開始就好了 <div id="playerContainer" - Pirate X
嘿,在第4步中,“複製相應的鏈接”是什麼意思?它不是有效的網址,我找不到如何使用它獲取視頻。編輯:好的,對,我找到了。你應該提到你必須把“video.twimg.com“在它之前並訪問URL。 - Arno
如果你找不到的話 id="playerContainer" 元素尋找 og:video:url 並打開內容中的URL,並檢查其來源。 - guillefix
另一種方法 推特 是跑 document.querySelector('video').src 在瀏覽器開發者工具控制台選項卡中 - Farzad YZ


我找到了另一種下載視頻的方法 blob url 在 Vimeo (見 其他答案 在這個頁面)。

此解決方案僅適用於只需要不帶視頻的視頻   聽起來!

所以,如果你想下載 只是一個Vimeo視頻 (通常沒有聲音),我可以確認此Google Chrome擴展程序的效果非常好: Flash視頻下載器


0
2017-09-26 14:09