mirror of
https://github.com/blackjack4494/yt-dlc.git
synced 2024-12-21 23:33:10 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
3a6a581d94
3 changed files with 21 additions and 0 deletions
|
@ -540,6 +540,7 @@
|
||||||
- **natgeo:video**
|
- **natgeo:video**
|
||||||
- **NationalGeographicTV**
|
- **NationalGeographicTV**
|
||||||
- **Naver**
|
- **Naver**
|
||||||
|
- **Naver:live**
|
||||||
- **NBA**
|
- **NBA**
|
||||||
- **NBC**
|
- **NBC**
|
||||||
- **NBCNews**
|
- **NBCNews**
|
||||||
|
@ -976,6 +977,7 @@
|
||||||
- **twitter:amplify**
|
- **twitter:amplify**
|
||||||
- **twitter:broadcast**
|
- **twitter:broadcast**
|
||||||
- **twitter:card**
|
- **twitter:card**
|
||||||
|
- **twitter:shortener**
|
||||||
- **udemy**
|
- **udemy**
|
||||||
- **udemy:course**
|
- **udemy:course**
|
||||||
- **UDNEmbed**: 聯合影音
|
- **UDNEmbed**: 聯合影音
|
||||||
|
|
|
@ -1268,6 +1268,7 @@ from .twitter import (
|
||||||
TwitterIE,
|
TwitterIE,
|
||||||
TwitterAmplifyIE,
|
TwitterAmplifyIE,
|
||||||
TwitterBroadcastIE,
|
TwitterBroadcastIE,
|
||||||
|
TwitterShortenerIE,
|
||||||
)
|
)
|
||||||
from .udemy import (
|
from .udemy import (
|
||||||
UdemyIE,
|
UdemyIE,
|
||||||
|
|
|
@ -608,3 +608,21 @@ class TwitterBroadcastIE(TwitterBaseIE, PeriscopeBaseIE):
|
||||||
info['formats'] = self._extract_pscp_m3u8_formats(
|
info['formats'] = self._extract_pscp_m3u8_formats(
|
||||||
m3u8_url, broadcast_id, m3u8_id, state, width, height)
|
m3u8_url, broadcast_id, m3u8_id, state, width, height)
|
||||||
return info
|
return info
|
||||||
|
|
||||||
|
|
||||||
|
class TwitterShortenerIE(TwitterBaseIE):
|
||||||
|
IE_NAME = 'twitter:shortener'
|
||||||
|
_VALID_URL = r'https?://t.co/(?P<id>[^?]+)|tco:(?P<eid>[^?]+)'
|
||||||
|
_BASE_URL = 'https://t.co/'
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
eid, id = mobj.group('eid', 'id')
|
||||||
|
if eid:
|
||||||
|
id = eid
|
||||||
|
url = self._BASE_URL + id
|
||||||
|
new_url = self._request_webpage(url, id, headers={'User-Agent': 'curl'}).geturl()
|
||||||
|
__UNSAFE_LINK = "https://twitter.com/safety/unsafe_link_warning?unsafe_link="
|
||||||
|
if new_url.startswith(__UNSAFE_LINK):
|
||||||
|
new_url = new_url.replace(__UNSAFE_LINK, "")
|
||||||
|
return self.url_result(new_url)
|
||||||
|
|
Loading…
Reference in a new issue