rinalLi
...@@ -74,12 +74,37 @@ async def main(): ...@@ -74,12 +74,37 @@ async def main():
74 elif args.platform == SOCIAL_MEDIA_KUAISHOU: 74 elif args.platform == SOCIAL_MEDIA_KUAISHOU:
75 await ks_setup(str(account_file), handle=True) 75 await ks_setup(str(account_file), handle=True)
76 elif args.platform == SOCIAL_MEDIA_WANGYIHAO: 76 elif args.platform == SOCIAL_MEDIA_WANGYIHAO:
77 + await wyh_setup(str(account_file), handle=True, auto=False)
78 + # elif args.platform == SOCIAL_MEDIA_XHS:
79 + # await xhs_setup(str(account_file), handle=True)
77 await wyh_setup(str(account_file), handle=True) 80 await wyh_setup(str(account_file), handle=True)
78 elif args.platform == SOCIAL_MEDIA_XHS: 81 elif args.platform == SOCIAL_MEDIA_XHS:
79 await xhs_setup(str(account_file), handle=True) 82 await xhs_setup(str(account_file), handle=True)
80 elif args.platform == SOCIAL_MEDIA_TOUTIAO: 83 elif args.platform == SOCIAL_MEDIA_TOUTIAO:
81 - await toutiao_setup(str(account_file), handle=True) 84 + await toutiao_setup(str(account_file), handle=True, auto=False)
85 + elif args.platform == SOCIAL_MEDIA_BAIJIAHAO:
86 + await toutiao_setup(str(account_file), handle=True, auto=False)
87 + elif args.platform == SOCIAL_MEDIA_SOHU:
88 + await sohu_setup(str(account_file), handle=True)
89 +
90 + elif args.action == 'auto_login':
91 + print(f"auto Logging in with account {args.account_name} on platform {args.platform}")
92 + if args.platform == SOCIAL_MEDIA_DOUYIN:
93 + await douyin_setup(str(account_file), handle=True)
94 + elif args.platform == SOCIAL_MEDIA_TIKTOK:
95 + await tiktok_setup(str(account_file), handle=True)
96 + elif args.platform == SOCIAL_MEDIA_TENCENT:
97 + await weixin_setup(str(account_file), handle=True)
98 + elif args.platform == SOCIAL_MEDIA_KUAISHOU:
99 + await ks_setup(str(account_file), handle=True)
100 + elif args.platform == SOCIAL_MEDIA_WANGYIHAO:
101 + await wyh_setup(str(account_file), handle=True, auto=True)
102 + # elif args.platform == SOCIAL_MEDIA_XHS:
103 + # await xhs_setup(str(account_file), handle=True)
104 + elif args.platform == SOCIAL_MEDIA_TOUTIAO:
105 + await toutiao_setup(str(account_file), handle=True, auto=True)
82 elif args.platform == SOCIAL_MEDIA_BAIJIAHAO: 106 elif args.platform == SOCIAL_MEDIA_BAIJIAHAO:
107 + await toutiao_setup(str(account_file), handle=True, auto=True)
83 await toutiao_setup(str(account_file), handle=True) 108 await toutiao_setup(str(account_file), handle=True)
84 elif args.platform == SOCIAL_MEDIA_SOHU: 109 elif args.platform == SOCIAL_MEDIA_SOHU:
85 await sohu_setup(str(account_file), handle=True) 110 await sohu_setup(str(account_file), handle=True)
......
...@@ -6,20 +6,20 @@ from utils.log import kuaishou_logger ...@@ -6,20 +6,20 @@ from utils.log import kuaishou_logger
6 from playwright.async_api import Playwright, async_playwright 6 from playwright.async_api import Playwright, async_playwright
7 7
8 8
9 -async def wyh_setup(account_file, handle=False): 9 +async def bjh_setup(account_file, handle=False):
10 print(account_file) 10 print(account_file)
11 account_file = get_absolute_path(account_file, "wyh_uploader") 11 account_file = get_absolute_path(account_file, "wyh_uploader")
12 if not os.path.exists(account_file): 12 if not os.path.exists(account_file):
13 if not handle: 13 if not handle:
14 return False 14 return False
15 kuaishou_logger.info('[+] cookie文件不存在或已失效,即将自动打开浏览器,请扫码登录,登陆后会自动生成cookie文件') 15 kuaishou_logger.info('[+] cookie文件不存在或已失效,即将自动打开浏览器,请扫码登录,登陆后会自动生成cookie文件')
16 - await get_wyh_cookie(account_file) 16 + await get_bjh_cookie(account_file)
17 else: 17 else:
18 - await open_wyh_main_page(account_file) 18 + await open_bjh_main_page(account_file)
19 return True 19 return True
20 20
21 21
22 -async def open_wyh_main_page(account_file): 22 +async def open_bjh_main_page(account_file):
23 async with async_playwright() as playwright: 23 async with async_playwright() as playwright:
24 options = { 24 options = {
25 'args': [ 25 'args': [
...@@ -55,7 +55,7 @@ async def open_wyh_main_page(account_file): ...@@ -55,7 +55,7 @@ async def open_wyh_main_page(account_file):
55 browser.close() 55 browser.close()
56 56
57 57
58 -async def get_wyh_cookie(account_file): 58 +async def get_bjh_cookie(account_file):
59 print("get_wyh_cookie") 59 print("get_wyh_cookie")
60 async with async_playwright() as playwright: 60 async with async_playwright() as playwright:
61 options = { 61 options = {
...@@ -77,6 +77,12 @@ async def get_wyh_cookie(account_file): ...@@ -77,6 +77,12 @@ async def get_wyh_cookie(account_file):
77 # await context.storage_state(path=account_file) 77 # await context.storage_state(path=account_file)
78 78
79 # 自动登陆 79 # 自动登陆
80 - await page.wait_for_timeout(20000) 80 + await page.wait_for_timeout(2000)
81 await page.get_by_text('注册/登录百家号').click() 81 await page.get_by_text('注册/登录百家号').click()
82 - await page.pause() 82 + await page.wait_for_timeout(2000)
83 + await page.locator("//*[@class='pass-text-input pass-text-input-userName']").fill("idiotbc")
84 + await page.wait_for_timeout(2000)
85 + await page.locator("//*[@class='pass-text-input pass-text-input-password']").fill("Liuyihong1023@")
86 + await page.wait_for_timeout(2000)
87 + await page.locator("//*[@class='pass-checkbox-input pass-checkbox-isAgree']").click()
88 + await page.wait_for_timeout(2000)
......
...@@ -99,10 +99,11 @@ class DouYinVideo(object): ...@@ -99,10 +99,11 @@ class DouYinVideo(object):
99 99
100 async def upload(self, playwright: Playwright) -> None: 100 async def upload(self, playwright: Playwright) -> None:
101 # 使用 Chromium 浏览器启动一个浏览器实例 101 # 使用 Chromium 浏览器启动一个浏览器实例
102 - if self.local_executable_path: 102 + # if self.local_executable_path:
103 - browser = await playwright.chromium.launch(headless=False, executable_path=self.local_executable_path) 103 + # browser = await playwright.chromium.launch(headless=True, executable_path=self.local_executable_path)
104 - else: 104 + # else:
105 - browser = await playwright.chromium.launch(headless=False) 105 + print("test")
106 + browser = await playwright.chromium.launch()
106 # 创建一个浏览器上下文,使用指定的 cookie 文件 107 # 创建一个浏览器上下文,使用指定的 cookie 文件
107 context = await browser.new_context(storage_state=f"{self.account_file}") 108 context = await browser.new_context(storage_state=f"{self.account_file}")
108 context = await set_init_script(context) 109 context = await set_init_script(context)
......
...@@ -83,15 +83,15 @@ class KSVideo(object): ...@@ -83,15 +83,15 @@ class KSVideo(object):
83 async def upload(self, playwright: Playwright) -> None: 83 async def upload(self, playwright: Playwright) -> None:
84 # 使用 Chromium 浏览器启动一个浏览器实例 84 # 使用 Chromium 浏览器启动一个浏览器实例
85 print(self.local_executable_path) 85 print(self.local_executable_path)
86 - if self.local_executable_path: 86 + # if self.local_executable_path:
87 - browser = await playwright.chromium.launch( 87 + # browser = await playwright.chromium.launch(
88 - headless=False, 88 + # headless=True,
89 - executable_path=self.local_executable_path, 89 + # executable_path=self.local_executable_path,
90 - ) 90 + # )
91 - else: 91 + # else:
92 - browser = await playwright.chromium.launch( 92 + browser = await playwright.firefox.launch(
93 - headless=False 93 + headless=True
94 - ) # 创建一个浏览器上下文,使用指定的 cookie 文件 94 + ) # 创建一个浏览器上下文,使用指定的 cookie 文件
95 context = await browser.new_context(storage_state=f"{self.account_file}") 95 context = await browser.new_context(storage_state=f"{self.account_file}")
96 context = await set_init_script(context) 96 context = await set_init_script(context)
97 context.on("close", lambda: context.storage_state(path=self.account_file)) 97 context.on("close", lambda: context.storage_state(path=self.account_file))
...@@ -104,19 +104,48 @@ class KSVideo(object): ...@@ -104,19 +104,48 @@ class KSVideo(object):
104 # 等待页面跳转到指定的 URL,没进入,则自动等待到超时 104 # 等待页面跳转到指定的 URL,没进入,则自动等待到超时
105 kuaishou_logger.info('正在打开主页...') 105 kuaishou_logger.info('正在打开主页...')
106 await page.wait_for_url("https://cp.kuaishou.com/article/publish/video") 106 await page.wait_for_url("https://cp.kuaishou.com/article/publish/video")
107 - # 点击 "上传视频" 按钮 107 + # # 点击 "上传视频" 按钮
108 - upload_button = page.locator("button[class^='_upload-btn']") 108 + # upload_button = page.locator("button[class^='_upload-btn']")
109 - await upload_button.wait_for(state='visible') # 确保按钮可见 109 + # await upload_button.wait_for(state='visible') # 确保按钮可见
110 - 110 + #
111 - async with page.expect_file_chooser() as fc_info: 111 + # async with page.expect_file_chooser() as fc_info:
112 - await upload_button.click() 112 + # await upload_button.click()
113 - file_chooser = await fc_info.value 113 + # file_chooser = await fc_info.value
114 - await file_chooser.set_files(self.file_path) 114 + # await file_chooser.set_files(self.file_path)
115 - 115 +
116 - await asyncio.sleep(2) 116 + await page.locator("div[class^='_publish-container'] input").set_input_files(self.file_path)
117 + await asyncio.sleep(5)
118 +
119 + # 判断视频是否上传成功,去除引导页
120 + while True:
121 + # 判断视频是否上传成功,去除引导页
122 + try:
123 + skip_button = page.get_by_role('button', name="Skip", exact=True)
124 + if await skip_button.count():
125 + await skip_button.click()
126 + await asyncio.sleep(1)
127 + else:
128 + await asyncio.sleep(1)
129 + break
130 + except:
131 + kuaishou_logger.info(" [-] 视频正在发布中...")
132 + await asyncio.sleep(0.5)
133 + break
117 134
118 - # if not await page.get_by_text("封面编辑").count(): 135 + if not await page.get_by_text("封面设置").count():
119 - # raise Exception("似乎没有跳转到到编辑页面") 136 + raise Exception("似乎没有跳转到到编辑页面")
137 +
138 + # 等待页面跳转到指定的 URL
139 + # while True:
140 + # # 判断是是否进入视频发布页面,没进入,则自动等待到超时
141 + # try:
142 + # await page.locator('//html/body/div').wait_for(state="attached")
143 + # break
144 + # except:
145 + # kuaishou_logger.info(f' [-] 正在等待进入视频发布页面...')
146 + # await asyncio.sleep(0.1)
147 + # # if not await page.get_by_text("作品描述").count():
148 + # # raise Exception("似乎没有跳转到到编辑页面")
120 149
121 await asyncio.sleep(1) 150 await asyncio.sleep(1)
122 151
......
...@@ -137,7 +137,9 @@ class TencentVideo(object): ...@@ -137,7 +137,9 @@ class TencentVideo(object):
137 137
138 async def upload(self, playwright: Playwright) -> None: 138 async def upload(self, playwright: Playwright) -> None:
139 # 使用 Chromium (这里使用系统内浏览器,用chromium 会造成h264错误 139 # 使用 Chromium (这里使用系统内浏览器,用chromium 会造成h264错误
140 - browser = await playwright.chromium.launch(headless=False, executable_path=self.local_executable_path) 140 + # browser = await playwright.chromium.launch(headless=True, executable_path=self.local_executable_path)
141 + browser = await playwright.firefox.launch(headless=True )
142 +
141 # 创建一个浏览器上下文,使用指定的 cookie 文件 143 # 创建一个浏览器上下文,使用指定的 cookie 文件
142 context = await browser.new_context(storage_state=f"{self.account_file}") 144 context = await browser.new_context(storage_state=f"{self.account_file}")
143 context = await set_init_script(context) 145 context = await set_init_script(context)
...@@ -150,8 +152,9 @@ class TencentVideo(object): ...@@ -150,8 +152,9 @@ class TencentVideo(object):
150 # 等待页面跳转到指定的 URL,没进入,则自动等待到超时 152 # 等待页面跳转到指定的 URL,没进入,则自动等待到超时
151 await page.wait_for_url("https://channels.weixin.qq.com/platform/post/create") 153 await page.wait_for_url("https://channels.weixin.qq.com/platform/post/create")
152 # await page.wait_for_selector('input[type="file"]', timeout=10000) 154 # await page.wait_for_selector('input[type="file"]', timeout=10000)
153 - file_input = page.locator('input[type="file"]') 155 + file_input = await page.locator('input[type="file"]').set_input_files(self.file_path)
154 - await file_input.set_input_files(self.file_path) 156 + await page.wait_for_selector(".cover-img-horizontal",state="attached")
157 + # await file_input.set_input_files(self.file_path)
155 # 填充标题和话题 158 # 填充标题和话题
156 await self.add_title_tags(page) 159 await self.add_title_tags(page)
157 # 添加商品 160 # 添加商品
......
...@@ -6,25 +6,25 @@ from utils.log import kuaishou_logger ...@@ -6,25 +6,25 @@ from utils.log import kuaishou_logger
6 from playwright.async_api import Playwright, async_playwright 6 from playwright.async_api import Playwright, async_playwright
7 7
8 8
9 -async def toutiao_setup(account_file, handle=False): 9 +async def toutiao_setup(account_file, handle=False, auto=False):
10 print(account_file) 10 print(account_file)
11 account_file = get_absolute_path(account_file, "wyh_uploader") 11 account_file = get_absolute_path(account_file, "wyh_uploader")
12 if not os.path.exists(account_file): 12 if not os.path.exists(account_file):
13 if not handle: 13 if not handle:
14 return False 14 return False
15 kuaishou_logger.info('[+] cookie文件不存在或已失效,即将自动打开浏览器,请扫码登录,登陆后会自动生成cookie文件') 15 kuaishou_logger.info('[+] cookie文件不存在或已失效,即将自动打开浏览器,请扫码登录,登陆后会自动生成cookie文件')
16 - await get_wyh_cookie(account_file) 16 + if not auto:
17 + await get_toutiao_cookie(account_file)
18 + else:
19 + await get_toutiao_cookie_auto(account_file)
17 else: 20 else:
18 - await open_wyh_main_page(account_file) 21 + await open_toutiao_main_page(account_file)
19 return True 22 return True
20 23
21 24
22 -async def open_wyh_main_page(account_file): 25 +async def open_toutiao_main_page(account_file):
23 async with async_playwright() as playwright: 26 async with async_playwright() as playwright:
24 options = { 27 options = {
25 - 'args': [
26 - '--lang en-GB'
27 - ],
28 'headless': False, # Set headless option here 28 'headless': False, # Set headless option here
29 } 29 }
30 # Make sure to run headed. 30 # Make sure to run headed.
...@@ -39,8 +39,8 @@ async def open_wyh_main_page(account_file): ...@@ -39,8 +39,8 @@ async def open_wyh_main_page(account_file):
39 browser.close() 39 browser.close()
40 40
41 41
42 -async def get_wyh_cookie(account_file): 42 +async def get_toutiao_cookie_auto(account_file):
43 - print("get_wyh_cookie") 43 + print("get_toutiao_cookie")
44 async with async_playwright() as playwright: 44 async with async_playwright() as playwright:
45 options = { 45 options = {
46 'args': [ 46 'args': [
...@@ -57,24 +57,41 @@ async def get_wyh_cookie(account_file): ...@@ -57,24 +57,41 @@ async def get_wyh_cookie(account_file):
57 page = await context.new_page() 57 page = await context.new_page()
58 await page.goto("https://mp.toutiao.com") 58 await page.goto("https://mp.toutiao.com")
59 59
60 - # 手动授权登录
61 - # await page.pause()
62 - # 点击调试器的继续,保存cookie
63 - # await context.storage_state(path=account_file)
64 -
65 # 自动登陆 60 # 自动登陆
66 - await page.wait_for_timeout(5000) 61 + await page.wait_for_timeout(2000)
67 await page.get_by_text('密码登录').click() 62 await page.get_by_text('密码登录').click()
68 - await page.wait_for_timeout(5000) 63 + await page.wait_for_timeout(2000)
69 64
70 await page.get_by_placeholder("手机号/邮箱").fill('18610534668') 65 await page.get_by_placeholder("手机号/邮箱").fill('18610534668')
71 print("输入账号成功") 66 print("输入账号成功")
72 await page.wait_for_timeout(1000) 67 await page.wait_for_timeout(1000)
73 await page.get_by_placeholder('密码').fill("Liuyihong1023@") 68 await page.get_by_placeholder('密码').fill("Liuyihong1023@")
74 - await page.wait_for_timeout(1000) 69 + await page.wait_for_timeout(2000)
75 await page.locator("//*[@class='web-login-confirm-info__checkbox']").click() 70 await page.locator("//*[@class='web-login-confirm-info__checkbox']").click()
76 - await page.wait_for_timeout(1000) 71 + await page.wait_for_timeout(2000)
77 await page.locator("//*[@class='web-login-button']").click() 72 await page.locator("//*[@class='web-login-button']").click()
78 - await page.wait_for_timeout(10000) 73 + await page.wait_for_timeout(2000)
79 # 点击调试器的继续,保存cookie 74 # 点击调试器的继续,保存cookie
80 await context.storage_state(path=account_file) 75 await context.storage_state(path=account_file)
76 +
77 +
78 +async def get_toutiao_cookie(account_file):
79 + print("get_toutiao_cookie")
80 + async with async_playwright() as playwright:
81 + options = {
82 + 'headless': False, # Set headless option here
83 + }
84 + # Make sure to run headed.
85 + browser = await playwright.chromium.launch(**options)
86 + # Setup context however you like.
87 + context = await browser.new_context() # Pass any options
88 + context = await set_init_script(context)
89 + # Pause the page, and start recording manually.
90 + page = await context.new_page()
91 + await page.goto("https://mp.toutiao.com", {waitUntil: "commit"})
92 +
93 + # 手动授权登录
94 + await page.pause()
95 + # 点击调试器的继续,保存cookie
96 + await context.storage_state(path=account_file)
97 +
......
...@@ -6,20 +6,26 @@ from utils.log import kuaishou_logger ...@@ -6,20 +6,26 @@ from utils.log import kuaishou_logger
6 from playwright.async_api import Playwright, async_playwright 6 from playwright.async_api import Playwright, async_playwright
7 7
8 8
9 -async def wyh_setup(account_file, handle=False): 9 +async def wyh_setup(account_file, handle=False, auto=False):
10 print(account_file) 10 print(account_file)
11 account_file = get_absolute_path(account_file, "wyh_uploader") 11 account_file = get_absolute_path(account_file, "wyh_uploader")
12 if not os.path.exists(account_file): 12 if not os.path.exists(account_file):
13 if not handle: 13 if not handle:
14 return False 14 return False
15 kuaishou_logger.info('[+] cookie文件不存在或已失效,即将自动打开浏览器,请扫码登录,登陆后会自动生成cookie文件') 15 kuaishou_logger.info('[+] cookie文件不存在或已失效,即将自动打开浏览器,请扫码登录,登陆后会自动生成cookie文件')
16 - await get_wyh_cookie(account_file) 16 + if not auto:
17 + await get_wyh_cookie(account_file)
18 + else:
19 + await get_wyh_cookie_auto(account_file)
17 else: 20 else:
18 await open_wyh_main_page(account_file) 21 await open_wyh_main_page(account_file)
19 return True 22 return True
20 23
21 24
22 -async def open_wyh_main_page(account_file): 25 +'''
26 +'''
27 +async def get_wyh_cookie_auto(account_file):
28 + print("get_wyh_cookie")
23 async with async_playwright() as playwright: 29 async with async_playwright() as playwright:
24 options = { 30 options = {
25 'args': [ 31 'args': [
...@@ -30,33 +36,29 @@ async def open_wyh_main_page(account_file): ...@@ -30,33 +36,29 @@ async def open_wyh_main_page(account_file):
30 # Make sure to run headed. 36 # Make sure to run headed.
31 browser = await playwright.chromium.launch(**options) 37 browser = await playwright.chromium.launch(**options)
32 # Setup context however you like. 38 # Setup context however you like.
33 - context = await browser.new_context(storage_state=account_file) # Pass any options 39 + context = await browser.new_context() # Pass any options
34 context = await set_init_script(context) 40 context = await set_init_script(context)
35 # Pause the page, and start recording manually. 41 # Pause the page, and start recording manually.
36 page = await context.new_page() 42 page = await context.new_page()
37 await page.goto("https://mp.163.com") 43 await page.goto("https://mp.163.com")
44 + # await page.pause()
45 + # 点击调试器的继续,保存cookie
46 + # await context.storage_state(path=account_file)
38 47
39 - board = page.locator("//*[@class='homeV4__board__card__data__value']") 48 + # 自动登陆
40 - # html_content = await board.inner_html()
41 - # print(html_content)
42 - content = await board.nth(0).inner_text() #总粉丝数
43 - print(content)
44 - content = await board.nth(1).inner_text() #总阅读数
45 - print(content)
46 - content = await board.nth(2).inner_text() #总收益
47 - print(content)
48 -
49 - await page.get_by_text("粉丝数据").click()
50 - await page.wait_for_timeout(5000)
51 - await page.get_by_text("内容数据").click()
52 await page.wait_for_timeout(5000) 49 await page.wait_for_timeout(5000)
53 - await page.get_by_text("收益数据").click() 50 + frame = page.frame_locator('//iframe[contains(@id, "x-URS-iframe")]')
51 + await frame.locator('[name="email"]').fill('liufuhua007@163.com')
52 + await frame.locator('[name="password"]').fill("Liuyihong1023@")
53 + await frame.locator('#dologin').click()
54 +
55 + # await page.pause()
54 await page.wait_for_timeout(5000) 56 await page.wait_for_timeout(5000)
55 - browser.close() 57 + # 点击调试器的继续,保存cookie
58 + await context.storage_state(path=account_file)
56 59
57 60
58 async def get_wyh_cookie(account_file): 61 async def get_wyh_cookie(account_file):
59 - print("get_wyh_cookie")
60 async with async_playwright() as playwright: 62 async with async_playwright() as playwright:
61 options = { 63 options = {
62 'args': [ 64 'args': [
...@@ -67,23 +69,47 @@ async def get_wyh_cookie(account_file): ...@@ -67,23 +69,47 @@ async def get_wyh_cookie(account_file):
67 # Make sure to run headed. 69 # Make sure to run headed.
68 browser = await playwright.chromium.launch(**options) 70 browser = await playwright.chromium.launch(**options)
69 # Setup context however you like. 71 # Setup context however you like.
70 - context = await browser.new_context() # Pass any options 72 + context = await browser.new_context(storage_state=account_file) # Pass any options
71 context = await set_init_script(context) 73 context = await set_init_script(context)
72 # Pause the page, and start recording manually. 74 # Pause the page, and start recording manually.
73 page = await context.new_page() 75 page = await context.new_page()
74 await page.goto("https://mp.163.com") 76 await page.goto("https://mp.163.com")
75 - # await page.pause() 77 + await page.pause()
76 - # 点击调试器的继续,保存cookie 78 +
77 - # await context.storage_state(path=account_file) 79 +
80 +async def open_wyh_main_page(account_file):
81 + async with async_playwright() as playwright:
82 + options = {
83 + 'args': [
84 + '--lang en-GB'
85 + ],
86 + 'headless': False, # Set headless option here
87 + }
88 + # Make sure to run headed.
89 + browser = await playwright.chromium.launch(**options)
90 + # Setup context however you like.
91 + context = await browser.new_context(storage_state=account_file) # Pass any options
92 + context = await set_init_script(context)
93 + # Pause the page, and start recording manually.
94 + page = await context.new_page()
95 + await page.goto("https://mp.163.com")
96 +
97 + board = page.locator("//*[@class='homeV4__board__card__data__value']")
98 + # html_content = await board.inner_html()
99 + # print(html_content)
100 + content = await board.nth(0).inner_text() #总粉丝数
101 + print(content)
102 + content = await board.nth(1).inner_text() #总阅读数
103 + print(content)
104 + content = await board.nth(2).inner_text() #总收益
105 + print(content)
106 +
107 + await page.get_by_text("粉丝数据").click()
108 + await page.wait_for_timeout(5000)
109 + await page.get_by_text("内容数据").click()
110 + await page.wait_for_timeout(5000)
111 + await page.get_by_text("收益数据").click()
112 + await page.wait_for_timeout(5000)
113 + browser.close()
78 114
79 - # 自动登陆
80 - await page.wait_for_timeout(20000)
81 - frame = page.frame_locator('//iframe[contains(@id, "x-URS-iframe")]')
82 - await frame.locator('[name="email"]').fill('liufuhua007@163.com')
83 - await frame.locator('[name="password"]').fill("Liuyihong1023@")
84 - await frame.locator('#dologin').click()
85 115
86 - # await page.pause()
87 - await page.wait_for_timeout(15000)
88 - # 点击调试器的继续,保存cookie
89 - await context.storage_state(path=account_file)
......
...@@ -22,7 +22,7 @@ def get_supported_social_media() -> List[str]: ...@@ -22,7 +22,7 @@ def get_supported_social_media() -> List[str]:
22 22
23 23
24 def get_cli_action() -> List[str]: 24 def get_cli_action() -> List[str]:
25 - return ["upload", "login", "watch"] 25 + return ["upload", "login", "watch", "auto_login"]
26 26
27 27
28 async def set_init_script(context): 28 async def set_init_script(context):
......