Rob-- / SnapWrap

Wrapper for the unofficial and undocumented Snapchat API (using Snapchat's latest endpoints).
MIT License
57 stars 7 forks source link

Crashes on videos with text #13

Closed jkaberg closed 5 years ago

jkaberg commented 9 years ago

When reciving a snapvideo (with text! videos without text works) and realying it to story (see code below) the bot crashes, any suggestions?

from SnapWrap import Snapchat

class CustomBot(Snapchat): def on_snap(self, sender, snap): self.post_story(snap)

bot = CustomBot(*["xxx", "xxxx"]) bot.begin()

Debug log

Traceback (most recent call last): File "/opt/snapbot/snapbot.py", line 8, in bot.begin() File "/opt/snapbot/SnapWrap/snapchat.py", line 43, in begin self.on_snap(snap.sender, snap) File "/opt/snapbot/snapbot.py", line 7, in on_snap self.post_story(snap) File "/opt/snapbot/SnapWrap/snapchat.py", line 108, in post_story snap.upload(self) File "/opt/snapbot/SnapWrap/snap.py", line 40, in upload self.media_id = bot.client.upload(self.file.name) File "/opt/snapbot/SnapWrap/Client/init.py", line 453, in upload raise ValueError('Could not determine media type for given data.') ValueError: Could not determine media type for given data.

jkaberg commented 9 years ago

ping @danwatco @Rob--

ObjectiveTruth commented 9 years ago

Its because when there's an overlay, snapchat sends a file which is a zip containing the original mp4 and an overlay with it. When ffmpeg tries to read it, it rightly fails since its a zip file not an MP4.

My pull request https://github.com/Rob--/SnapWrap/pull/11 should take care of this once its accepted

danwatco commented 9 years ago

Sorry for the slow reply @jkaberg

@ObjectiveTruth is correct, we'll look at the pull request and get it merged as soon as we can and close this issue!