请求url后等待3,10秒

This commit is contained in:
work
2025-05-08 15:15:39 +08:00
parent e40f9daee3
commit b30d93a5f3

View File

@@ -845,6 +845,7 @@ def playwright_like(cookies, target_url):
url = 'https://facebook.com' url = 'https://facebook.com'
try: try:
page.goto(url) page.goto(url)
time.sleep(random.randint(3, 10))
check_account_status(page, parse_cookies(cookies)) check_account_status(page, parse_cookies(cookies))
if 'permalink.php?story_fbid' in target_url or '/posts/' in target_url: if 'permalink.php?story_fbid' in target_url or '/posts/' in target_url:
@@ -891,6 +892,7 @@ def playwright_post(cookies, content, image_key=None):
url = 'https://facebook.com' url = 'https://facebook.com'
try: try:
page.goto(url) page.goto(url)
time.sleep(random.randint(3, 10))
check_account_status(page, parse_cookies(cookies)) check_account_status(page, parse_cookies(cookies))
time.sleep(5) time.sleep(5)
@@ -946,6 +948,7 @@ def playwright_comment(cookies, target_url, content, image_key=None):
url = 'https://facebook.com' url = 'https://facebook.com'
try: try:
page.goto(url) page.goto(url)
time.sleep(random.randint(3, 10))
check_account_status(page, parse_cookies(cookies)) check_account_status(page, parse_cookies(cookies))
time.sleep(5) time.sleep(5)
@@ -1019,6 +1022,8 @@ def playwright_get_user_profile(cookies, username=None):
url = 'https://facebook.com' url = 'https://facebook.com'
try: try:
page.goto(url) page.goto(url)
time.sleep(random.randint(3, 10))
check_account_status(page, parse_cookies(cookies)) check_account_status(page, parse_cookies(cookies))
profile_pic_url = page.locator( profile_pic_url = page.locator(
@@ -1273,7 +1278,7 @@ if __name__ == '__main__':
# '2025-3-26~like', # '2025-3-26~like',
# # 'rg.jpg' # # 'rg.jpg'
# ) # )
# print(playwright_get_user_profile(cookies)) print(playwright_get_user_profile(cookies))
# playwright_set_user_profile( # playwright_set_user_profile(
# cookies, # cookies,
# username='facebaby66' # username='facebaby66'