mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-14 01:07:14 +00:00
[twitter] Don't fail if the description doesn't contain an URL (fixes #7489)
This commit is contained in:
parent
b84a5f0337
commit
b703ebeeaf
@ -147,6 +147,17 @@ class TwitterIE(InfoExtractor):
|
|||||||
'uploader': 'Gifs',
|
'uploader': 'Gifs',
|
||||||
'uploader_id': 'giphz',
|
'uploader_id': 'giphz',
|
||||||
},
|
},
|
||||||
|
}, {
|
||||||
|
'url': 'https://twitter.com/starwars/status/665052190608723968',
|
||||||
|
'md5': '39b7199856dee6cd4432e72c74bc69d4',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '665052190608723968',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Star Wars - A new beginning is coming December 18. Watch the official 60 second #TV spot for #StarWars: #TheForceAwakens.',
|
||||||
|
'description': 'Star Wars on Twitter: "A new beginning is coming December 18. Watch the official 60 second #TV spot for #StarWars: #TheForceAwakens."',
|
||||||
|
'uploader_id': 'starwars',
|
||||||
|
'uploader': 'Star Wars',
|
||||||
|
},
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@ -158,17 +169,16 @@ class TwitterIE(InfoExtractor):
|
|||||||
|
|
||||||
username = remove_end(self._og_search_title(webpage), ' on Twitter')
|
username = remove_end(self._og_search_title(webpage), ' on Twitter')
|
||||||
|
|
||||||
title = self._og_search_description(webpage).strip('').replace('\n', ' ')
|
title = description = self._og_search_description(webpage).strip('').replace('\n', ' ').strip('“”')
|
||||||
|
|
||||||
# strip 'https -_t.co_BJYgOjSeGA' junk from filenames
|
# strip 'https -_t.co_BJYgOjSeGA' junk from filenames
|
||||||
mobj = re.match(r'“(.*)\s+(https?://[^ ]+)”', title)
|
title = re.sub(r'\s+(https?://[^ ]+)', '', title)
|
||||||
title, short_url = mobj.groups()
|
|
||||||
|
|
||||||
info = {
|
info = {
|
||||||
'uploader_id': user_id,
|
'uploader_id': user_id,
|
||||||
'uploader': username,
|
'uploader': username,
|
||||||
'webpage_url': url,
|
'webpage_url': url,
|
||||||
'description': '%s on Twitter: "%s %s"' % (username, title, short_url),
|
'description': '%s on Twitter: "%s"' % (username, description),
|
||||||
'title': username + ' - ' + title,
|
'title': username + ' - ' + title,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user