Skip to content

Instantly share code, notes, and snippets.

@hctilg
Last active June 2, 2024 08:21
Show Gist options
  • Save hctilg/809a5d75ce0ae0bcbfc26978c3f9967a to your computer and use it in GitHub Desktop.
Save hctilg/809a5d75ce0ae0bcbfc26978c3f9967a to your computer and use it in GitHub Desktop.
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
def view(user, _view):
  print('-' * (len(user) + 8))
  view_count = 0
  options = Options()
  options.add_argument("--headless")
  for _ in range(_view):
    try:
      driver = webdriver.Chrome(options=options)
      driver.get(f"https://daramet.com/{user}")
      driver.set_page_load_timeout(5)
      view = driver.find_element(By.XPATH, "/html/body/div[1]/div/div[2]/div[2]/div/div/div[2]/div[1]/span[1]").text
      print("\r+ View:", view, end='', flush=True)
      driver.delete_all_cookies()
      driver.quit()
    except: ...
    view_count += 1
    if view_count == _view: print()
view(
input("username: "),
int(input("view: "))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment