You can use a Embetty server for Twitter:
https://github.com/heiseonline/embetty

For videos, use (use youtube-dl to download):
https://www.ctrl.blog/entry/stop-embedding.html

You don’t need Google Analytics.
If you really need analytics, open source self-hostable solutions exist, such as Plausible Analytics and Matomo (formerly Piwik).