Coding Global Background
Coding Global

bug

Archiviert 9 days ago
1 Nachrichten
2 Mitglieder
a month ago
In Discord öffnen
C
! ᵇˣᵇᵉˢ |I Fiction

Spielt Custom Status

Verified

def search_site_command(query): for site in sites: if site[0] in query and "search" in query: search_term = re.sub(rf"\b(search|{site[0]}|on|in|for|please|now|about|to)\b", "", query, flags=re.IGNORECASE).strip() if not search_term: say(f"What should I search on {site[0]}?") search_term = saycommand() if search_term: say(f"Searching {search_term} on {site[0]}") webbrowser.open(site[1]) time.sleep(2) if site[0] == "youtube": time.sleep(1) for _ in range(4): keyboard.press_and_release("tab") time.sleep(0.4) pyautogui.typewrite(search_term, interval=0.1) pyautogui.press("enter") elif site[0] == "google": time.sleep(1) pyautogui.typewrite(search_term, interval=0.1) pyautogui.press("enter") elif site[0] == "wikipedia": time.sleep(1) for _ in range(0): keyboard.press_and_release("tab") time.sleep(0.3) pyautogui.typewrite(search_term, interval=0.1) pyautogui.press("enter") elif site[0] == "instagram": say("Sorry sir, this site search automation is not configured yet.") return False else: say("Sorry sir, this site search automation is not configured yet.") time.sleep(2) say("here are the results sir") return True return False Inthis function if the network is slow the function keeps running but due to slow connection it cannot type for search So we need a better alternative that ensures the site is fullyloaded instead of using timesleep

Antworten (1)