How to download video with blob url?
I am trying to download video with src url blob:https%3A//www.youtube.com/23aea5c8-9ae2-40dc-9417-e675ea99b386
.
Is there a process that can be followed to download all this type of videos?
I found a way to download the video with blob url
in Vimeo
(reading here i understood how doing it). I write the simple steps here.
I'm using Google Chrome:
- Open the
More Tools
→Developer Tools
-
Check if in the video tag there is something like this:
<video preload="" src="blob:https://player.vimeo.com/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"></video>
- Copy the src of the iframe tag, if any, something like
http://player.vimeo.com/video/XYZ
if you found it you can go straight to the point 7, otherwise follow steps 4, 5, 6. -
Now look for this string
https://skyfire.vimeocdn.com/.../master.json?base64_init=1
inside the page (using the Developer View), you should found it inside a javascript function, like this:(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":"
-
Copy the link inside the url field on a new Chrome tab, for example
https://48skyfiregce-a.akamaihd.net/.../master.json?base64_init=1
end open it with a browser, it will open you a json file like this:{ "clip_id": XYZ, "base_url": "../", "video": [ { ... ... ...
Now compose a url with your id
XYZ
like this:https://player.vimeo.com/video/XYZ
- Replace
blob:https://player.vimeo.com/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
inside the video tag with that last url (the one created in the previous step #6). -
Now you will notice that magically the src field inside of the video tag changed (if it does not, try step 7 multiple times)...
<video preload="none" src="https://fpdl.vimeocdn.com/vimeo-prod-skyfire-std-us/XX/XXX/X/XXXXXXXX/XXXXXXXXX.mp4?token=abcdefg"></video>
Use that new link to dowload it directly, it's something like this: https://fpdl.vimeocdn.com/vimeo-prod-skyfire-std-us/XX/XXX/X/XXXXXXXX/XXXXXXXXX.mp4?token=abcdefg
<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>
I also had blob:
URL in video/@src
, but by watching Developer tools
> Network
during playback it turned out that video/source/@src
was URL for m3u8
playlist.
An m3u8
-backed video can be readily downloaded by either:
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 sounds like the binary you want to get but there might be easier way to get the video. Just check out Network tab in Dev tools while you play the video to see what you are actually fetching.
This answer is for Twitter URLs -
- Right click on the video and click Inspect Elements -
You'll find a code like this
<div id="playerContainer" class="player-container full-screen-enabled" data-config="{"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"}" data-source-type="consumer">
2.Copy Paste above code in notepad++. Replace all the "
with "
and \/
wth /
in notepad++. (Use CTRL+H)
You'll get something like
{
"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"
}
From above JSON format, see the value video_url
https://video.twimg.com/ext_tw_video/844504104512749568/pu/pl/e91Du5N2TZ09ZaW_.m3u8
The issue here is, after August 1st, 2016, Twitter is no longer using .mp4 videos, but converting to a new HLS, adaptive-streaming format, with a .m3u8 file extension.
.m3u8 files are basically just a text file wrapper, they are super small (300-500 bytes), and when you open them with a text editor, they contain links to different video sizes
- Open the file m3u8 in notepad++, it would contain code like this
EXTM3U EXT-X-INDEPENDENT-SEGMENTS EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=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,BANDWIDTH=832000,RESOLUTION=360x640,CODECS="mp4a.40.2,avc1.42001f" /ext_tw_video/844504104512749568/pu/pl/360x640/-Phfjbbx2yinirLi.m3u8
- Copy the respective link from above as per your resolution need. Repeat the same step until you have .ts file. Download the .ts file (the video file).
This is what worked for me using Chrome, but I would think any browser that has "Developer Tools" would work. I hope this helps all of humanity...
Go to the web page with the embedded video. Open up Developer Tools (for Chrome it's Right-Click | Inspect. For Firefox it's Right-Click | Inspect Element.
On the top of the Inspector, there will be a bunch of tabs. Select the Network tab. Look for the Headers tab. If the video auto-starts, you may have to stop it. Also click the Record (red circle icon far left under the Network tab. You'll want to stop recording.
When the page has completely loaded, click the Record button, and on the video, click Play. You'll see a bunch of requests/responses show up in the Headers area. You're looking for a request with the playlist (.m3u8) for the video. The URL should look something like this in the Headers section
https://cdnapisec.kaltura.com/p/1289861/sp/0/playManifest/entryId/1_zb2s80ga/format/applehttp/protocol/https/a.m3u8
Copy/paste that link into your browser, and at least in Chrome, that file (a.m3u8) will be downloaded. The filename for your site may differ.
Go to where you saved that file and open it with VLC. Select Media | Convert / Save. Click the Add... button and find the .m3u8 file you just downloaded. Click Open. Click on the Convert / Save button. Make sure Convert is selected, and click Browse to set the destination of the converted file.
Click the Automatically select filename extension (.mp4) in the bottom left of the window, and click Save. Select Start and you should see the video play, and once that's done, the MP4 video should be in your save location.
Good luck.