Add files via upload
This commit is contained in:
70
twintgui.py
Normal file
70
twintgui.py
Normal file
@@ -0,0 +1,70 @@
|
||||
# main.py
|
||||
|
||||
|
||||
import sys
|
||||
from PySide6 import *
|
||||
from PySide6.QtUiTools import QUiLoader
|
||||
import twint
|
||||
from PySide6.QtWidgets import QApplication, QPushButton
|
||||
from PySide6.QtCore import Slot
|
||||
import os
|
||||
|
||||
|
||||
#Ggsya made this :D
|
||||
def backslash():
|
||||
return('\ '[0])
|
||||
|
||||
def check_and_create_dir(path):
|
||||
if os.path.exists(path):
|
||||
print('Dir already exists')
|
||||
print('Exiting')
|
||||
|
||||
|
||||
else:
|
||||
os.mkdir(path)
|
||||
|
||||
|
||||
|
||||
def tweet_search():
|
||||
print(window.Keyword)
|
||||
#checking if output folder exists
|
||||
check_and_create_dir(os.getcwd() + '/output')
|
||||
|
||||
search = window.Keyword.toPlainText()
|
||||
city = window.City.toPlainText()
|
||||
|
||||
limit = window.Limit.toPlainText()
|
||||
if limit != '':
|
||||
pass
|
||||
else:
|
||||
limit = 0
|
||||
|
||||
c = twint.Config()
|
||||
c.Search = search
|
||||
c.Near = city
|
||||
c.Limit = limit
|
||||
c.Popular_tweets = window.Popular.checkState()
|
||||
|
||||
#c.Since = window.Since
|
||||
#c.Until =
|
||||
#c.Username =
|
||||
|
||||
#filename becomes the file path
|
||||
filename = os.getcwd() + '/output' + '/' + window.Filename.toPlainText() + '.txt'
|
||||
c.Output = filename
|
||||
|
||||
twint.run.Search(c)
|
||||
|
||||
# is me :D results_textbox.config(state=DISABLED)
|
||||
|
||||
|
||||
loader = QUiLoader()
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
|
||||
window = loader.load("mainwindow.ui", None)
|
||||
|
||||
window.SearchButton.clicked.connect(tweet_search)
|
||||
window.show()
|
||||
|
||||
|
||||
app.exec()
|
||||
Reference in New Issue
Block a user