Skip to content

Commit

Permalink
[hotfix] chzzk - requests
Browse files Browse the repository at this point in the history
  • Loading branch information
poriz committed Mar 5, 2024
1 parent d086b55 commit ae99443
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions dags/streaming/stream_data_raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,21 @@ def get_s_list(**kwargs):
def chzzk_raw(current_time, **kwargs):
chzzk_ids = kwargs["ti"].xcom_pull(key="chzzk", task_ids="get_s_list_task")
live_stream_data = []
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'}

for s_id, id in chzzk_ids:
res = requests.get(
f"https://api.chzzk.naver.com/service/v2/channels/{id}/live-detail"
)
f"https://api.chzzk.naver.com/service/v1/channels/{id}",headers=headers
).json()

if res.status_code == 200:
live_data = res.json()
if res['content']['openLive'] != 'false':
live_data = requests.get(
f"https://api.chzzk.naver.com/service/v2/channels/{id}/live-detail",headers=headers).json()
if not live_data["content"]["liveId"]:
time.sleep(5)
live_data = requests.get(
f"https://api.chzzk.naver.com/service/v2/channels/{id}/live-detail"
f"https://api.chzzk.naver.com/service/v2/channels/{id}/live-detail",headers=headers
).json()
try:
live = live_data["content"]["status"]
Expand Down

0 comments on commit ae99443

Please sign in to comment.