Repository: yt-dlp/yt-dlp

Issue:
Identify onion services with their respective (already yt-dlp supported) websites
### Checklist

- [X] I'm reporting a new site support request
- [X] I've verified that I'm running yt-dlp version **2022.03.08.1**. ([update instructions](https://github.com/yt-dlp/yt-dlp#update))
- [X] I've checked that all provided URLs are alive and playable in a browser
- [X] I've checked that none of provided URLs [violate any copyrights](https://github.com/ytdl-org/youtube-dl#can-you-add-support-for-this-anime-video-site-or-site-which-shows-current-movies-for-free) or contain any [DRM](https://en.wikipedia.org/wiki/Digital_rights_management) to the best of my knowledge
- [X] I've searched the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues including closed ones. DO NOT post duplicates
- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)
- [X] I've read about [sharing account credentials](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#are-you-willing-to-share-account-details-if-needed) and am willing to share it if required

### Region

Tor Network

### Example URLs

- [ ] Twitter has an onion service: https://twitter3e4tixl4xyajtrzo62zg5vztmjuricljdp2c5kshju4avyoid.onion/TwitterBlue/status/1484226494708662273 (source: https://en.wikipedia.org/wiki/Twitter#External_links )
- [x] Facebook has an onion service: https://www.facebookwkhpilnemxj7asaniu7vnjjbiltxjqhye3mhbshg7kx5tfyd.onion/ (source: https://en.wikipedia.org/wiki/Facebook_onion_address )
- [ ] BBC: https://www.bbcnewsd73hkzno2ini43t4gblxvycyac5aw4gnv7t2rccijh7745uqd.onion/


### Description

Identify onion services with their respective (already yt-dlp supported) websites (for example twitter is already supported by yt-dlp but its onion service is dealt with by the fallback generic extractor instead of the twitter specific one)

### Verbose log

```shell
Example for the Twitter onion service:


emily@emily:~/Videos$ yt-dlp https://twitter3e4tixl4xyajtrzo62zg5vztmjuricljdp2c5kshju4avyoid.onion/TwitterBlue/status/1484226494708662273
[generic] 1484226494708662273: Requesting header
WARNING: [generic] Falling back on generic information extractor.
[generic] 1484226494708662273: Downloading webpage
[generic] 1484226494708662273: Extracting information
ERROR: Unsupported URL: https://twitter3e4tixl4xyajtrzo62zg5vztmjuricljdp2c5kshju4avyoid.onion/TwitterBlue/status/1484226494708662273
```
```



Discussion:
Related: https://github.com/ytdl-org/youtube-dl/issues/30736

Especially right now, this is a very significant issue.

There are two aspects here:
1. the extractor needs to recognise the onion URL pattern;
2. as I understand, it needs to use the same base domain when accessing resources from the service, such as APIs, or the extraction will potentially be subject to the same blocking or interception that the user is trying to avoid by using the Tor site.

As far as the listed sites are concerned, the Facebook yt-dlp and yt-dl extractors address point 1 but not point 2. For both yt-dlp and yt-dl, neither Twitter nor BBC Tor sites are handled at all, and although the YouTube extractors know about some Invidious Tor sites point 2 is not addressed.

Depending on how each extractor is structured, it may be possible to patch in support for the Tor site, or it may be easier to make a new or subclass extractor class (or classes).

Resolving patch:
diff --git a/yt_dlp/extractor/twitter.py b/yt_dlp/extractor/twitter.py
--- a/yt_dlp/extractor/twitter.py
+++ b/yt_dlp/extractor/twitter.py
@@ -28,7 +28,7 @@
 
 class TwitterBaseIE(InfoExtractor):
     _API_BASE = 'https://api.twitter.com/1.1/'
-    _BASE_REGEX = r'https?://(?:(?:www|m(?:obile)?)\.)?twitter\.com/'
+    _BASE_REGEX = r'https?://(?:(?:www|m(?:obile)?)\.)?(?:twitter\.com|twitter3e4tixl4xyajtrzo62zg5vztmjuricljdp2c5kshju4avyoid\.onion)/'
     _GUEST_TOKEN = None
 
     def _extract_variant_formats(self, variant, video_id):
@@ -514,6 +514,10 @@ class TwitterIE(TwitterBaseIE):
         },
         'playlist_count': 4,
         'params': {'skip_download': True},
+    }, {
+        # onion route
+        'url': 'https://twitter3e4tixl4xyajtrzo62zg5vztmjuricljdp2c5kshju4avyoid.onion/TwitterBlue/status/1484226494708662273',
+        'only_matching': True,
     }, {
         # Twitch Clip Embed
         'url': 'https://twitter.com/GunB1g/status/1163218564784017422',


Test patch: