runtime.py
2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
from __future__ import annotations
from services.crawler.application import (
MediaCrawlerCommandSpec,
get_default_mediacrawler_runtime_service,
)
EVENT_PREFIX = "BF_EVENT::"
MAX_LOG_LINES = 300
MEDIACRAWLER_RUNTIME_SERVICE = get_default_mediacrawler_runtime_service()
def build_completed_process_kwargs(*, timeout: int | None = None) -> dict[str, object]:
return MEDIACRAWLER_RUNTIME_SERVICE.build_completed_process_kwargs(timeout=timeout)
def build_streaming_process_kwargs() -> dict[str, object]:
return MEDIACRAWLER_RUNTIME_SERVICE.build_streaming_process_kwargs()
def build_login_status_command_spec(
*,
platform: str,
headless: bool,
) -> MediaCrawlerCommandSpec:
return MEDIACRAWLER_RUNTIME_SERVICE.build_login_status_command_spec(
platform=platform,
headless=headless,
)
def build_login_command_spec(
*,
platform: str,
login_type: str,
headless: bool,
cookies: str = "",
phone: str = "",
) -> MediaCrawlerCommandSpec:
return MEDIACRAWLER_RUNTIME_SERVICE.build_login_command_spec(
platform=platform,
login_type=login_type,
headless=headless,
cookies=cookies,
phone=phone,
)
def build_crawl_command_spec(
*,
platform: str,
login_type: str,
crawler_type: str,
keywords: str,
specified_ids: str,
creator_ids: str,
start_page: int,
max_notes: int,
max_comments: int,
enable_comments: bool,
enable_sub_comments: bool,
save_data_option: str | None,
headless: bool,
cookies: str = "",
phone: str = "",
) -> MediaCrawlerCommandSpec:
return MEDIACRAWLER_RUNTIME_SERVICE.build_crawl_command_spec(
platform=platform,
login_type=login_type,
crawler_type=crawler_type,
keywords=keywords,
specified_ids=specified_ids,
creator_ids=creator_ids,
start_page=start_page,
max_notes=max_notes,
max_comments=max_comments,
enable_comments=enable_comments,
enable_sub_comments=enable_sub_comments,
save_data_option=save_data_option,
headless=headless,
cookies=cookies,
phone=phone,
)