mirror of
https://github.com/soimort/you-get.git
synced 2025-02-02 16:24:00 +03:00
[twitter] fix extraction (x.com)
This commit is contained in:
parent
a4d34ff6b1
commit
57f6502e80
@ -376,7 +376,7 @@ Use `--url`/`-u` to get a list of downloadable resource URLs extracted from the
|
|||||||
| Site | URL | Videos? | Images? | Audios? |
|
| Site | URL | Videos? | Images? | Audios? |
|
||||||
| :--: | :-- | :-----: | :-----: | :-----: |
|
| :--: | :-- | :-----: | :-----: | :-----: |
|
||||||
| **YouTube** | <https://www.youtube.com/> |✓| | |
|
| **YouTube** | <https://www.youtube.com/> |✓| | |
|
||||||
| **Twitter** | <https://twitter.com/> |✓|✓| |
|
| **X (Twitter)** | <https://x.com/> |✓|✓| |
|
||||||
| VK | <http://vk.com/> |✓|✓| |
|
| VK | <http://vk.com/> |✓|✓| |
|
||||||
| Vine | <https://vine.co/> |✓| | |
|
| Vine | <https://vine.co/> |✓| | |
|
||||||
| Vimeo | <https://vimeo.com/> |✓| | |
|
| Vimeo | <https://vimeo.com/> |✓| | |
|
||||||
|
@ -113,6 +113,7 @@ SITES = {
|
|||||||
'veoh' : 'veoh',
|
'veoh' : 'veoh',
|
||||||
'vine' : 'vine',
|
'vine' : 'vine',
|
||||||
'vk' : 'vk',
|
'vk' : 'vk',
|
||||||
|
'x' : 'twitter',
|
||||||
'xiaokaxiu' : 'yixia',
|
'xiaokaxiu' : 'yixia',
|
||||||
'xiaojiadianvideo' : 'fc2video',
|
'xiaojiadianvideo' : 'fc2video',
|
||||||
'ximalaya' : 'ximalaya',
|
'ximalaya' : 'ximalaya',
|
||||||
@ -1856,9 +1857,12 @@ def url_to_module(url):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
location = get_location(url) # t.co isn't happy with fake_headers
|
try:
|
||||||
|
location = get_location(url) # t.co isn't happy with fake_headers
|
||||||
|
except:
|
||||||
|
location = get_location(url, headers=fake_headers)
|
||||||
except:
|
except:
|
||||||
location = get_location(url, headers=fake_headers)
|
location = get_location(url, headers=fake_headers, get_method='GET')
|
||||||
|
|
||||||
if location and location != url and not location.startswith('/'):
|
if location and location != url and not location.startswith('/'):
|
||||||
return url_to_module(location)
|
return url_to_module(location)
|
||||||
|
@ -34,9 +34,9 @@ def twitter_download(url, output_dir='.', merge=True, info_only=False, **kwargs)
|
|||||||
**kwargs)
|
**kwargs)
|
||||||
return
|
return
|
||||||
|
|
||||||
m = re.match('^https?://(mobile\.)?twitter\.com/([^/]+)/status/(\d+)', url)
|
m = re.match('^https?://(mobile\.)?(x|twitter)\.com/([^/]+)/status/(\d+)', url)
|
||||||
assert m
|
assert m
|
||||||
screen_name, item_id = m.group(2), m.group(3)
|
screen_name, item_id = m.group(3), m.group(4)
|
||||||
page_title = "{} [{}]".format(screen_name, item_id)
|
page_title = "{} [{}]".format(screen_name, item_id)
|
||||||
|
|
||||||
# FIXME: this API won't work for protected or nsfw contents
|
# FIXME: this API won't work for protected or nsfw contents
|
||||||
@ -77,6 +77,6 @@ def twitter_download(url, output_dir='.', merge=True, info_only=False, **kwargs)
|
|||||||
# TODO: should we deal with quoted tweets?
|
# TODO: should we deal with quoted tweets?
|
||||||
|
|
||||||
|
|
||||||
site_info = "Twitter.com"
|
site_info = "X.com"
|
||||||
download = twitter_download
|
download = twitter_download
|
||||||
download_playlist = playlist_not_supported('twitter')
|
download_playlist = playlist_not_supported('twitter')
|
||||||
|
Loading…
Reference in New Issue
Block a user