def test_post_video(self):
# Reposting https://streamable.com/deltx
video_info_res = urlopen('https://api.streamable.com/videos/deltx')
video_info = json.loads(video_info_res.read().decode('utf8'))
mp4_info = video_info['files']['mp4']
video_url = ('https:' if mp4_info['url'].startswith('//') else '') + mp4_info['url']
video_size = (mp4_info['width'], mp4_info['height'])
thumbnail_url = ('https:' if video_info['thumbnail_url'].startswith('//') else '') + video_info['thumbnail_url']
duration = mp4_info['duration']
video_res = urlopen(video_url)
video_data = video_res.read()
thumb_res = urlopen(thumbnail_url)
thumb_data = thumb_res.read()
results = self.api.post_video(video_data, video_size, duration, thumb_data, caption='<3')
self.assertEqual(results.get('status'), 'ok')
self.assertIsNotNone(results.get('media'))
评论列表
文章目录