You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1004 B
Python

from liveMan import DouyinLiveWebFetcher, DouyinLiveWebReply
from argparse import ArgumentParser
from helper import PromptQueue
from multiprocessing import Process, Event
def parse_args():
parser = ArgumentParser()
parser.add_argument('--live_id', type=str, required=True, help='直播间id')
args = parser.parse_args()
return args
def fetch_user_chat_content(live_id, ws_open_event, queue):
fetcher = DouyinLiveWebFetcher(live_id, ws_open_event, queue)
fetcher.start()
def reply_user_chat_content(queue):
reply = DouyinLiveWebReply(queue)
reply()
if __name__ == '__main__':
args = parse_args()
queue = PromptQueue(1000)
ws_open_event = Event()
fetch_process = Process(target=fetch_user_chat_content, args=(args.live_id, ws_open_event, queue))
reply_process = Process(target=reply_user_chat_content, args=(queue,))
fetch_process.start()
ws_open_event.wait()
reply_process.start()
fetch_process.join()
reply_process.join()