diff --git a/dmarchiver/__init__.py b/dmarchiver/__init__.py index 4b1fc9f..a35614b 100644 --- a/dmarchiver/__init__.py +++ b/dmarchiver/__init__.py @@ -5,4 +5,4 @@ without having to deal with the API limitations. """ -__version__ = "0.2.2" +__version__ = "0.2.3" diff --git a/dmarchiver/core.py b/dmarchiver/core.py index c1887e2..fbe463c 100644 --- a/dmarchiver/core.py +++ b/dmarchiver/core.py @@ -519,7 +519,7 @@ def _parse_dm_media( shutil.copyfileobj(response.raw, file) elif len(gif_url) > 0: media_type = MediaType.gif - media_style = gif_url[0].find('div').get('style') + media_style = gif_url[0].cssselect('div.PlayableMedia-player')[0].get('style') media_preview_url = re.findall(r'url\(\'(.*?)\'\)', media_style)[0] media_url = media_preview_url.replace( 'dm_gif_preview', 'dm_gif').replace('.jpg', '.mp4') @@ -537,7 +537,7 @@ def _parse_dm_media( shutil.copyfileobj(response.raw, file) elif len(video_url) > 0: media_type = MediaType.video - media_style = video_url[0].find('div').get('style') + media_style = video_url[0].cssselect('div.PlayableMedia-player')[0].get('style') media_preview_url = re.findall(r'url\(\'(.*?)\'\)', media_style)[0] media_url = 'https://twitter.com/i/videos/dm/' + tweet_id video_url = 'https://mobile.twitter.com/messages/media/' + tweet_id