isaackogan / TikTokLive

Python library to receive live stream events (comments, gifts, etc.) in realtime from TikTok LIVE.
https://isaackogan.github.io/TikTokLive/
MIT License
897 stars 176 forks source link

Download stopped no exception #223

Closed int3debug closed 1 month ago

int3debug commented 5 months ago

Describe the bug

Download from stream sometimes stops for no reason I can see. I tried with DEBUG level but couldn't see any problem either Comment I still get only Stream stop downloading

Expected Behaviour

Shouldn't stop without reason

Actual Behaviour

If applicable, include screenshots!

[TikTokLive] DEBUG from v.l.p.s.w.l.protocol.py:1172 — < BINARY 08 9b 05 10 cb f3 e9 91 b0 c9 d6 f8 2f 18 b8 45 ... 31 2a 01 2d 40 0f 48 01 [302 bytes]
[TikTokLive] DEBUG from v.l.p.s.T.c.w.ws_client.py:67 — Sending ack... WebcastPushFrame(log_id=, payload_type='ack', payload=b'-')
[TikTokLive] DEBUG from v.l.p.s.w.l.protocol.py:1178 — > BINARY 10 cb f3 e9 91 b0 c9 d6 f8 2f 3a 03 61 63 6b 42 01 2d [18 bytes]
[TikTokLive] DEBUG from v.l.p.s.T.c.client.py:238 — Received Event 'WebsocketResponseEvent'.
[TikTokLive] DEBUG from v.l.p.s.T.c.client.py:238 — Received Event 'UnknownEvent'.
[TikTokLive] DEBUG from v.l.p.s.w.l.protocol.py:1172 — < BINARY 08 9c 05 10 fc b2 ef 91 b0 c9 d6 f8 2f 18 b8 45 ... 31 2a 01 2d 40 0f 48 01 [9046 bytes]
[TikTokLive] DEBUG from v.l.p.s.T.c.w.ws_client.py:67 — Sending ack... WebcastPushFrame(log_id=, payload_type='ack', payload=b'-')
[TikTokLive] DEBUG from v.l.p.s.w.l.protocol.py:1178 — > BINARY 10 fc b2 ef 91 b0 c9 d6 f8 2f 3a 03 61 63 6b 42 01 2d [18 bytes]
[TikTokLive] DEBUG from v.l.p.s.T.c.client.py:238 — Received Event 'WebsocketResponseEvent'.
[TikTokLive] DEBUG from v.l.p.s.T.c.client.py:238 — Received Event 'LinkEvent'.
[TikTokLive] DEBUG from v.l.p.s.T.c.client.py:238 — Received Event 'WebsocketResponseEvent'.
[TikTokLive] DEBUG from v.l.p.s.T.c.client.py:238 — Received Event 'RoomUserSeqEvent'.
[TikTokLive] DEBUG from v.l.p.s.T.c.client.py:238 — Received Event 'WebsocketResponseEvent'.
[TikTokLive] DEBUG from v.l.p.s.T.c.client.py:238 — Received Event 'LikeEvent'.
[TikTokLive] DEBUG from v.l.p.s.w.l.protocol.py:1172 — < BINARY 08 9d 05 10 86 be f2 91 b0 c9 d6 f8 2f 18 b8 45 ... 31 2a 01 2d 40 0f 48 01 [6936 bytes]
[TikTokLive] DEBUG from v.l.p.s.T.c.w.ws_client.py:67 — Sending ack... WebcastPushFrame(log_id=, payload_type='ack', payload=b'-')
[TikTokLive] DEBUG from v.l.p.s.w.l.protocol.py:1178 — > BINARY 10 86 be f2 91 b0 c9 d6 f8 2f 3a 03 61 63 6b 42 01 2d [18 bytes]
[TikTokLive] DEBUG from v.l.p.s.T.c.client.py:238 — Received Event 'WebsocketResponseEvent'.
[TikTokLive] DEBUG from v.l.p.s.T.c.client.py:238 — Received Event 'LinkLayerEvent'.
[TikTokLive] DEBUG from v.l.p.s.T.c.client.py:238 — Received Event 'WebsocketResponseEvent'.
[TikTokLive] DEBUG from v.l.p.s.T.c.client.py:238 — Received Event 'LinkEvent'.
[TikTokLive] DEBUG from v.l.p.s.T.c.client.py:238 — Received Event 'WebsocketResponseEvent'.
[TikTokLive] DEBUG from v.l.p.s.T.c.client.py:238 — Received Event 'RoomUserSeqEvent'.
[TikTokLive] DEBUG from v.l.p.s.w.l.protocol.py:1172 — < BINARY 08 9e 05 10 b0 f7 f2 91 b0 c9 d6 f8 2f 18 b8 45 ... 31 2a 01 2d 40 0f 48 01 [302 bytes]
[TikTokLive] DEBUG from v.l.p.s.T.c.w.ws_client.py:67 — Sending ack... WebcastPushFrame(log_id=, payload_type='ack', payload=b'-')
[TikTokLive] DEBUG from v.l.p.s.w.l.protocol.py:1178 — > BINARY 10 b0 f7 f2 91 b0 c9 d6 f8 2f 3a 03 61 63 6b 42 01 2d [18 bytes]
[TikTokLive] DEBUG from v.l.p.s.T.c.client.py:238 — Received Event 'WebsocketResponseEvent'.
[TikTokLive] DEBUG from v.l.p.s.T.c.client.py:238 — Received Event 'UnknownEvent'.
[TikTokLive] DEBUG from v.l.p.s.w.l.protocol.py:1172 — < BINARY 08 9f 05 10 e9 f5 f5 91 b0 c9 d6 f8 2f 18 b8 45 ... 31 2a 01 2d 40 0f 48 01 [4693 bytes]
[TikTokLive] DEBUG from v.l.p.s.T.c.w.ws_client.py:67 — Sending ack... WebcastPushFrame(log_id=, payload_type='ack', payload=b'-')
[TikTokLive] DEBUG from v.l.p.s.w.l.protocol.py:1178 — > BINARY 10 e9 f5 f5 91 b0 c9 d6 f8 2f 3a 03 61 63 6b 42 01 2d [18 bytes]
[TikTokLive] DEBUG from v.l.p.s.T.c.client.py:238 — Received Event 'WebsocketResponseEvent'.
[TikTokLive] DEBUG from v.l.p.s.T.c.client.py:238 — Received Event 'LikeEvent'.
[TikTokLive] DEBUG from v.l.p.s.w.l.protocol.py:1172 — < BINARY 08 a0 05 10 c9 e5 fd 91 b0 c9 d6 f8 2f 18 b8 45 ... 31 2a 01 2d 40 0f 48 01 [3722 bytes]
[TikTokLive] DEBUG from v.l.p.s.T.c.w.ws_client.py:67 — Sending ack... WebcastPushFrame(log_id=, payload_type='ack', payload=b'-')
[TikTokLive] DEBUG from v.l.p.s.w.l.protocol.py:1178 — > BINARY 10 c9 e5 fd 91 b0 c9 d6 f8 2f 3a 03 61 63 6b 42 01 2d [18 bytes]
[TikTokLive] DEBUG from v.l.p.s.T.c.client.py:238 — Received Event 'WebsocketResponseEvent'.
[TikTokLive] DEBUG from v.l.p.s.T.c.client.py:238 — Received Event 'JoinEvent'.
[TikTokLive] DEBUG from v.l.p.s.w.l.protocol.py:1262 — % sending keepalive ping
[TikTokLive] DEBUG from v.l.p.s.w.l.protocol.py:1178 — > PING 44 75 d4 3b [binary, 4 bytes]
[TikTokLive] INFO from v.l.p.s.T.c.w.r.fetch_video.py:209 — Download stopped for user @"UNIQUE_ID" which started at 1716183878 and lasted for 730 second(s).
[TikTokLive] DEBUG from v.l.p.s.w.l.protocol.py:1172 — < PONG '' [0 bytes]
[TikTokLive] DEBUG from v.l.p.s.w.l.protocol.py:1172 — < BINARY 08 a1 05 10 b9 d9 a2 92 b0 c9 d6 f8 2f 18 b8 45 ... 31 2a 01 2d 40 0f 48 01 [4157 bytes]
[TikTokLive] DEBUG from v.l.p.s.T.c.w.ws_client.py:67 — Sending ack... WebcastPushFrame(log_id=, payload_type='ack', payload=b'-')
[TikTokLive] DEBUG from v.l.p.s.w.l.protocol.py:1178 — > BINARY 10 b9 d9 a2 92 b0 c9 d6 f8 2f 3a 03 61 63 6b 42 01 2d [18 bytes]

Removed log_id in DEBUG log

    def _threaded_recording(self, unique_id: str) -> None:
        """
        The function to run the recording in a different thread.

        :param unique_id: The unique_id of the recorded user (for logging purposes)
        :return: None

        """

        started_at: int = int(datetime.utcnow().timestamp())

        try:
            self._ffmpeg.run()
        except FFRuntimeError as ex:
            if ex.exit_code and ex.exit_code != 255:
                self._ffmpeg = None
                raise

        finish_time: int = int(datetime.utcnow().timestamp())
        record_time: int = finish_time - started_at

        self._logger.info(
            f"Download stopped for user @\"{unique_id}\" which started at {started_at} and lasted "
            f"for {record_time} second(s)."
        )

No exception will occur I tried to find errors but I don't know enough to do so

Package Version

My version of TikTokLive is. TikTokLive==6.0.6

Operating System

Anything Else

If there's anything else, add it here.

isaackogan commented 1 month ago

It's likely stopping because TikTok disconnects you. You just need to reconnect.