Update app.py
Browse files
app.py
CHANGED
|
@@ -58,6 +58,7 @@ def get_random_proxy():
|
|
| 58 |
else:
|
| 59 |
return None
|
| 60 |
except Exception as e:
|
|
|
|
| 61 |
return None
|
| 62 |
|
| 63 |
def get_proxies():
|
|
@@ -195,29 +196,6 @@ def spotify_login(username: str, password: str):
|
|
| 195 |
raise HTTPError("Authentication failed")
|
| 196 |
|
| 197 |
def simulate_instagram_view(video_id: str, proxy: Proxy, session: Client):
|
| 198 |
-
webdriver.DesiredCapabilities.CHROME['proxy'] = {
|
| 199 |
-
"httpProxy": f"{proxy.ip}:{proxy.port}",
|
| 200 |
-
"ftpProxy": f"{proxy.ip}:{proxy.port}",
|
| 201 |
-
"sslProxy": f"{proxy.ip}:{proxy.port}",
|
| 202 |
-
"proxyType": "MANUAL",
|
| 203 |
-
}
|
| 204 |
-
options = webdriver.ChromeOptions()
|
| 205 |
-
options.add_argument("--headless")
|
| 206 |
-
options.add_argument("--disable-blink-features=AutomationControlled")
|
| 207 |
-
options.add_argument("--disable-popup-blocking")
|
| 208 |
-
options.add_argument("--disable-infobars")
|
| 209 |
-
options.add_argument("--disable-web-security")
|
| 210 |
-
options.add_argument("--ignore-certificate-errors")
|
| 211 |
-
options.add_argument("--disable-notifications")
|
| 212 |
-
options.add_argument("--disable-extensions")
|
| 213 |
-
options.add_argument("--disable-gpu")
|
| 214 |
-
options.add_argument("--no-sandbox")
|
| 215 |
-
options.add_argument("--disable-dev-shm-usage")
|
| 216 |
-
options.add_argument("--mute-audio")
|
| 217 |
-
options.add_argument('--ignore-ssl-errors=yes')
|
| 218 |
-
options.add_argument('--ignore-certificate-errors')
|
| 219 |
-
driver = webdriver.Chrome(ChromeDriverManager().install(), options=options)
|
| 220 |
-
|
| 221 |
try:
|
| 222 |
fake = Faker()
|
| 223 |
fake_ipv4 = fake.ipv4()
|
|
@@ -231,49 +209,13 @@ def simulate_instagram_view(video_id: str, proxy: Proxy, session: Client):
|
|
| 231 |
|
| 232 |
if proxy.type == "http" or proxy.type == "https":
|
| 233 |
session.get(view_url, headers=headers, proxies={"http": f"http://{proxy.ip}:{proxy.port}", "https": f"https://{proxy.ip}:{proxy.port}"})
|
| 234 |
-
|
| 235 |
-
driver.get(view_url)
|
| 236 |
-
|
| 237 |
-
try:
|
| 238 |
-
not_now = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.CLASS_NAME, 'mt3GC')))
|
| 239 |
-
a = not_now.find_elements(By.TAG_NAME, "button")[1]
|
| 240 |
-
actions = ActionChains(driver)
|
| 241 |
-
actions.click(a)
|
| 242 |
-
actions.perform()
|
| 243 |
-
except:
|
| 244 |
-
pass
|
| 245 |
-
|
| 246 |
time.sleep(rand(10, 20))
|
| 247 |
return True
|
| 248 |
except Exception as e:
|
|
|
|
| 249 |
return False
|
| 250 |
-
finally:
|
| 251 |
-
driver.quit()
|
| 252 |
|
| 253 |
def simulate_tiktok_view(video_id: str, proxy: Proxy, session: Client):
|
| 254 |
-
webdriver.DesiredCapabilities.CHROME['proxy'] = {
|
| 255 |
-
"httpProxy": f"{proxy.ip}:{proxy.port}",
|
| 256 |
-
"ftpProxy": f"{proxy.ip}:{proxy.port}",
|
| 257 |
-
"sslProxy": f"{proxy.ip}:{proxy.port}",
|
| 258 |
-
"proxyType": "MANUAL",
|
| 259 |
-
}
|
| 260 |
-
options = webdriver.ChromeOptions()
|
| 261 |
-
options.add_argument("--headless")
|
| 262 |
-
options.add_argument("--disable-blink-features=AutomationControlled")
|
| 263 |
-
options.add_argument("--disable-popup-blocking")
|
| 264 |
-
options.add_argument("--disable-infobars")
|
| 265 |
-
options.add_argument("--disable-web-security")
|
| 266 |
-
options.add_argument("--ignore-certificate-errors")
|
| 267 |
-
options.add_argument("--disable-notifications")
|
| 268 |
-
options.add_argument("--disable-extensions")
|
| 269 |
-
options.add_argument("--disable-gpu")
|
| 270 |
-
options.add_argument("--no-sandbox")
|
| 271 |
-
options.add_argument("--disable-dev-shm-usage")
|
| 272 |
-
options.add_argument("--mute-audio")
|
| 273 |
-
options.add_argument('--ignore-ssl-errors=yes')
|
| 274 |
-
options.add_argument('--ignore-certificate-errors')
|
| 275 |
-
driver = webdriver.Chrome(ChromeDriverManager().install(), options=options)
|
| 276 |
-
|
| 277 |
try:
|
| 278 |
fake = Faker()
|
| 279 |
fake_ipv4 = fake.ipv4()
|
|
@@ -288,48 +230,13 @@ def simulate_tiktok_view(video_id: str, proxy: Proxy, session: Client):
|
|
| 288 |
if proxy.type == "http" or proxy.type == "https":
|
| 289 |
session.get(view_url, headers=headers, proxies={"http": f"http://{proxy.ip}:{proxy.port}", "https": f"https://{proxy.ip}:{proxy.port}"})
|
| 290 |
|
| 291 |
-
driver.get(view_url)
|
| 292 |
-
|
| 293 |
-
try:
|
| 294 |
-
not_now = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.CLASS_NAME, 'mt3GC')))
|
| 295 |
-
a = not_now.find_elements(By.TAG_NAME, "button")[1]
|
| 296 |
-
actions = ActionChains(driver)
|
| 297 |
-
actions.click(a)
|
| 298 |
-
actions.perform()
|
| 299 |
-
except:
|
| 300 |
-
pass
|
| 301 |
-
|
| 302 |
time.sleep(rand(10, 20))
|
| 303 |
return True
|
| 304 |
except Exception as e:
|
|
|
|
| 305 |
return False
|
| 306 |
-
finally:
|
| 307 |
-
driver.quit()
|
| 308 |
|
| 309 |
def simulate_youtube_view(video_id: str, proxy: Proxy, session: Client):
|
| 310 |
-
webdriver.DesiredCapabilities.CHROME['proxy'] = {
|
| 311 |
-
"httpProxy": f"{proxy.ip}:{proxy.port}",
|
| 312 |
-
"ftpProxy": f"{proxy.ip}:{proxy.port}",
|
| 313 |
-
"sslProxy": f"{proxy.ip}:{proxy.port}",
|
| 314 |
-
"proxyType": "MANUAL",
|
| 315 |
-
}
|
| 316 |
-
options = webdriver.ChromeOptions()
|
| 317 |
-
options.add_argument("--headless")
|
| 318 |
-
options.add_argument("--disable-blink-features=AutomationControlled")
|
| 319 |
-
options.add_argument("--disable-popup-blocking")
|
| 320 |
-
options.add_argument("--disable-infobars")
|
| 321 |
-
options.add_argument("--disable-web-security")
|
| 322 |
-
options.add_argument("--ignore-certificate-errors")
|
| 323 |
-
options.add_argument("--disable-notifications")
|
| 324 |
-
options.add_argument("--disable-extensions")
|
| 325 |
-
options.add_argument("--disable-gpu")
|
| 326 |
-
options.add_argument("--no-sandbox")
|
| 327 |
-
options.add_argument("--disable-dev-shm-usage")
|
| 328 |
-
options.add_argument("--mute-audio")
|
| 329 |
-
options.add_argument('--ignore-ssl-errors=yes')
|
| 330 |
-
options.add_argument('--ignore-certificate-errors')
|
| 331 |
-
driver = webdriver.Chrome(ChromeDriverManager().install(), options=options)
|
| 332 |
-
|
| 333 |
try:
|
| 334 |
fake = Faker()
|
| 335 |
fake_ipv4 = fake.ipv4()
|
|
@@ -343,49 +250,13 @@ def simulate_youtube_view(video_id: str, proxy: Proxy, session: Client):
|
|
| 343 |
|
| 344 |
if proxy.type == "http" or proxy.type == "https":
|
| 345 |
session.get(view_url, headers=headers, proxies={"http": f"http://{proxy.ip}:{proxy.port}", "https": f"https://{proxy.ip}:{proxy.port}"})
|
| 346 |
-
|
| 347 |
-
driver.get(view_url)
|
| 348 |
-
|
| 349 |
-
try:
|
| 350 |
-
not_now = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.CLASS_NAME, 'mt3GC')))
|
| 351 |
-
a = not_now.find_elements(By.TAG_NAME, "button")[1]
|
| 352 |
-
actions = ActionChains(driver)
|
| 353 |
-
actions.click(a)
|
| 354 |
-
actions.perform()
|
| 355 |
-
except:
|
| 356 |
-
pass
|
| 357 |
-
|
| 358 |
time.sleep(rand(10, 20))
|
| 359 |
return True
|
| 360 |
except Exception as e:
|
|
|
|
| 361 |
return False
|
| 362 |
-
finally:
|
| 363 |
-
driver.quit()
|
| 364 |
|
| 365 |
def simulate_facebook_view(video_id: str, proxy: Proxy, session: Client):
|
| 366 |
-
webdriver.DesiredCapabilities.CHROME['proxy'] = {
|
| 367 |
-
"httpProxy": f"{proxy.ip}:{proxy.port}",
|
| 368 |
-
"ftpProxy": f"{proxy.ip}:{proxy.port}",
|
| 369 |
-
"sslProxy": f"{proxy.ip}:{proxy.port}",
|
| 370 |
-
"proxyType": "MANUAL",
|
| 371 |
-
}
|
| 372 |
-
options = webdriver.ChromeOptions()
|
| 373 |
-
options.add_argument("--headless")
|
| 374 |
-
options.add_argument("--disable-blink-features=AutomationControlled")
|
| 375 |
-
options.add_argument("--disable-popup-blocking")
|
| 376 |
-
options.add_argument("--disable-infobars")
|
| 377 |
-
options.add_argument("--disable-web-security")
|
| 378 |
-
options.add_argument("--ignore-certificate-errors")
|
| 379 |
-
options.add_argument("--disable-notifications")
|
| 380 |
-
options.add_argument("--disable-extensions")
|
| 381 |
-
options.add_argument("--disable-gpu")
|
| 382 |
-
options.add_argument("--no-sandbox")
|
| 383 |
-
options.add_argument("--disable-dev-shm-usage")
|
| 384 |
-
options.add_argument("--mute-audio")
|
| 385 |
-
options.add_argument('--ignore-ssl-errors=yes')
|
| 386 |
-
options.add_argument('--ignore-certificate-errors')
|
| 387 |
-
driver = webdriver.Chrome(ChromeDriverManager().install(), options=options)
|
| 388 |
-
|
| 389 |
try:
|
| 390 |
fake = Faker()
|
| 391 |
fake_ipv4 = fake.ipv4()
|
|
@@ -399,49 +270,13 @@ def simulate_facebook_view(video_id: str, proxy: Proxy, session: Client):
|
|
| 399 |
|
| 400 |
if proxy.type == "http" or proxy.type == "https":
|
| 401 |
session.get(view_url, headers=headers, proxies={"http": f"http://{proxy.ip}:{proxy.port}", "https": f"https://{proxy.ip}:{proxy.port}"})
|
| 402 |
-
|
| 403 |
-
driver.get(view_url)
|
| 404 |
-
|
| 405 |
-
try:
|
| 406 |
-
not_now = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.CLASS_NAME, 'mt3GC')))
|
| 407 |
-
a = not_now.find_elements(By.TAG_NAME, "button")[1]
|
| 408 |
-
actions = ActionChains(driver)
|
| 409 |
-
actions.click(a)
|
| 410 |
-
actions.perform()
|
| 411 |
-
except:
|
| 412 |
-
pass
|
| 413 |
-
|
| 414 |
time.sleep(rand(10, 20))
|
| 415 |
return True
|
| 416 |
except Exception as e:
|
|
|
|
| 417 |
return False
|
| 418 |
-
finally:
|
| 419 |
-
driver.quit()
|
| 420 |
|
| 421 |
def simulate_twitch_view(video_id: str, proxy: Proxy, session: Client):
|
| 422 |
-
webdriver.DesiredCapabilities.CHROME['proxy'] = {
|
| 423 |
-
"httpProxy": f"{proxy.ip}:{proxy.port}",
|
| 424 |
-
"ftpProxy": f"{proxy.ip}:{proxy.port}",
|
| 425 |
-
"sslProxy": f"{proxy.ip}:{proxy.port}",
|
| 426 |
-
"proxyType": "MANUAL",
|
| 427 |
-
}
|
| 428 |
-
options = webdriver.ChromeOptions()
|
| 429 |
-
options.add_argument("--headless")
|
| 430 |
-
options.add_argument("--disable-blink-features=AutomationControlled")
|
| 431 |
-
options.add_argument("--disable-popup-blocking")
|
| 432 |
-
options.add_argument("--disable-infobars")
|
| 433 |
-
options.add_argument("--disable-web-security")
|
| 434 |
-
options.add_argument("--ignore-certificate-errors")
|
| 435 |
-
options.add_argument("--disable-notifications")
|
| 436 |
-
options.add_argument("--disable-extensions")
|
| 437 |
-
options.add_argument("--disable-gpu")
|
| 438 |
-
options.add_argument("--no-sandbox")
|
| 439 |
-
options.add_argument("--disable-dev-shm-usage")
|
| 440 |
-
options.add_argument("--mute-audio")
|
| 441 |
-
options.add_argument('--ignore-ssl-errors=yes')
|
| 442 |
-
options.add_argument('--ignore-certificate-errors')
|
| 443 |
-
driver = webdriver.Chrome(ChromeDriverManager().install(), options=options)
|
| 444 |
-
|
| 445 |
try:
|
| 446 |
fake = Faker()
|
| 447 |
fake_ipv4 = fake.ipv4()
|
|
@@ -455,49 +290,13 @@ def simulate_twitch_view(video_id: str, proxy: Proxy, session: Client):
|
|
| 455 |
|
| 456 |
if proxy.type == "http" or proxy.type == "https":
|
| 457 |
session.get(view_url, headers=headers, proxies={"http": f"http://{proxy.ip}:{proxy.port}", "https": f"https://{proxy.ip}:{proxy.port}"})
|
| 458 |
-
|
| 459 |
-
driver.get(view_url)
|
| 460 |
-
|
| 461 |
-
try:
|
| 462 |
-
not_now = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.CLASS_NAME, 'mt3GC')))
|
| 463 |
-
a = not_now.find_elements(By.TAG_NAME, "button")[1]
|
| 464 |
-
actions = ActionChains(driver)
|
| 465 |
-
actions.click(a)
|
| 466 |
-
actions.perform()
|
| 467 |
-
except:
|
| 468 |
-
pass
|
| 469 |
-
|
| 470 |
time.sleep(rand(10, 20))
|
| 471 |
return True
|
| 472 |
except Exception as e:
|
|
|
|
| 473 |
return False
|
| 474 |
-
finally:
|
| 475 |
-
driver.quit()
|
| 476 |
|
| 477 |
def simulate_spotify_view(video_id: str, proxy: Proxy, session: Client):
|
| 478 |
-
webdriver.DesiredCapabilities.CHROME['proxy'] = {
|
| 479 |
-
"httpProxy": f"{proxy.ip}:{proxy.port}",
|
| 480 |
-
"ftpProxy": f"{proxy.ip}:{proxy.port}",
|
| 481 |
-
"sslProxy": f"{proxy.ip}:{proxy.port}",
|
| 482 |
-
"proxyType": "MANUAL",
|
| 483 |
-
}
|
| 484 |
-
options = webdriver.ChromeOptions()
|
| 485 |
-
options.add_argument("--headless")
|
| 486 |
-
options.add_argument("--disable-blink-features=AutomationControlled")
|
| 487 |
-
options.add_argument("--disable-popup-blocking")
|
| 488 |
-
options.add_argument("--disable-infobars")
|
| 489 |
-
options.add_argument("--disable-web-security")
|
| 490 |
-
options.add_argument("--ignore-certificate-errors")
|
| 491 |
-
options.add_argument("--disable-notifications")
|
| 492 |
-
options.add_argument("--disable-extensions")
|
| 493 |
-
options.add_argument("--disable-gpu")
|
| 494 |
-
options.add_argument("--no-sandbox")
|
| 495 |
-
options.add_argument("--disable-dev-shm-usage")
|
| 496 |
-
options.add_argument("--mute-audio")
|
| 497 |
-
options.add_argument('--ignore-ssl-errors=yes')
|
| 498 |
-
options.add_argument('--ignore-certificate-errors')
|
| 499 |
-
driver = webdriver.Chrome(ChromeDriverManager().install(), options=options)
|
| 500 |
-
|
| 501 |
try:
|
| 502 |
fake = Faker()
|
| 503 |
fake_ipv4 = fake.ipv4()
|
|
@@ -512,28 +311,17 @@ def simulate_spotify_view(video_id: str, proxy: Proxy, session: Client):
|
|
| 512 |
if proxy.type == "http" or proxy.type == "https":
|
| 513 |
session.get(view_url, headers=headers, proxies={"http": f"http://{proxy.ip}:{proxy.port}", "https": f"https://{proxy.ip}:{proxy.port}"})
|
| 514 |
|
| 515 |
-
driver.get(view_url)
|
| 516 |
-
|
| 517 |
-
try:
|
| 518 |
-
not_now = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.CLASS_NAME, 'mt3GC')))
|
| 519 |
-
a = not_now.find_elements(By.TAG_NAME, "button")[1]
|
| 520 |
-
actions = ActionChains(driver)
|
| 521 |
-
actions.click(a)
|
| 522 |
-
actions.perform()
|
| 523 |
-
except:
|
| 524 |
-
pass
|
| 525 |
-
|
| 526 |
time.sleep(rand(10, 20))
|
| 527 |
-
return True
|
| 528 |
except Exception as e:
|
| 529 |
-
|
| 530 |
-
|
| 531 |
-
driver.quit()
|
| 532 |
|
| 533 |
def simulate_views_background(url: str, platform: str, count: int, delay: int, session: Client = None):
|
| 534 |
video_id = extract_video_id(url, platform)
|
| 535 |
proxy = get_random_proxy()
|
| 536 |
if not proxy:
|
|
|
|
| 537 |
return
|
| 538 |
|
| 539 |
successful_views = 0
|
|
@@ -558,14 +346,16 @@ def simulate_views_background(url: str, platform: str, count: int, delay: int, s
|
|
| 558 |
successful_views += 1
|
| 559 |
else:
|
| 560 |
failed_views += 1
|
| 561 |
-
|
| 562 |
-
pbar.update(1)
|
| 563 |
-
|
| 564 |
-
|
|
|
|
| 565 |
except Exception as e:
|
| 566 |
failed_views += 1
|
| 567 |
pbar.update(1)
|
| 568 |
-
|
|
|
|
| 569 |
|
| 570 |
def simulate_views_endpoint(request: VisitRequest):
|
| 571 |
try:
|
|
@@ -738,4 +528,4 @@ with gr.Blocks(css="""
|
|
| 738 |
outputs=output,
|
| 739 |
)
|
| 740 |
|
| 741 |
-
interface.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
| 58 |
else:
|
| 59 |
return None
|
| 60 |
except Exception as e:
|
| 61 |
+
print(f"Error getting proxy: {e}")
|
| 62 |
return None
|
| 63 |
|
| 64 |
def get_proxies():
|
|
|
|
| 196 |
raise HTTPError("Authentication failed")
|
| 197 |
|
| 198 |
def simulate_instagram_view(video_id: str, proxy: Proxy, session: Client):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
try:
|
| 200 |
fake = Faker()
|
| 201 |
fake_ipv4 = fake.ipv4()
|
|
|
|
| 209 |
|
| 210 |
if proxy.type == "http" or proxy.type == "https":
|
| 211 |
session.get(view_url, headers=headers, proxies={"http": f"http://{proxy.ip}:{proxy.port}", "https": f"https://{proxy.ip}:{proxy.port}"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 212 |
time.sleep(rand(10, 20))
|
| 213 |
return True
|
| 214 |
except Exception as e:
|
| 215 |
+
print(f"Error in simulate_instagram_view: {e}")
|
| 216 |
return False
|
|
|
|
|
|
|
| 217 |
|
| 218 |
def simulate_tiktok_view(video_id: str, proxy: Proxy, session: Client):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 219 |
try:
|
| 220 |
fake = Faker()
|
| 221 |
fake_ipv4 = fake.ipv4()
|
|
|
|
| 230 |
if proxy.type == "http" or proxy.type == "https":
|
| 231 |
session.get(view_url, headers=headers, proxies={"http": f"http://{proxy.ip}:{proxy.port}", "https": f"https://{proxy.ip}:{proxy.port}"})
|
| 232 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
time.sleep(rand(10, 20))
|
| 234 |
return True
|
| 235 |
except Exception as e:
|
| 236 |
+
print(f"Error in simulate_tiktok_view: {e}")
|
| 237 |
return False
|
|
|
|
|
|
|
| 238 |
|
| 239 |
def simulate_youtube_view(video_id: str, proxy: Proxy, session: Client):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 240 |
try:
|
| 241 |
fake = Faker()
|
| 242 |
fake_ipv4 = fake.ipv4()
|
|
|
|
| 250 |
|
| 251 |
if proxy.type == "http" or proxy.type == "https":
|
| 252 |
session.get(view_url, headers=headers, proxies={"http": f"http://{proxy.ip}:{proxy.port}", "https": f"https://{proxy.ip}:{proxy.port}"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 253 |
time.sleep(rand(10, 20))
|
| 254 |
return True
|
| 255 |
except Exception as e:
|
| 256 |
+
print(f"Error in simulate_youtube_view: {e}")
|
| 257 |
return False
|
|
|
|
|
|
|
| 258 |
|
| 259 |
def simulate_facebook_view(video_id: str, proxy: Proxy, session: Client):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 260 |
try:
|
| 261 |
fake = Faker()
|
| 262 |
fake_ipv4 = fake.ipv4()
|
|
|
|
| 270 |
|
| 271 |
if proxy.type == "http" or proxy.type == "https":
|
| 272 |
session.get(view_url, headers=headers, proxies={"http": f"http://{proxy.ip}:{proxy.port}", "https": f"https://{proxy.ip}:{proxy.port}"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 273 |
time.sleep(rand(10, 20))
|
| 274 |
return True
|
| 275 |
except Exception as e:
|
| 276 |
+
print(f"Error in simulate_facebook_view: {e}")
|
| 277 |
return False
|
|
|
|
|
|
|
| 278 |
|
| 279 |
def simulate_twitch_view(video_id: str, proxy: Proxy, session: Client):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 280 |
try:
|
| 281 |
fake = Faker()
|
| 282 |
fake_ipv4 = fake.ipv4()
|
|
|
|
| 290 |
|
| 291 |
if proxy.type == "http" or proxy.type == "https":
|
| 292 |
session.get(view_url, headers=headers, proxies={"http": f"http://{proxy.ip}:{proxy.port}", "https": f"https://{proxy.ip}:{proxy.port}"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 293 |
time.sleep(rand(10, 20))
|
| 294 |
return True
|
| 295 |
except Exception as e:
|
| 296 |
+
print(f"Error in simulate_twitch_view: {e}")
|
| 297 |
return False
|
|
|
|
|
|
|
| 298 |
|
| 299 |
def simulate_spotify_view(video_id: str, proxy: Proxy, session: Client):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 300 |
try:
|
| 301 |
fake = Faker()
|
| 302 |
fake_ipv4 = fake.ipv4()
|
|
|
|
| 311 |
if proxy.type == "http" or proxy.type == "https":
|
| 312 |
session.get(view_url, headers=headers, proxies={"http": f"http://{proxy.ip}:{proxy.port}", "https": f"https://{proxy.ip}:{proxy.port}"})
|
| 313 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 314 |
time.sleep(rand(10, 20))
|
| 315 |
+
return True
|
| 316 |
except Exception as e:
|
| 317 |
+
print(f"Error in simulate_spotify_view: {e}")
|
| 318 |
+
return False
|
|
|
|
| 319 |
|
| 320 |
def simulate_views_background(url: str, platform: str, count: int, delay: int, session: Client = None):
|
| 321 |
video_id = extract_video_id(url, platform)
|
| 322 |
proxy = get_random_proxy()
|
| 323 |
if not proxy:
|
| 324 |
+
print("No proxy available.")
|
| 325 |
return
|
| 326 |
|
| 327 |
successful_views = 0
|
|
|
|
| 346 |
successful_views += 1
|
| 347 |
else:
|
| 348 |
failed_views += 1
|
| 349 |
+
|
| 350 |
+
pbar.update(1)
|
| 351 |
+
remaining_views = count - i - 1
|
| 352 |
+
pbar.set_postfix({"Successful": successful_views, "Failed": failed_views, "Remaining": remaining_views, "Time Remaining": pbar.format_interval(pbar.remaining_time)})
|
| 353 |
+
time.sleep(delay)
|
| 354 |
except Exception as e:
|
| 355 |
failed_views += 1
|
| 356 |
pbar.update(1)
|
| 357 |
+
remaining_views = count - i - 1
|
| 358 |
+
pbar.set_postfix({"Successful": successful_views, "Failed": failed_views, "Remaining": remaining_views, "Time Remaining": pbar.format_interval(pbar.remaining_time)})
|
| 359 |
|
| 360 |
def simulate_views_endpoint(request: VisitRequest):
|
| 361 |
try:
|
|
|
|
| 528 |
outputs=output,
|
| 529 |
)
|
| 530 |
|
| 531 |
+
interface.launch(server_name="0.0.0.0", server_port=7860, share=True)
|