Files
TweetSearcherPOG/twintgui.py
2021-08-20 22:27:22 +02:00

82 lines
1.8 KiB
Python

# main.py
import os
import sys
from PySide6 import *
from PySide6 import QtWidgets
from PySide6.QtUiTools import QUiLoader
import twint
from PySide6.QtWidgets import QApplication, QPushButton
from PySide6.QtCore import Slot
import sqlite3
#Ggsya made this :D
backslash = '\\'
#def check_and_create_dir(path):
#if os.path.exists(path):
#print('Dir already exists')
#print('Exiting')
#else:
#os.mkdir(path)
#Ggsleeb if you're reading this please use Tab instead of space idk python dumb
#Nvm its Qt Creator thats big dumb why tf is tab just a bunch of spaces wtf
#Date Transformation Function
#def date_cruncher(Weekday,month,day,year):
# if (month != 'Jan'):
# pass month = '1'
#
# date = day + month + year
# print("I crunched the date!")
# print(date)
def tweet_search():
#checking if output folder exists
#check_and_create_dir(os.getcwd() + '\output')
search = window.Keyword.toPlainText()
city = window.City.toPlainText()
#filename = os.getcwd() + '\output' + backslash + window.Filename.toPlainText()
filename = window.Filename.toPlainText()
limit = window.Limit.toPlainText()
if limit != '':
pass
else:
limit = 0
c = twint.Config()
c.Search = search
c.Near = city
c.Limit = limit
c.Store_csv = True
c.Popular_tweets = window.Popular.checkState()
c.Output = filename
c.timedelta = '2'
c.Since = window.Since.date().toString()
c.Until = window.Until.date().toString()
#c.Username =
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(date_cruncher)
window.SearchButton.clicked.connect(tweet_search)
print(window.Since.date().toString())
print(window.Until.date().toString())
window.show()
app.exec()