mirror of
https://github.com/soimort/you-get.git
synced 2025-01-23 21:45:02 +03:00
[twitter] support embedded Vine
This commit is contained in:
parent
20e9ef4708
commit
2fcfcd0488
@ -3,6 +3,7 @@
|
||||
__all__ = ['twitter_download']
|
||||
|
||||
from ..common import *
|
||||
from .vine import vine_download
|
||||
|
||||
def twitter_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
|
||||
html = get_html(url)
|
||||
@ -13,7 +14,12 @@ def twitter_download(url, output_dir='.', merge=True, info_only=False, **kwargs)
|
||||
icards = r1(r'data-src="([^"]*)"', html)
|
||||
if icards:
|
||||
html = get_html("https://twitter.com" + icards)
|
||||
data = json.loads(unescape_html(r1(r'data-player-config="([^"]*)"', html)))
|
||||
data_player_config = r1(r'data-player-config="([^"]*)"', html)
|
||||
if data_player_config is None:
|
||||
vine_src = r1(r'<iframe src="([^"]*)"', html)
|
||||
vine_download(vine_src, output_dir=output_dir, merge=merge, info_only=info_only)
|
||||
return
|
||||
data = json.loads(unescape_html(data_player_config))
|
||||
source = data['playlist'][0]['source']
|
||||
else:
|
||||
source = r1(r'<source video-src="([^"]*)"', html)
|
||||
|
Loading…
Reference in New Issue
Block a user