1

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

4
  • 1
    How is this related to RE?
    – sudhackar
    Dec 24, 2018 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, 2018 at 10:35
  • Although I don't get the close reason either. Obviously this is unrelated to software development.
    – user202729
    Dec 24, 2018 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, 2018 at 13:11

2 Answers 2

4

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
ens.-665052190608723968.mp4
[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.

0

For me this worked:

Copy link to tweet from share Original https://twitter.com/melcasebee/status/1492241106364477445?s=20&t=_yuwSCDzUXbN61Mw5XI0VA

and delete at end of long status number starting at the "?"

Video only: https://twitter.com/melcasebee/status/1492241106364477445

1
  • 1
    This is not the direct link to the video. The link to video have to end with the name of file (e.g . blabla.mp4).
    – MarianD
    Feb 18, 2022 at 0:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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