Python Bi Python Seleniumê Twîtter Bot

12 Tê Şopandin
12 Şopîner

Zinar

Rêvebîr
Rêber
Moderator
Bikarhêner

17 Mar 2020

61 Mesaj

110 Çalak

0 Çareseri

18

Peyama Yekemîn

Ket Xeletên te tûne ne!

Ket Xeletên te tûne ne!

Ket Xeletên te tûne ne!

Ket Xeletên te tûne ne!

Tevlîbûn
17 Mar 2020
Peyam
61
Pûanên Behganîye
110
Merheba hevalno. Bû du car vê mijarê ve dikim. Neyse em werin mijara xwe. Bi pirtûkxaneya Pythonê Selenium me botek ji bo twîtterê nivisand. Ev bot tenê niha dikare twît bavêje. Heta ku mezin bibe belkî karibe yekê jî bişopîne 😂

Python:
from selenium import webdriver
from userpass import username, password
import time
from selenium.webdriver.common.keys import Keys

from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
import sys

import unittest, time, re
from bs4 import BeautifulSoup as bs
from dateutil import parser
import pandas as pd
import itertools
import matplotlib.pyplot as plt

twitimiz = "Merheba hevalno ev twît ji aliyê bot hatiye avêtin."
#binary = FirefoxBinary('/usr/bin/firefox')
class Twitter:
    def __init__(self,username,password, twitimiz):
        self.browser = webdriver.Firefox()
        self.username = username
        self.password = password
        self.twitimiz = twitimiz
    def Giris(self):
        self.browser.get("https://twitter.com/login")
        time.sleep(2)
        self.browser.find_element_by_name("session[username_or_email]").send_keys(self.username)
        self.browser.find_element_by_name("session[password]").send_keys(self.password)
        time.sleep(1)
        self.browser.find_element_by_xpath("/html/body/div/div/div/div[2]/main/div/div/div[2]/form/div/div[3]/div/div").click()
        time.sleep(5)

    def Mesaj(self):
        self.browser.get("https://twitter.com/compose/tweet")
        self.browser.find_element_by_xpath("/html/body/div/div/div/div[1]/div[2]/div/div/div/div/div/div[2]/div[2]/div/div[3]/div/div/div/div[1]/div/div/div/div/div[2]/div[1]/div/div/div/div/div/div/div/div/div/div[1]/div/div/div/div[2]/div").send_keys(self.twitimiz)
        self.browser.find_element_by_xpath("/html/body/div/div/div/div[1]/div[2]/div/div/div/div/div/div[2]/div[2]/div/div[3]/div/div/div/div[1]/div/div/div/div/div[2]/div[4]/div/div/div[2]/div[4]").click()

twt = Twitter(username,password,twitimiz,)
twt.Giris()
twt.Mesaj()

Ev împort hemû hewce nakin. Li ser dixebitim ji ber wî ewqas pirin. Tiştekî din jî di dosyaya userpass.py yê de divê têketina we ya twîtterê hebe
Kod:
username = "kurdtekno"
password = "şifreyaminaxweşik"


bimînin di xêr û xweşiyê de.
 

rizgar

Rêvebîr
Rêber
Moderator
Bikarhêner

27 Şub 2020

158 Mesaj

162 Çalak

0 Çareseri

43

Peyama Yekemîn

100 Peyam

Ket Xeletên te tûne ne!

Ket Xeletên te tûne ne!

Ket Xeletên te tûne ne!

Tevlîbûn
27 Şub 2020
Peyam
158
Pûanên Behganîye
162

Mijar

317

Peyam

860

Bikarhêner

247

Endamê/a dawîn

Çiya

Üst