Spaces:
Paused
Paused
update
Browse files
toolbox/douyin/live/live_recording.py
CHANGED
|
@@ -159,6 +159,11 @@ class LiveRecording(FollowManager):
|
|
| 159 |
return result
|
| 160 |
|
| 161 |
@async_cache_decorator(600)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
async def get_live_info_by_follow(self, room_id: str):
|
| 163 |
result = None
|
| 164 |
live_info_list: List[dict] = await self.get_living_list()
|
|
|
|
| 159 |
return result
|
| 160 |
|
| 161 |
@async_cache_decorator(600)
|
| 162 |
+
@retry(
|
| 163 |
+
wait=wait_fixed(60),
|
| 164 |
+
stop=stop_after_attempt(3),
|
| 165 |
+
before_sleep=before_sleep_log(logger, logging.ERROR),
|
| 166 |
+
)
|
| 167 |
async def get_live_info_by_follow(self, room_id: str):
|
| 168 |
result = None
|
| 169 |
live_info_list: List[dict] = await self.get_living_list()
|
toolbox/porter/tasks/douyin_live_record_task.py
CHANGED
|
@@ -174,7 +174,7 @@ class DouyinLiveRecordTask(BaseTask):
|
|
| 174 |
return None
|
| 175 |
|
| 176 |
try:
|
| 177 |
-
|
| 178 |
except Exception as error:
|
| 179 |
logger.error(f"get_living_list failed; error type: {type(error)}, error text: {str(error)}, traceback: {traceback.format_exc()}")
|
| 180 |
self.success_rate_of_get_live_info_by_follow.append(0)
|
|
@@ -185,10 +185,10 @@ class DouyinLiveRecordTask(BaseTask):
|
|
| 185 |
"title": "",
|
| 186 |
"stream_data": None,
|
| 187 |
}
|
| 188 |
-
for
|
| 189 |
-
room_id_ =
|
| 190 |
if room_id_ == self.room_id:
|
| 191 |
-
result =
|
| 192 |
break
|
| 193 |
self.success_rate_of_get_live_info_by_follow.append(1)
|
| 194 |
return result
|
|
|
|
| 174 |
return None
|
| 175 |
|
| 176 |
try:
|
| 177 |
+
living_list: List[dict] = await self.douyin_client.get_living_list()
|
| 178 |
except Exception as error:
|
| 179 |
logger.error(f"get_living_list failed; error type: {type(error)}, error text: {str(error)}, traceback: {traceback.format_exc()}")
|
| 180 |
self.success_rate_of_get_live_info_by_follow.append(0)
|
|
|
|
| 185 |
"title": "",
|
| 186 |
"stream_data": None,
|
| 187 |
}
|
| 188 |
+
for live_data in living_list:
|
| 189 |
+
room_id_ = live_data["room_id"]
|
| 190 |
if room_id_ == self.room_id:
|
| 191 |
+
result = live_data
|
| 192 |
break
|
| 193 |
self.success_rate_of_get_live_info_by_follow.append(1)
|
| 194 |
return result
|
toolbox/porter/tasks/douyin_live_to_bilibili_live_task.py
CHANGED
|
@@ -106,7 +106,7 @@ class DouyinLiveToBilibiliLiveTask(BaseTask):
|
|
| 106 |
return None
|
| 107 |
|
| 108 |
try:
|
| 109 |
-
|
| 110 |
except Exception as error:
|
| 111 |
logger.error(f"get_living_list failed; error type: {type(error)}, error text: {str(error)}, traceback: {traceback.format_exc()}")
|
| 112 |
self.success_rate_of_get_live_info_by_follow.append(0)
|
|
@@ -117,10 +117,10 @@ class DouyinLiveToBilibiliLiveTask(BaseTask):
|
|
| 117 |
"title": "",
|
| 118 |
"stream_data": None,
|
| 119 |
}
|
| 120 |
-
for
|
| 121 |
-
room_id_ =
|
| 122 |
if room_id_ == self.room_id:
|
| 123 |
-
result =
|
| 124 |
break
|
| 125 |
self.success_rate_of_get_live_info_by_follow.append(1)
|
| 126 |
return result
|
|
|
|
| 106 |
return None
|
| 107 |
|
| 108 |
try:
|
| 109 |
+
living_list: List[dict] = await self.douyin_client.get_living_list()
|
| 110 |
except Exception as error:
|
| 111 |
logger.error(f"get_living_list failed; error type: {type(error)}, error text: {str(error)}, traceback: {traceback.format_exc()}")
|
| 112 |
self.success_rate_of_get_live_info_by_follow.append(0)
|
|
|
|
| 117 |
"title": "",
|
| 118 |
"stream_data": None,
|
| 119 |
}
|
| 120 |
+
for live_data in living_list:
|
| 121 |
+
room_id_ = live_data["room_id"]
|
| 122 |
if room_id_ == self.room_id:
|
| 123 |
+
result = live_data
|
| 124 |
break
|
| 125 |
self.success_rate_of_get_live_info_by_follow.append(1)
|
| 126 |
return result
|