Twitter has an option to right-click on a video and "copy video address" but this button seems to be broken as it doesn't copy anything to the clipboard, even after I disable Ghostery/adblock. I wanted to find the link directly in the html source but I can't seem to do so. Does anyone know how to do this? A previous post from a while ago suggested looking for "video_url" but that keyword doesn't seem to be anywhere in the source

  • 1
    How is this related to RE? – sudhackar Dec 24 '18 at 3:38
  • If Twitter has an option to copy video URL, it's likely that your environment/browser/etc. is broken, and the best solution is to fix those, which is not related to RE. – user202729 Dec 24 '18 at 10:35
  • Although I don't get the close reason either. Obviously this is unrelated to software development. – user202729 Dec 24 '18 at 10:35
  • I think this is on-topic, similar to how one would discover URLs accessed by a malicious Javascript code. – Igor Skochinsky Dec 24 '18 at 13:11

I could not quite track how exactly it's done but youtube-dl can do it. Run it with -v or -g to see the final video URL:

C:\Work>C:\Python27\Scripts\youtube-dl.exe -v https://twitter.com/starwars/status/665052190608723968
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'https://twitter.com/starwars/status/665052190608723968']
[debug] Encodings: locale cp1252, fs mbcs, out cp437, pref cp1252
[debug] youtube-dl version 2018.12.17
[debug] Python version 2.7.12 (CPython) - Windows-7-6.1.7601-SP1
[debug] exe versions: none
[debug] Proxy map: {}
[twitter] 665052190608723968: Downloading webpage
[twitter:card] 665052190608723968: Downloading webpage
[twitter:card] 665052190608723968: Downloading guest token
[twitter:card] 665052190608723968: Downloading JSON metadata
[twitter:card] 665052190608723968: Downloading XML
[debug] Default format spec: best/bestvideo+bestaudio
[debug] Invoking downloader on u'https://video.twimg.com/amplify_video/731129743244828672/vid/1280x720/PbHOy05lC7qXGG8B.mp4'
[download] Destination: Star Wars - A new beginning is coming December 18. Watch the official 60 second #TV spot for #StarWars - #TheForceAwak
[download] 100% of 10.06MiB in 00:00

Code for this extractor can be found in youtube-dl/youtube_dl/extractor/twitter.py in the source repository.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.