Skip to content

Instantly share code, notes, and snippets.

@hctilg
Last active November 9, 2024 21:08
Show Gist options
  • Save hctilg/7564d4440be2d9a4a9660fd332aafe50 to your computer and use it in GitHub Desktop.
Save hctilg/7564d4440be2d9a4a9660fd332aafe50 to your computer and use it in GitHub Desktop.
Daramet‌ viewer
from selenium import webdriver
from selenium.webdriver.common.by import By
def run(_func):
if __name__ == '__main__':
_func()
def viewer(username, view_number):
for i in range(view_number):
try:
options = webdriver.ChromeOptions()
options.add_argument("--headless")
options.add_experimental_option("prefs", {
'profile.default_content_setting_values': { 'images': 2 }
})
driver = webdriver.Chrome(options=options)
driver.get(f"https://daramet.com/{username}")
driver.set_page_load_timeout(7)
view_data = driver.find_element(By.XPATH, "/html/body/div[1]/div/div[2]/div[2]/div/div/div[3]/div[1]/span[1]").text
print(f"\r ({i+1})> View:", view_data, end='', flush=True)
driver.delete_all_cookies()
driver.quit()
except Exception as e:
print(e)
print()
@run
def main():
username = input("Username: ")
view_count = int(input("View: ") or 0)
if True > view_count or len(username) < True :
return False
viewer(username, view_count)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment