Kod:
[COLOR=#cc7832]from [/COLOR]selenium [COLOR=#cc7832]import [/COLOR]webdriver
[COLOR=#cc7832]import [/COLOR]time
[COLOR=#cc7832]from [/COLOR]random [COLOR=#cc7832]import [/COLOR]randint
fp = webdriver.FirefoxProfile([COLOR=#6a8759]'path of the firefox profile'[/COLOR])
fp.set_preference([COLOR=#6a8759]"browser.privatebrowsing.autostart"[/COLOR][COLOR=#cc7832], True[/COLOR])
driver = webdriver.Firefox([COLOR=#aa4926]firefox_profile[/COLOR]=fp[COLOR=#cc7832],
[/COLOR][COLOR=#aa4926]executable_path[/COLOR]=[COLOR=#6a8759]'path of the gecko driver'[/COLOR])
driver.get([COLOR=#6a8759]'https://web.telegram.org/#/login'[/COLOR])
username = [COLOR=#6a8759]"number"
[/COLOR]password = [COLOR=#6a8759]"if you have protection code use it if not you must edit codes"
time.sleep(10)
driver.find_element_by_xpath("/html/body/div[1]/div/div[3]/div[2]/form/div[2]/div[2]/input").send_keys(username)
time.sleep(2)
driver.find_element_by_xpath("/html/body/div[1]/div/div[3]/div[1]/div/a/i").click()
time.sleep(2)
driver.find_element_by_xpath("/html/body/div[4]/div[2]/div/div/div[2]/button[2]").click()
time.sleep(10)
driver.find_element_by_xpath("/html/body/div[1]/div/div[3]/div[2]/form/div[1]/input").send_keys(password)
time.sleep(1)
driver.find_element_by_xpath("/html/body/div[1]/div/div[3]/div[1]/div/a/i").click()
time.sleep(5)
lastSeen = driver.find_element_by_xpath("/html/body/div[1]/div[1]/div/div[2]/div[2]/div/div[2]/a/div/span[2]/span").text
while True:
if lastSeen != driver.find_element_by_xpath("/html/body/div[1]/div[1]/div/div[2]/div[2]/div/div[2]/a/div/span[2]/span").text:
f = open("TelegramLOG.txt", "a", encoding="UTF-8")
f.write("# "+lastSeen+" #"+datetime.now().strftime('%Y-%m-%d %H:%M:%S')+"\n")
f.close()
lastSeen = driver.find_element_by_xpath("/html/body/div[1]/div[1]/div/div[2]/div[2]/div/div[2]/a/div/span[2]/span").text
else:
pass
[/COLOR][COLOR=#6a8759] time.sleep(1)[/COLOR]
otherwise you will get error. End of code you should open the profile which person's lastseen should be followed.
Son düzenleme: