This commit is contained in:
27942
2026-03-06 04:12:36 +08:00
parent bb951351d7
commit 908d53f73a

42
1.py
View File

@@ -126,26 +126,27 @@ def _greet_one_geek(page, container, item):
if not name_ele:
print(f" 跳过未找到:{geekName}")
return False
name_ele.run_js("this.scrollIntoView({block: 'center', behavior: 'auto'})")
time.sleep(0.6)
parent = name_ele.parent()
greet_btn = None
for _ in range(8):
if not parent:
break
greet_btn = parent.ele('x://span[text()="打招呼"]', timeout=0.5) or parent.ele(
'x://*[contains(text(),"打招呼")]', timeout=0.5)
if greet_btn:
break
parent = parent.parent()
if not greet_btn:
greet_btn = container.ele('x://span[text()="打招呼"]', timeout=2) or container.ele(
'x://*[contains(text(),"打招呼")]', timeout=1)
if not greet_btn:
print(f" 未找到「打招呼」按钮:{geekName}")
return False
greet_btn.click(by_js=True)
name_ele.run_js("this.scrollIntoView()")
name_ele.click()
time.sleep(3)
a = page.get_frame(1)
time.sleep(random.uniform(0.5, 1.2))
a.ele(f'x://*[contains(text(),"打招呼")]', timeout=2).click(by_js=True)
time.sleep(random.uniform(0.5, 1.2))
a.ele(f'x://*[contains(text(),"收藏")]', timeout=2).click(by_js=True)
time.sleep(random.uniform(0.5, 1.2))
for i in range(3):
a.ele(f'x://*[@class="btn-v2 btn-outline-v2"]', timeout=2).click(by_js=True)
time.sleep(random.uniform(0.5, 1.2))
page.ele(f'x://*[@data-placeholder="快速回复"]', timeout=2).input("我司正在招聘爬虫工程师,有兴趣了解一下吗")
page.ele(f'x://*[contains(text(),"发送")]', timeout=2).click()
time.sleep(random.uniform(0.5, 1.2))
page.ele('x://*[@class="iboss iboss-close"]').click()
time.sleep(random.uniform(0.5, 1.2))
a.ele('x://*[@class="boss-popup__close"]').click()
time.sleep(random.uniform(0.5, 1.2))
return True
@@ -241,7 +242,8 @@ def main(filters, position_names=None, greet_target=None):
total_greeted += n
round_added += n
if n:
print(f"岗位「{label}」本包 {len(geek_list)} 人,新打招呼 {n} 人,累计 {total_greeted}" + (f"/{greet_target}" if greet_target else ""))
print(f"岗位「{label}」本包 {len(geek_list)} 人,新打招呼 {n} 人,累计 {total_greeted}" + (
f"/{greet_target}" if greet_target else ""))
if greet_target is None:
break