commit 9108b97032d85615e3e0043f913f00601689f96f Author: MrARM Date: Tue Jun 23 23:17:05 2020 -0500 scripted upload to gitlab diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..80046a9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,104 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# dotenv +.env + +# virtualenv +.venv +venv/ +ENV/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ + +*.log +.idea/ diff --git a/conn_settings.txt b/conn_settings.txt new file mode 100644 index 0000000..0f6d8cb --- /dev/null +++ b/conn_settings.txt @@ -0,0 +1,2 @@ +BEARER_TOKEN=hLdtXH8baCeRCtoW8ARUB0CRcfSeyOH8eocOyqQ4nmuZtXwKw2zVZcb1rwtoiMDP","accessToken":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjIyNzU1MDU4LCJ1c2VybmFtZSI6IlJpY2hhcmQxNTAiLCJhdmF0YXJVcmwiOiJzMzovL2h5cGVzcGFjZS1xdWl6L2RlZmF1bHRfYXZhdGFycy9VbnRpdGxlZC0xXzAwMDFfYmx1ZS5wbmciLCJ0b2tlbiI6ImhMZHRYSCIsInJvbGVzIjpbXSwiY2xpZW50IjoiIiwiZ3Vlc3RJZCI6bnVsbCwidiI6MSwiaWF0IjoxNTM1NDE4MjQ1LCJleHAiOjE1NDMxOTQyNDUsImlzcyI6Imh5cGVxdWl6LzEifQ.upfa3v5QCW3sl2bSt5vMyroDYuwIdExds_OiiSfCT_A +USER_ID=21149316 \ No newline at end of file diff --git a/hq.ui b/hq.ui new file mode 100644 index 0000000..5c973dc --- /dev/null +++ b/hq.ui @@ -0,0 +1,357 @@ + + + HQApp + + + + 0 + 0 + 1298 + 440 + + + + Form + + + QWidget#HQApp { +background-color: #36399A; +} +QLabel { color: white; } + + + + + + + 0 + 0 + + + + + 300 + 300 + + + + images/hqlogo.jpg + + + true + + + + + + + + + + NEXT GAME + + + Qt::AlignCenter + + + + + + + + 10 + 75 + true + + + + + + + $5,000 Prize + + + Qt::AlignCenter + + + + + + + + 10 + 75 + true + + + + + + + 2PM CDT + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + 1 + 1 + + + + QWidget#GooglePanel { +background-color: white; +border-radius: 10px; +} + + + + + + + + 24 + + + Qt::AlignCenter + + + Answer B + + + + + + + 0 + + + 100 + + + 63 + + + Qt::AlignCenter + + + Answer A + + + + + + + 12 + + + Qt::AlignCenter + + + Answer C + + + + + + + + + + 300 + 100 + + + + + + + images/google.png + + + true + + + + + + + + + + + 1 + 0 + + + + QWidget#WebpagePanel { +background-color: white; +border-radius: 10px; +} +QLabel { color: black; } + + + + + + + 100 + 100 + + + + + + + images/webpage.png + + + true + + + Qt::AlignJustify|Qt::AlignVCenter + + + + + + + + 11 + + + + Website Search + + + + + + + + + 24 + + + Qt::AlignCenter + + + Answer B + + + + + + + 24 + + + Qt::AlignCenter + + + Answer A + + + + + + + 52 + + + Qt::AlignCenter + + + Answer C + + + + + + + + + + + + + 0 + 0 + + + + background-color: white; +border-radius: 10px; +color: white; + + + + + + + 0 + 0 + + + + + 14 + 75 + true + + + + color: black; + + + [Q1] What is a question? + + + Qt::AlignCenter + + + + + + + + + + + + + diff --git a/hq_gui.py b/hq_gui.py new file mode 100644 index 0000000..ec5d830 --- /dev/null +++ b/hq_gui.py @@ -0,0 +1,365 @@ +import asyncio +from question import QuestionHandler +from PyQt5.QtGui import QFont, QPixmap, QPalette, QColor, QFontMetrics +from PyQt5.QtWidgets import QWidget, QPushButton, QLabel, QProgressBar, QGridLayout +from PyQt5.QtWidgets import QFrame, QSpacerItem, QSizePolicy +from PyQt5.QtCore import QRect, Qt, QEasingCurve, pyqtSignal, QPropertyAnimation, QUrl +import vlc +import re + +def getPropertyAnimation(self, name, duration, start, end, keyValues={}): + animation = QPropertyAnimation(self, bytes(str.encode(name))) + animation.setDuration(duration) + animation.setStartValue(start) + animation.setEndValue(end) + for k, v in keyValues.items(): + animation.setKeyValueAt(k, v) + return animation + +class VideoFrame(QFrame): + def resizeEvent(self, event): + super().resizeEvent(event) + print(event.size()) + self.setFixedWidth((300/535) * event.size().height()) + +class HQApp(QWidget): + nextGameInfo = pyqtSignal([str, str]) + streamLive = pyqtSignal(str) + streamStop = pyqtSignal() + getTrivia = pyqtSignal() + + def __init__(self, q): + super().__init__() + + self.q = q + self.googleAnswers = [] + self.webpageAnswers = [] + self.animations = [] + self.streaming = False + + self.vlc = vlc.Instance() + self.player = self.vlc.media_player_new() + + self.setupUI() + self.setupSignals() + + def setupUI(self): + self.resize(1300, 600)#.setFixedSize(1300, 440) + self.setObjectName('HQApp') + self.setStyleSheet('QWidget#HQApp { background-color: #36399A; } QLabel { color: white; }') + layout = QGridLayout(self) + layout.setContentsMargins(9, 9, 200, 9) + + self.hqLogo = QLabel(self) + self.hqLogo.setPixmap(QPixmap('images/hqlogo.jpg')) + self.hqLogo.setMaximumSize(300, 300) + self.hqLogo.setScaledContents(True) + layout.addWidget(self.hqLogo, 1, 0, 1, 1) + + self.showStatus = QLabel(self) + self.showStatus.setText('NEXT GAME') + self.showStatus.hide() + self.showStatus.setAlignment(Qt.AlignCenter) + layout.addWidget(self.showStatus, 2, 0, 1, 1) + + font = QFont() + font.setPointSize(10) + font.setBold(True) + font.setWeight(75) + + self.showTime = QLabel(self) + self.showTime.setText('2PM CDT') + self.showTime.hide() + self.showTime.setAlignment(Qt.AlignCenter) + self.showTime.setFont(font) + layout.addWidget(self.showTime, 3, 0, 1, 1) + + self.showPrize = QLabel(self) + self.showPrize.setText('$5,000 Prize') + self.showPrize.hide() + self.showPrize.setAlignment(Qt.AlignCenter) + self.showPrize.setFont(font) + layout.addWidget(self.showPrize, 4, 0, 1, 1) + + self.videoFrame = VideoFrame() + self.videoFrame.resize(300, 420) + p = self.videoFrame.palette() + p.setColor(QPalette.Window, QColor(0, 0, 0)) + self.videoFrame.setPalette(p) + self.videoFrame.setAutoFillBackground(True) + self.videoFrame.hide() + layout.addWidget(self.videoFrame, 0, 0, 6, 1) + + topSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) + bottomSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) + layout.addItem(topSpacer, 0, 0, 1, 1) + layout.addItem(bottomSpacer, 5, 0, 1, 1) + + rlayout = QGridLayout() + layout.addLayout(rlayout, 0, 1, 6, 1) + + topSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) + bottomSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) + rlayout.addItem(topSpacer, 0, 0, 1, 1) + rlayout.addItem(bottomSpacer, 3, 0, 1, 1) + + self.googleBG = QWidget(self) + self.googleBG.setStyleSheet('QWidget#GooglePanel { background-color: white; border-radius: 10px; }') + #sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) + #sizePolicy.setHorizontalStretch(1) + #sizePolicy.setVerticalStretch(1) + #sizePolicy.setHeightForWidth(self.googleBG.sizePolicy().hasHeightForWidth()) + #self.googleBG.setSizePolicy(sizePolicy) + self.googleBG.setObjectName('GooglePanel') + googleLayout = QGridLayout(self.googleBG) + rlayout.addWidget(self.googleBG, 2, 0, 1, 1) + + self.webpageBG = QWidget(self) + self.webpageBG.setStyleSheet('QWidget#WebpagePanel { background-color: white; border-radius: 10px; }') + #sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) + #sizePolicy.setHorizontalStretch(1) + #sizePolicy.setVerticalStretch(1) + #sizePolicy.setHeightForWidth(self.webpageBG.sizePolicy().hasHeightForWidth()) + #self.webpageBG.setSizePolicy(sizePolicy) + self.webpageBG.setObjectName('WebpagePanel') + webpageLayout = QGridLayout(self.webpageBG) + rlayout.addWidget(self.webpageBG, 2, 1, 1, 1) + + self.googleLogo = QLabel(self.googleBG) + self.googleLogo.setPixmap(QPixmap('images/google.png')) + self.googleLogo.setMaximumSize(300, 100) + self.googleLogo.setScaledContents(True) + googleLayout.addWidget(self.googleLogo, 0, 1, 1, 1) + leftSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + rightSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + googleLayout.addItem(leftSpacer, 0, 0, 1, 1) + googleLayout.addItem(rightSpacer, 0, 2, 1, 1) + + self.webpageLogo = QLabel(self.webpageBG) + self.webpageLogo.setPixmap(QPixmap('images/webpage.png')) + self.webpageLogo.setMaximumSize(100, 100) + self.webpageLogo.setScaledContents(True) + self.webpageText = QLabel('Website Search', self.webpageBG) + font = QFont() + font.setPointSize(13) + self.webpageText.setFont(font) + self.webpageText.setStyleSheet('color: black;') + webpageLayout.addWidget(self.webpageLogo, 0, 1, 1, 1) + webpageLayout.addWidget(self.webpageText, 0, 2, 1, 1) + leftSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + rightSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + webpageLayout.addItem(leftSpacer, 0, 0, 1, 1) + webpageLayout.addItem(rightSpacer, 0, 3, 1, 1) + + #self.galWidget = QWidget(self) + #self.galWidget.setGeometry(QRect(360, 300, 341, 171)) + self.googleAnswerLayout = QGridLayout() + self.googleAnswerLayout.setContentsMargins(0, 0, 0, 0) + self.googleAnswerA = AnswerBar('A', self) + self.googleAnswerB = AnswerBar('B', self) + self.googleAnswerC = AnswerBar('C', self) + self.googleAnswers = [self.googleAnswerA, self.googleAnswerB, self.googleAnswerC] + for answer in self.googleAnswers: + answer.hide() + self.googleAnswerLayout.addWidget(self.googleAnswerA, 0, 0, 1, 1) + self.googleAnswerLayout.addWidget(self.googleAnswerB, 1, 0, 1, 1) + self.googleAnswerLayout.addWidget(self.googleAnswerC, 2, 0, 1, 1) + self.googleExplanation = QLabel( + "Google answers come straight from Google results themselves, meaning that when it works, it's often the most realiable. " \ + "If Google's confident, it may be because of it's smart card / feedback system... a definite sign that it has the correct answer.\n\nBoth answer " \ + "sources return the reverse order of its findings if the question has a negative term in it -- such as \"NOT\"," \ + " which may be inaccurate if the Google search also considers the \"NOT\" when it's returning results. Be wary." + ) + self.googleExplanation.setStyleSheet('color: black;') + self.googleExplanation.setWordWrap(True) + self.googleAnswerLayout.addWidget(self.googleExplanation, 0, 0, 3, 1) + googleLayout.addLayout(self.googleAnswerLayout, 1, 0, 1, 3) + + #self.walWidget = QWidget(self) + #self.walWidget.setGeometry(QRect(750, 300, 341, 171)) + self.webpageAnswerLayout = QGridLayout() + self.webpageAnswerLayout.setContentsMargins(0, 0, 0, 0) + self.webpageAnswerA = AnswerBar('A', self) + self.webpageAnswerB = AnswerBar('B', self) + self.webpageAnswerC = AnswerBar('C', self) + self.webpageAnswers = [self.webpageAnswerA, self.webpageAnswerB, self.webpageAnswerC] + for answer in self.webpageAnswers: + answer.hide() + self.webpageAnswerLayout.addWidget(self.webpageAnswerA, 0, 0, 1, 1) + self.webpageAnswerLayout.addWidget(self.webpageAnswerB, 1, 0, 1, 1) + self.webpageAnswerLayout.addWidget(self.webpageAnswerC, 2, 0, 1, 1) + self.webpageExplanation = QLabel( + "Webpage results is the plain text of the sites in the Google results split into keywords and compared " \ + "against the available answers. This can be helpful for questions that are not so straightforward, " \ + "since websites contain the complete text of what they have to say, rather than Google's small previews and compact card information. " \ + "\n\nUsually if Google " \ + "and the website search have eliminated one answer but can't decide between the other two, whichever one is " \ + "chosen by both Google and the website search is correct." + ) + self.webpageExplanation.setStyleSheet('color: black;') + self.webpageExplanation.setWordWrap(True) + self.webpageAnswerLayout.addWidget(self.webpageExplanation, 0, 0, 3, 1) + webpageLayout.addLayout(self.webpageAnswerLayout, 1, 0, 1, 4) + + self.questionBG = QWidget(self) + self.questionBG.setStyleSheet('background-color: white; border-radius: 10px; color: black;') + #sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) + #sizePolicy.setHorizontalStretch(1) + #sizePolicy.setVerticalStretch(1) + #sizePolicy.setHeightForWidth(self.googleBG.sizePolicy().hasHeightForWidth()) + #self.googleBG.setSizePolicy(sizePolicy) + questionLayout = QGridLayout(self.questionBG) + rlayout.addWidget(self.questionBG, 1, 0, 1, 2) + + font = QFont() + font.setPointSize(20) + font.setBold(True) + font.setWeight(75) + self.question = QLabel(self.questionBG) + self.question.setFont(font) + self.question.setAlignment(Qt.AlignCenter) + self.question.setText('HQ Trivia') + questionLayout.addWidget(self.question, 0, 0, 1, 1) + + self.button = QPushButton('Get Trivia', self) + layout.addWidget(self.button, 6, 0, 1, 1) + + #self.videoFrame.show() + self.show() + + for answer in self.googleAnswers + self.webpageAnswers: + answer.setValue(0) + + def setupSignals(self): + self.nextGameInfo.connect(self.setNextGame) + self.streamLive.connect(self.startStream) + self.streamStop.connect(self.stopStream) + #self.button.clicked.connect(self.resetCount) + self.q.searching.connect(self.newSearch) + self.q.googleResults.connect(self.setGoogleResults) + self.q.pageResults.connect(self.setWebpageResults) + + def setNextGame(self, time, prize): + self.showTime.setText(time) + self.showPrize.setText(prize + ' Prize') + self.showStatus.show() + self.showTime.show() + self.showPrize.show() + + def newSearch(self, qn, newQuestion, answers, formattedAnswers): + self.animations.clear() + + questionText = '[Q{}] {}'.format(qn, newQuestion) + textWidth = self.questionBG.width() - 10 + textSize = 20 + while textWidth >= self.questionBG.width() - 10: + font = QFont() + font.setPointSize(textSize) + font.setBold(True) + font.setWeight(75) + textWidth = QFontMetrics(font).width(questionText) + textSize -= 1 + self.question.setFont(font) + self.question.setText(questionText) + + self.answers = {answers[0]: formattedAnswers[0], answers[1]: formattedAnswers[1], answers[2]: formattedAnswers[2]} + + self.googleExplanation.hide() + self.webpageExplanation.hide() + for answer in self.googleAnswers + self.webpageAnswers: + if answer.letter == 'A': answer.setAnswer(answers[0]) + elif answer.letter == 'B': answer.setAnswer(answers[1]) + elif answer.letter == 'C': answer.setAnswer(answers[2]) + answer.show() + + if answer.maximum() == 0: + answer.setValue(0) + answer.setMaximum(1) + else: + animation = getPropertyAnimation(answer, 'value', 1000, answer.value(), 0) + animation.setEasingCurve(QEasingCurve.OutQuad) + self.animations.append(animation) + animation.start() + + def setGoogleResults(self, results, reverse): + if any([type(v) == dict for v in results.values()]): + formattedResults = {} + for a, d in results.items(): + formattedResults[a] = sum(d.values()) + results = formattedResults + + total = sum(results.values()) * 1000 + for answer in self.googleAnswers: + answer.setMaximum(total) + for orgAnswer, formatAnswer in self.answers.items(): + if answer.text() == orgAnswer: + for rname, count in results.items(): + if re.sub('[^a-zA-Z0-9 ]', '', rname).lower() == re.sub('[^a-zA-Z0-9 ]', '', orgAnswer).lower(): + if reverse: + if count == max(results.values()): + count = min(results.values()) + elif count == min(results.values()): + count = max(results.values()) + animation = getPropertyAnimation(answer, 'value', 1000, 0, count * 1000) + animation.setEasingCurve(QEasingCurve.OutQuad) + self.animations.append(animation) + animation.start() + + def setWebpageResults(self, results, reverse): + total = sum(results.values()) * 1000 + for answer in self.webpageAnswers: + answer.setMaximum(total) + for orgAnswer, formatAnswer in self.answers.items(): + if answer.text() == orgAnswer: + for rname, count in results.items(): + if re.sub('[^a-zA-Z0-9 ]', '', rname).lower() == re.sub('[^a-zA-Z0-9 ]', '', orgAnswer).lower(): + if reverse: + if count == max(results.values()): + count = min(results.values()) + elif count == min(results.values()): + count = max(results.values()) + animation = getPropertyAnimation(answer, 'value', 1000, 0, count * 1000) + animation.setEasingCurve(QEasingCurve.OutQuad) + self.animations.append(animation) + animation.start() + + def startStream(self, url): + if self.streaming: + return + self.media = self.vlc.media_new(url) + self.player.set_media(self.media) + self.player.set_hwnd(self.videoFrame.winId()) + self.streaming = True + self.player.play() + self.videoFrame.show() + + def stopStream(self): + self.streaming = False + self.player.stop() + self.videoFrame.hide() + +class AnswerBar(QProgressBar): + def __init__(self, letter, parent): + super().__init__(parent) + #self.setAnswer('Answer {}'.format(letter.upper())) + self.letter = letter + self.setAnswer('') + self.setAlignment(Qt.AlignCenter) + self.setCount(0, 100) + self.setStyleSheet("QProgressBar { border: 2px solid grey; border-radius: 5px; }\n" +"QProgressBar::chunk { background-color: #50C994; width: 1px; }") + + def setAnswer(self, answer): + self.setFormat(answer) + + def setCount(self, count, total): + self.setMaximum(total) + self.setValue(count) + +if __name__ == '__main__': + from PyQt5.QtWidgets import QApplication + import sys + app = QApplication(sys.argv) + hq = HQApp() + hq.setupUI() + app.exec_() \ No newline at end of file diff --git a/hq_main.py b/hq_main.py new file mode 100644 index 0000000..63e14b5 --- /dev/null +++ b/hq_main.py @@ -0,0 +1,110 @@ +import asyncio +import logging +import requests +import sys +import time +import csv +from ast import literal_eval +from datetime import datetime +from question import QuestionHandler + +import networking + +from PyQt5.QtWidgets import QApplication +from hq_gui import HQApp +from quamash import QEventLoop, QThreadExecutor + +app = QApplication(sys.argv) +loop = QEventLoop(app) +asyncio.set_event_loop(loop) + +# Set up logging +logging.basicConfig(filename="data.log", level=logging.INFO, filemode="w") + +# Read in bearer token and user ID +with open("conn_settings.txt", "r") as conn_settings: + BEARER_TOKEN = conn_settings.readline().strip().split("=")[1] + USER_ID = conn_settings.readline().strip().split("=")[1] + +print("getting") +main_url = f"https://api-quiz.hype.space/shows/now?type=hq&userId={USER_ID}" +headers = {"Authorization": f"Bearer {BEARER_TOKEN}", + "x-hq-client": "Android/1.6.1"} +HEADERS = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0", + "Accept": "*/*", + "Accept-Language": "en-US,en;q=0.5", + "Accept-Encoding": "gzip, deflate"} +# "x-hq-stk": "MQ==", +# "Connection": "Keep-Alive", +# "User-Agent": "okhttp/3.8.0"} + +q = QuestionHandler() +hqApp = HQApp(q) + +import re +import random +trivia = [] +with open('trivia2.csv', 'r') as csvfile: + reader = csv.reader(csvfile) + for row in reader: + if row[1] == 'options': continue + question = re.sub(r'^\d+\. ?', '', row[0].strip()) + if 'which' not in question.lower(): continue + answers = literal_eval(row[1]) + if len(answers) != 3: + continue + correct = int(row[2]) + trivia.append({'q': question, 'a': answers, 'c': correct}) +i = 0 +def getTrivia(): + global i + i += 1 + result = requests.get('https://opentdb.com/api.php?amount=1&type=multiple').json()['results'][0] + question = result['question'].replace('"', '').replace(''', "'") + answers = [result['correct_answer']] + result['incorrect_answers'][:2] + loop.create_task(q.answer_question(str(i), question, answers)) + +hqApp.button.clicked.connect(getTrivia) +#hqApp.streamLive.emit('rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov') +#hqApp.videoFrame.raise_() +#hqApp.button.hide() + +while True: + print() + try: + app.processEvents() + response_data = loop.run_until_complete( + networking.get_json_response(main_url, timeout=1.5, headers=headers)) + except Exception as e: + import traceback + print(traceback.format_exc()) + print("Server response not JSON, retrying...") + loop.run_until_complete(asyncio.sleep(1)) + continue + + logging.info(response_data) + + if "broadcast" not in response_data or response_data["broadcast"] is None: + if "error" in response_data and response_data["error"] == "Auth not valid": + raise RuntimeError("Connection settings invalid") + else: + print("Show not on.") + next_time = datetime.strptime(response_data["nextShowTime"], "%Y-%m-%dT%H:%M:%S.000Z") + now = time.time() + offset = datetime.fromtimestamp(now) - datetime.utcfromtimestamp(now) + + print(f"Next show time: {(next_time + offset).strftime('%Y-%m-%d %I:%M %p')}") + print("Prize: " + response_data["nextShowPrize"]) + hqApp.nextGameInfo.emit((next_time + offset).strftime('%Y-%m-%d %I:%M %p'), response_data['nextShowPrize']) + if hqApp.streaming: + hqApp.streamStop.emit() + loop.run_until_complete(asyncio.sleep(5)) + else: + socket = response_data["broadcast"]["socketUrl"] + stream = response_data["broadcast"]["streamUrl"] + print(stream) + print(f"Show active, connecting to socket at {socket}") + if not hqApp.streaming: + hqApp.streamLive.emit(stream) + hqApp.videoFrame.raise_() + loop.run_until_complete(networking.websocket_handler(q, socket, headers)) diff --git a/images/google.png b/images/google.png new file mode 100644 index 0000000..2fa8d7c Binary files /dev/null and b/images/google.png differ diff --git a/images/hq-100.jpg b/images/hq-100.jpg new file mode 100644 index 0000000..d71fca3 Binary files /dev/null and b/images/hq-100.jpg differ diff --git a/images/hqlogo.jpg b/images/hqlogo.jpg new file mode 100644 index 0000000..a9d91d1 Binary files /dev/null and b/images/hqlogo.jpg differ diff --git a/images/webpage.png b/images/webpage.png new file mode 100644 index 0000000..00a2c3d Binary files /dev/null and b/images/webpage.png differ diff --git a/l.py b/l.py new file mode 100644 index 0000000..c24ab74 --- /dev/null +++ b/l.py @@ -0,0 +1,5 @@ +import PyLivestream + +s = PyLivestream.Screenshare('stream.ini', 'youtube') +print('going live on', s.sites) +s.golive() \ No newline at end of file diff --git a/networking.py b/networking.py new file mode 100644 index 0000000..71c149c --- /dev/null +++ b/networking.py @@ -0,0 +1,74 @@ +import asyncio +import json +import logging +import re + +import aiohttp + +import question + + +async def fetch(url, session, timeout): + try: + async with session.get(url, timeout=timeout) as response: + return await response.text() + except asyncio.TimeoutError: + print(f"Server timeout ({timeout}) to {url}") + logging.exception(f"Server timeout ({timeout}) to {url}") + return "" + except Exception: + print(f"Server error to {url}") + logging.exception(f"Server error to {url}") + return "" + +async def get_responses(urls, timeout, headers): + tasks = [] + async with aiohttp.ClientSession(headers=headers) as session: + for url in urls: + task = asyncio.ensure_future(fetch(url, session, timeout)) + tasks.append(task) + + responses = await asyncio.gather(*tasks) + return responses + + +async def get_response(url, timeout, headers): + async with aiohttp.ClientSession(headers=headers) as session: + return await fetch(url, session, timeout) + + +async def get_json_response(url, timeout, headers): + async with aiohttp.ClientSession(headers=headers) as session: + async with session.get(url, timeout=timeout) as response: + return await response.json() + + +async def websocket_handler(handler, uri, headers): + async with aiohttp.ClientSession() as session: + async with session.ws_connect(uri, headers=headers, heartbeat=5) as ws: + print("Connected") + async for msg in ws: + if msg.type == aiohttp.WSMsgType.TEXT: + message = msg.data + message = re.sub(r"[\x00-\x1f\x7f-\x9f]", "", message) + + message_data = json.loads(message) + logging.info(str(message_data).encode("utf-8")) + + if "error" in message_data and message_data["error"] == "Auth not valid": + logging.info(message_data) + raise RuntimeError("Connection settings invalid") + elif message_data["type"] != "interaction": + logging.info(message_data) + if message_data["type"] == "question": + question_str = message_data["question"] + answers = [ans["text"] for ans in message_data["answers"] if ans["text"].strip() != ""] + print("\n" * 5) + print("Question detected.") + print(f"Question {message_data['questionNumber']} out of {message_data['questionCount']}") + print(question_str) + print(answers) + print() + print(await handler.answer_question(message_data['questionNumber'], question_str, answers)) + + print("Socket closed") \ No newline at end of file diff --git a/question.py b/question.py new file mode 100644 index 0000000..1f16a36 --- /dev/null +++ b/question.py @@ -0,0 +1,147 @@ +import itertools +import re +import time +from collections import defaultdict +from PyQt5.QtCore import pyqtSignal, QObject + +from unidecode import unidecode + +import search + +punctuation_to_none = str.maketrans({key: None for key in "!\"#$%&\'()*+,-.:;<=>?@[\\]^_`{|}~�"}) +punctuation_to_space = str.maketrans({key: " " for key in "!\"#$%&\'()*+,-.:;<=>?@[\\]^_`{|}~�"}) + +class QuestionHandler(QObject): + searching = pyqtSignal([str, str, list, list]) + googleResults = pyqtSignal([dict, bool]) + pageResults = pyqtSignal([dict, bool]) + + async def answer_question(self, qn, question, original_answers): + print("Searching") + start = time.time() + + question = unidecode(question) + + answers = [] + for ans in original_answers: + ans = unidecode(ans) + answers.append(ans.translate(punctuation_to_none)) + #answers.append(ans.translate(punctuation_to_space)) + answers = list(dict.fromkeys(answers)) + print('Possible Answers: {}'.format(answers)) + self.searching.emit(str(qn), question, original_answers, answers) + + reverse = True + if ("NOT" in question and '"NOT"' not in question): + question = re.sub(r'\bNOT\b', ' ', question) + elif ("least" in question.lower() and "at least" not in question.lower() and '"least"' not in question.lower()): + question = re.sub(r'\bleast\b', ' most ', question) + elif ("fewest" in question and '"fewest"' not in question): + question = re.sub(r'\bfewest\b', ' most ', question) + elif ("NEVER" in question and '"NEVER"' not in question): + question = re.sub(r'\bNOT\b', ' always ', question) + elif ("NON" in question and '"NON"' not in question): + question = re.sub(r'\bNON', ' ', question) + else: + reverse = False + + question_lower = question.lower().replace('"', '').replace("'", '"') + question_lower = question_lower.replace('which of these', 'what').replace('which', 'what') + + """quoted = re.findall('"([^"]*)"', question_lower) # Get all words in quotes + no_quote = question_lower + for quote in quoted: + no_quote = no_quote.replace(f"\"{quote}\"", "1placeholder1") + + question_keywords = search.find_keywords(no_quote) + for quote in quoted: + question_keywords[question_keywords.index("1placeholder1")] = quote""" + + #if 'which' in question_lower: + #question_lower += ' ({})'.format(' OR '.join(answers)) + + print('Search: "{}"'.format(question_lower)) + smart_data, search_results = await search.search_google(question_lower, 5) + print('Smart Data: {}'.format(smart_data)) + print('Search Results: {}'.format(search_results)) + + print('Searching smart Google data and website previews...') + search_text = [search.clean_html(x).lower().translate(punctuation_to_none) for x in smart_data] + counts = await self._search_method1(search_text, answers, reverse) + if counts: + self.googleResults.emit(counts, reverse) + else: + counts = await self._search_method2(search_text, answers, reverse) + print(counts) + if counts: + self.googleResults.emit(counts, reverse) + print('GOOGLE THINKS: {}'.format(min(counts, key=counts.get) if reverse else max(counts, key=counts.get))) + else: + self.googleResults.emit({k: 0 for k in answers}, False) + print('GOOGLE is not sure.') + + + print() + print('Searching full websites provided by Google...') + search_text = [x.translate(punctuation_to_none) for x in await search.get_clean_texts(search_results)] + counts = await self._search_method1(search_text, answers, reverse) + if counts: + self.pageResults.emit(counts, reverse) + else: + counts = await self._search_method2(search_text, answers, reverse) + if counts: + self.pageResults.emit(counts, reverse) + print('WEBSITES THINK: {}'.format(min(counts, key=counts.get) if reverse else max(counts, key=counts.get))) + else: + self.pageResults.emit({k: 0 for k in answers}, False) + print('WEBSITES are not sure.') + + + print(f"Search took {time.time() - start} seconds") + return "" + + async def _search_method1(self, texts, answers, reverse): + """ + Returns the answer with the maximum/minimum number of exact occurrences in the texts. + :param texts: List of text to analyze + :param answers: List of answers + :param reverse: True if the best answer occurs the least, False otherwise + :return: Answer that occurs the most/least in the texts, empty string if there is a tie + """ + print("Running method 1") + counts = {answer.lower(): 0 for answer in answers} + + for text in texts: + for answer in counts: + counts[answer] += len(re.findall(f"\\b{answer}\\b", text)) + + print(counts) + + # If not all answers have count of 0 and the best value doesn't occur more than once, return the best answer + best_value = min(counts.values()) if reverse else max(counts.values()) + if not all(c == 0 for c in counts.values()) and list(counts.values()).count(best_value) == 1: + return counts + return "" + + async def _search_method2(self, texts, answers, reverse): + """ + Return the answer with the maximum/minimum number of keyword occurrences in the texts. + :param texts: List of text to analyze + :param answers: List of answers + :param reverse: True if the best answer occurs the least, False otherwise + :return: Answer whose keywords occur most/least in the texts + """ + print("Running method 2") + counts = {answer: {keyword: 0 for keyword in search.find_keywords(answer)} for answer in answers} + + for text in texts: + for keyword_counts in counts.values(): + for keyword in keyword_counts: + keyword_counts[keyword] += len(re.findall(f" {keyword} ", text)) + + print(counts) + counts_sum = {answer: sum(keyword_counts.values()) for answer, keyword_counts in counts.items()} + + if not all(c == 0 for c in counts_sum.values()): + return counts_sum + return "" \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..3f2afbf --- /dev/null +++ b/requirements.txt @@ -0,0 +1,8 @@ +aiohttp +bs4 +nltk +unidecode +aiodns +cchardet +PyQt5 +git+https://github.com/TheRandomDog/quamash.git diff --git a/search.py b/search.py new file mode 100644 index 0000000..e39e1d0 --- /dev/null +++ b/search.py @@ -0,0 +1,123 @@ +import re +from html import unescape + +from bs4 import BeautifulSoup +from nltk import word_tokenize +from nltk.corpus import stopwords +from nltk.tag.perceptron import PerceptronTagger +from nltk.tokenize import RegexpTokenizer +from unidecode import unidecode + +import networking + +STOP = set(stopwords.words("english")) - {"most", "least"} +tokenizer = RegexpTokenizer(r"\w+") +tagger = PerceptronTagger() +HEADERS = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0) Gecko/20100101 Firefox/59.0", + "Accept": "*/*", + "Accept-Language": "en-US,en;q=0.5", + "Accept-Encoding": "gzip, deflate"} +GOOGLE_URL = "https://www.google.com/search?q={}&ie=utf-8&oe=utf-8&client=firefox-b-1-ab" + + +def find_keywords(words): + """ + Returns the list of words given without stopwords. + :param words: List of words + :return: Words without stopwords + """ + return [w for w in tokenizer.tokenize(words.lower()) if w not in STOP] + + +def find_nouns(text, num_words, reverse=False): + tokens = word_tokenize(text) + tags = tagger.tag(tokens) + print(tags) + + tags = tags[:num_words] if not reverse else tags[-num_words:] + + nouns = [] + consecutive_nouns = [] + + for tag in tags: + tag_type = tag[1] + word = tag[0] + + if "NN" not in tag_type and len(consecutive_nouns) > 0: + nouns.append(" ".join(consecutive_nouns)) + consecutive_nouns = [] + elif "NN" in tag_type: + consecutive_nouns.append(word) + + if len(consecutive_nouns) > 0: + nouns.append(" ".join(consecutive_nouns)) + + return nouns + + +def get_google_links(page, num_results): + soup = BeautifulSoup(page, "html.parser") + results = soup.findAll("h3", {"class": "r"}) + + links = [] + for r in results: + url = r.find("a") + if url is not None: + links.append(url["href"]) + links = list(dict.fromkeys(links)) # Remove duplicates while preserving order + + return links[:num_results] + +def get_smart_data(page): + soup = BeautifulSoup(page, 'html.parser') + result = ( + soup.find('div', {'class': 'Z0LcW'}) # Google Card + or soup.find('span', {'class': 'Y0NH2b'}) # Featured Snippet + ) + if result: + return [result.text] + [r.text for r in soup.findAll('span', {'class': 'st'})] + else: # Descriptions generated by Google Search results are also pretty relevant. + return [r.text for r in soup.findAll('span', {'class': 'st'})] + +async def search_google(question, num_results): + """ + Returns num_results urls from a google search of question. + :param question: Question to search + :param num_results: Number of results to return + :return: List of length num_results of urls retrieved from the search + """ + # Could use Google's Custom Search API here, limit of 100 queries per day + # result = service.cse().list(q=question, cx=CSE_ID, num=num_results).execute() + # return result["items"] + page = await networking.get_response(GOOGLE_URL.format(question), timeout=5, headers=HEADERS) + smart = get_smart_data(page) + return (smart, get_google_links(page, num_results)) + + +async def multiple_search(questions, num_results): + queries = list(map(GOOGLE_URL.format, questions)) + pages = await networking.get_responses(queries, timeout=5, headers=HEADERS) + link_list = [get_google_links(page, num_results) for page in pages] + return link_list + + +def clean_html(html): + # First we remove inline JavaScript/CSS: + cleaned = re.sub(r"(?is)<(script|style).*?>.*?()", "", html.strip()) + # Then we remove html comments. This has to be done before removing regular + # tags since comments can contain '>' characters. + cleaned = re.sub(r"(?s)[\n]?", "", cleaned) + # Next we can remove the remaining tags: + cleaned = re.sub(r"(?s)<.*?>", " ", cleaned) + # Finally, we deal with whitespace + cleaned = re.sub(r" ", " ", cleaned) + cleaned = re.sub(r"\n", " ", cleaned) + cleaned = re.sub(r"\s\s+", " ", cleaned) + + return unidecode(unescape(cleaned.strip())) + + +async def get_clean_texts(urls, timeout=2.5, headers=HEADERS): + responses = await networking.get_responses(urls, timeout, headers) + + return [clean_html(r).lower() for r in responses] diff --git a/stream.ini b/stream.ini new file mode 100644 index 0000000..fa8b0df --- /dev/null +++ b/stream.ini @@ -0,0 +1,66 @@ +[DEFAULT] +screencap_origin: 0,0 +screencap_res: 1280x720 +screencap_fps: 30 +audiofs: 44100 +keyframe_sec: 2 +audio_bps: 128k +preset: ultrafast +exe: ffmpeg +timelimit: + +# indexed by sys.platform +[win32] +vcap: gdigrab +videochan: desktop +#vcap: dshow +#videochan: video="UScreenCapture" +#acap: dshow +#audiochan: audio="Internal Microphone" +hcam: dshow + +# per-site config +[youtube] +server: rtmp://a.rtmp.youtube.com/live2/ +key: mzv1-8h3w-mamv-eedw + +[periscope] +video_kbps: 800 +audio_bps: 64k +server: rtmp://va.pscp.tv:80/x/ +key: periscope.key + +[facebook] +server: rtmp://live-api.facebook.com:80/rtmp/ +key: + +[restream.io] +audio_bps: 64k +video_kbps: 800 +server: rtmp://us-east.restream.io/live/ +key: restreamio.key + +[twitch] +audio_bps: 96k +server: rtmp://live-jfk.twitch.tv/app/ +key: + +[mixer] +keyframe_sec: 1 +server: rtmp://ingest-wdc.mixer.com:1935/beam +key: + +[ustream] +keyframe_sec: 1 +audio_bps: 128k +server: +key: + +[vimeo] +server: rtmp://rtmp.cloud.vimeo.com/ +key: + +[file] +video_kbps: 2000 +screencap_res: 720x420 +#audio_bps: \ No newline at end of file diff --git a/trivia.csv b/trivia.csv new file mode 100644 index 0000000..949b074 --- /dev/null +++ b/trivia.csv @@ -0,0 +1,1440 @@ +"question","options","correct_answer","game" +" Michael Phelps officially retired in what year?","['2012', '2016', 'He has not retired']","1","" +" Which of these sports is not played with a ball?","['Frisbee', 'Tennis', 'Golf']","0","" +" Infomercials frequently use what promotional phrase?","['My mom loves it', ""But that's not all"", 'Yeehavw']","1","" +" Who did Rob Kardashian have a baby with?","['Blac Chyna', 'Amber Rose', 'Tahiry']","0","" +" What is it called when something speeds up?","['Deceleration', 'Acceleration', 'Stationary status']","1","" +" What is the difference between a typhoon and a hurricane?","['The wind speed', 'The location', 'The wave impact']","1","" +" What is the real name of Michael Jackson's son, 'Blanket', born in 2002?","['Towel', 'Prince Michael II', 'King Michael lII']","1","" +" Which group of people who lived on Crete suddenly disappeared?","['Minoans', 'Atlanteans', 'Mesopotamians']","0","" +" From which country did 'halloumi' cheese originate?","['Turkey', 'Greece', 'Cyprus']","2","" +" Which of the following is NOT a city in upstate New York?","['Wendigo', 'Ithaca', 'Utica']","0","" +" Who, in 1969, traveled to the Moon but didn't set foot on its surface?","['Buzz Aldrin', 'Michael Collins', 'Eamon de Valera']","1","" +" 4. What boxer changed his name to Muhammad Ali in 1964?","['George Foreman', 'Joe Frazier', 'Cassius Clay']","2","QuizBiz" +" 5. ""You Oughta Know"" by Alanis Morissette was said to be about which ex-boyfriend?","['Dave Coulier', 'Stanley Tucci', 'Rob Lowe']","0","QuizBiz" +" 6. What is the name of Obama's ""anger translator"" on the sketch show Key & Peele?","['André', 'DeVon', 'Luther']","2","QuizBiz" +" 7. Which of these is not a gang in the 2002 film Gangs of New York?","['Dead Rabbits', 'Monks', 'Natives']","1","QuizBiz" +" 8. Which of these celebrities didn't serve in the military?","['Drew Carey', 'Jon Hamm', 'Morgan Freeman']","1","QuizBiz" +" 9. Which Nu Metal band was formed by a platinum-selling 80's rock star?","['Methods of Mayhem', 'System of a Down', 'Mudvayne']","2","QuizBiz" +" 11. A group of owls is called a parliament. Who originated the term?","['C.S. Lewis', 'Charles Dickens', 'Oscar Wilde']","0","QuizBiz" +" 1. Which vitamin is produced when a person is exposed to sunlight?","['VitaminC', 'Vitamin D', 'Vitamin EB']","1","QuizBiz" +" 2. What AMC series about a small time lawyer is a spinoff of ""Breaking Bad""?","['""Preacher', '""Sons of Anarchy""', '""Better Call Saul""']","2","QuizBiz" +" 3. What is the only bird known to fly backwards?","['Pelican', 'Hummingbird', 'Hawk']","1","QuizBiz" +" 4. Ben and Jerry's Ice Cream was founded in which U.S. state?","['Vermont', 'New York', 'Massachusetts']","0","QuizBiz" +" 5. Which is not a celebrity that has gone to jail?","['Martha Stewart', 'Mel Gibson', 'Wesley Snipes']","1","QuizBiz" +" 6. Which college did basketball legend, Michael Jordan attend?","['Duke', 'Kentucky', 'North Carolina']","2","QuizBiz" +" 7. What is the fastest land snake on Earth?","['Anaconda', 'Black Mamba', 'Boa Constrictor']","1","QuizBiz" +" 8. Who was the first president to reside at the White House?","['John Adams', 'George Washington', 'Thomas Jefferson']","0","QuizBiz" +" 9. How many time zones are in Canada?","['Four', 'Five', 'Six']","2","QuizBiz" +" 10. What capital in the lower 48 states sits farthest west?","['Sacramento', 'Olympia', 'Salem']","2","QuizBiz" +" 11. In 1975, the digital camera was invented at which company?","['Fujifilm', 'Polaroid', 'Kodak']","2","QuizBiz" +" 12. Which country has the longest land border?","['Russia', 'China', 'Canada']","1","QuizBiz" +" Who did Rob Kardashian have a baby with?","['Blac Chyna', 'Amber Rose', 'Tahiry']","0","" +" Which company is listed on both the Dow Jones Industrial Average and the NASDAQ-100?","['IBM', 'T-Mobile', 'Intel']","2","" +" Which of these is NOT the name of a geographical feature on the Moon?","['Foaming Sea', 'Sunset Sea', 'Sea of Waves']","1","" +" What was the prime reason for the 14th century leadership crisis in the Catholic church?","['Rival popes', 'Emperor Charlemagne', ""Thirty Years' War""]","0","" +" Which fashion designer did NOT graduate from the prestigious Central Saint Martins?","['Riccardo Tisci', 'Zac Posen', 'Olivier Rousteing']","2","" +" Which skin mark is most likely to come and go with the seasons?","['Rhytides', 'Ephelides', 'Lentigines']","1","" +" Which of these is traditionally a layer in a Nanaimo bar?","['Ice cream', 'Whipped cream', 'Butter icing']","2","" +" Which of these films does NOT share a name with a NASA space probe?","['Juno', 'Stardust', 'Prometheus']","2","HQ" +" Which of these authors has a supermodel granddaughter?","['Antoine de Saint-Exupéry', 'Maurice Sendak', 'Roald Dahl']","2","HQ" +" Which character appears in the Shakespeare play whose title comes first alphabetically?","['Octavius Caesar', 'Bertram', 'Adriana']","1","HQ" +" Which of these award shows is not specifically for film or TV?","['Golden Globes', 'Oscars', 'Grammys']","2","" +" Carols are typically sung around what holiday?","['4th of July', 'Christmas', ""President's Day""]","1","" +" In paintings, what is the point where water and land meet called?","['Horizon', 'Meeting place', 'Center']","0","" +" Which of these animals is capable of flying?","['Parrot', 'Rattlesnake', 'Brown bear']","0","" +" Which team originally drafted Kobe Bryant?","['Los Angeles Lakers', 'Philadelphia 76ers', 'Charlotte Hornets']","2","" +" By which name is Stefani Germanotta better known?","['Gwen Stefani', 'Lady Gaga', 'Mariah Carey']","1","" +" Who was given the nickname of greatest ancient mathematician?","['Carl Gauss', 'Archimedes', 'Plato']","1","" +" In which country are more languages spoken than any other?","['Philippines', 'Papua New Guinea', 'Spain']","1","" +" Which old adage states that ""Anything that can go wrong will go wrong""?","[""Lynch's Law"", ""Kelly's Law"", ""Murphy's Law""]","2","" +" What month was Jesus born in?","['December', 'April', 'Unknown']","2","" +" 8. What is Nicki Minaj's birth name?","['Belcalis Almanzar', 'Onika Tanya Maraj', 'Norma Jean']","1","QuizBiz" +" 8. What is Nicki Minaj's birth name?","['Belcalis Almanzar', 'Onika Tanya Maraj', 'Norma Jean']","1","QuizBiz" +" 1. Fans of which NFL team are known for wearing cheeseheads?","['Green Bay Packers', 'Pittsburgh Steelers', 'Buffalo Bills']","0","QuizBiz" +" 3. Which Gary Oldman character died in ""Harry Potter and the Order of the Phoenix""?","['Serverus Snape', 'Sirius Black', 'Remus Lupin']","1","QuizBiz" +" 4. In the Adult Swim cartoon, how is Rick related to Morty?","['Grandfather', 'Father', 'Uncle']","0","QuizBiz" +" 5. Who released an album with a cover that featured poetry written in Braille?","['Kanye West', 'Sia', 'Rihanna']","2","QuizBiz" +" 6. What year was the social dating app ""Tinder"" released?","['2012', '2015', '2014']","1","QuizBiz" +" 7. Which country was Kali Uchis born in?","['Panama', 'Cuba', 'Colombia']","2","QuizBiz" +" 8. What is the first name of the bachelorette in season 14 of The Bachelorette?","['Rachel', 'Krystal', 'Becca']","0","QuizBiz" +" 9. Who hosted the 2017 MTV Music Awards?","['Cardi B', 'Katy Perry', 'Charlamagne tha God']","1","QuizBiz" +" 11. How long did the first ceremony for the Academy Awards last in 1929?","['Five Hours', '15 Minutes', 'One Hour']","1","QuizBiz" +" 12. In what year were Cocoa Krispies first offered for sale in the United States?","['1952', '1954', '1958']","0","QuizBiz" +" What singer was interrupted by Kanye West at the 2009 VMAs?","['Taylor Swift', 'Beck', 'Beyonce']","0","Cash Show" +" Which of these is a type of art?","['Buddhism', 'Cubism', 'Phrenology']","0","Cash Show" +" What body of water south of Texas is home to hundreds of oil rigs?","['Mexicali', 'Gulf of Mexico', 'Rosarito']","1","Cash Show" +" Californication was the seventh album to be released by which rock band?","['Nirvana', 'Radiohead', 'Red Hot Chili Peppers']","2","Cash Show" +" Which Italian leader agreed to let the Vatican become an independent state?","['Benito Mussolini', 'Galeazzo Ciano', 'Giuseppe Garibaldi']","0","Cash Show" +" What order of Greek architecture employed the most ornate designs?","['lonic', 'Corinthian', 'Doric']","1","Cash Show" +" Which cult leader is often dubbed 'the wacko from Waco?","['Marshall Applewhite', 'Jim Jones', 'David Koresh']","2","Cash Show" +" According to his popular theme tune what type of animal is Postman Pat's black and white pet?","['Cat', 'Monkey', 'Dog']","0","Cash Show" +" In William Shakespeare's The Tempest, what is the name of the witch that bore Caliban?","['Sycorax', 'Miranda', 'Esmeralda']","1","Cash Show" +" Which of the following is NOT the name of a cryptocurrency?","['Ethereum', 'Ripple', 'Mintcoin']","2","Cash Show" +" Which of these areas would you NOT find at Disney World's Magic Kingdom in Florida?","['Frontierland', 'Neverland', 'Tomorrowland']","1","Cash Show" +" 12. According to legend, the Caesar salad was invented in what country?","['United States', 'Mexico', 'Italy']","1","QuizBiz" +" By which name is Katie Price better known?","['Jordan', 'Caprice', 'Pricey']","0","Cash Show" +" In which month is rememberence day?","['March', 'November', 'October']","1","Cash Show" +" What is traditionally eaten on Shrove Tuesday?","['Cheese', 'Bread', 'Pancakes']","2","Cash Show" +" What is the name of Mario's sibling in the Super Mario Brothers games?","['Princess Peach', 'Luigi', 'Bowser']","1","Cash Show" +" Which of these teams play in the NBA?","['Los Angeles Lakers', 'Los Angeles Dodgers', 'Los Angeles Rams']","0","Cash Show" +" What kind of animal is a Bongo?","['Parrot', 'Shark', 'Antelope']","2","Cash Show" +" Which is a Stephen King book?","['Rose Red', 'Rose Vines', 'Rose Madder']","2","Cash Show" +" Which of these films did not star The Beatles?","['Woodstock', 'Help!', 'Yellow Submarine']","0","Cash Show" +" How tall is Usain Bolt?","['1.90 Metres', '1.96 Metres', '1.65 Metres']","1","Cash Show" +" Who is not a former UN Secretary General?","['Trygve Lie', 'U Thant', 'Omar Bongo']","2","Cash Show" +" Jack Antonoff, the singer frorm Bleachers, has dated which celebrity?","['Lena Dunham', 'Taylor Swift', 'Harry Styles']","0","Cash Show" +" 3. On the dating app Tinder, users will ""like"" a potential match by doing what?","['Swiping Right', 'Swiping Left', 'Tapping ""Thumbs Up""']","0","Beat The Q" +" 4. What famous literary sleuth resides at 221B Baker Street?","['Nancy Drew', 'Sherlock Holmes', 'Jason Bourne']","1","Beat The Q" +" 5. Which show was not part of NBC's Thursday ""Comedy Night Done Right"" schedule?","['The Office', 'According to Jim', 'Parks and Recreation']","1","Beat The Q" +" 6. What artist coined the phrase 15 minutes of fame""?","['Jackson Pollock', 'Salvador Dali', 'Andy Warhol']","2","Beat The Q" +" 7. Which author's relative was a judge during the Salem Witch Trials?","['Herman Melville', 'Henry David Thoreau', 'Nathaniel Hawthorne']","2","Beat The Q" +" 8. Fifth Harmony's qualifying song at Cowell's home on X Factor was by what artist?","['Shontelle', 'Britney Spears', 'Ellie Goulding']","1","Beat The Q" +" 9. Which English actor did NOT perform a voice for a game in the Elder Scrolls series?","['Michael Caine', 'Patrick Stewart', 'John Cleese']","0","Beat The Q" +" 11. Which actor's father was a contract killer who assassinated a federal judge?","['Matthew McConaughey', 'Woody Harrelson', 'Bradley Cooper']","1","Beat The Q" +" 12. Moby's latest album takes its title from a quote in a book by what author?","['Kurt Vonnegut', 'Charles Bukowski', 'Daniel Keyes']","1","Beat The Q" +" Who wrote the famous 1987 horror novel ""Dracula""?","['Volume', 'James', '1D)', 'Eli Wa', 'Bram Stoker']","4","Cash Show" +" How many years separate each World Cup soccer tournament?","['3', '4', '2']","2","Cash Show" +" What kind of markers do you give to children if you want an easy cleanup?","['Permanent', 'Lead-Based', 'Water-Based']","0","Cash Show" +" What e-commerce company also gives you access to a subscription based TV service?","['UPS', 'Amazorn', 'FedEx']","1","Cash Show" +" Who was the ruler of Judea when Jesus Christ was sentenced to death?","['King James', 'Pontius Pilate', 'Judas']","1","Cash Show" +" Which artist sculpted Pietà?","['Cristoforo Solari', 'Michelangelo', 'Gian Lorenzo Bernini']","1","Cash Show" +" How old was Abraham Lincoln when he died?","['56', '50', '60']","0","Cash Show" +" Which of the following is an example of naturally occurring plasma on Earth?","['Photosynthesis', 'Lightning', 'Moulting']","1","Cash Show" +" What kind of animal is the title character of the long-running animated series Arthur'?","['Bear', 'Aardvark', 'Anteater']","1","Cash Show" +" Which artist was the film ""Big Eyes"" about?","['Clive Davis', 'Michelangelo', 'Margaret Keane']","2","Cash Show" +" The tagline of which 1997 movie was The squeak shall inherit the earth""?","['Stuart Little', 'Mousehunt', 'Alvin and the Chipmunks']","1","Cash Show" +" Hasbro's 'Uno' is what genre of card game?","['Matching game', 'Shedding game', 'Accumulating game']","1","Cash Show" +" Who did Selena Gomez start dating again after she broke up with The Weeknd?","['Drake', 'Zedd', 'Justin Bieber']","2","Cash Show" +" Which two numbers, when multiplied together, equal 132?","['13x19', '111x2', '11x12']","0","Cash Show" +" Which book did Dr. Seuss write to help kids learn to read?","['One Egg, Two Eggs', 'Oh, The Faces You Will See', 'The Cat in the Hat']","2","Cash Show" +" Typically, what shape is a cursor on a computer?","['Circle', 'Arrow', 'Star']","1","Cash Show" +" What year did Bill Belichick become the head coach of the New England Patriots?","['2000', '2005', '2010']","0","Cash Show" +" What was the name of Simon & Garfunkel's first number one single?","['Mrs. Robinson', 'The Sound of Silence', 'Cecilia']","1","Cash Show" +" Which of these artists is known for large paintings of a single color or gradients?","['Jackson Pollock', 'Ansel Adams', 'Mark Rothko']","2","Cash Show" +" Robert Altman's 'Short Cuts' movie is based on nine short stories by whom?","['Raymond Carver', 'Roald Dahl', 'Joseph Heller']","0","Cash Show" +" Which of these 2017 events was viewed on TV by the most people?","['89th Academy Awards', 'Eurovision Song Contest', 'The Super Bowl']","2","Cash Show" +" Which actor started a music career in his mid-50s, releasing his first album in 2015?","['Liev Schreiber', 'Keanu Reeves', 'David Duchovny']","2","Cash Show" +" In which movie does Audrey Hepburn Il Prize for this question: $450","['Funny Face', 'Paris When It Sizzles', 'Sabrina']","0","Cash Show" +" With which of these 1960s pop bands was Charles Manson most closely associated with?","['The Beatles', 'The Beach Boys', 'Led Zeppelin']","1","Cash Show" +" 1. What is the largest animal on Earth?","['Elephant', 'Hippo', 'Blue Whale']","2","Quizbiz" +" 2. Robin Williams named his daughter after a character from what video game?","['Sonic the Hedgehog', 'Super Mario', 'The Legend of Zelda']","2","Quizbiz" +" 3. Which actress played Wonder Woman in the 2017 superhero movie?","['Camila Mendes', 'Nina Dobrev', 'Gal Gadot']","2","Quizbiz" +" 4. What is the last name of the first American to set foot on the moon?","['Aldrin', 'Armstrong', 'Collins']","1","Quizbiz" +" 5. What year did Nintendo release its first game console in the US?","['1995', '1985', '2005']","1","Quizbiz" +" 6. Which country is Donald Trump's first wife from?","['Slovenia', 'USA', 'Czechoslovakia']","2","Quizbiz" +" 7. ""The Beltway"" refers to what American city?","['Boston', 'Washington D.C.', 'Chicago']","1","Quizbiz" +" 8. About 2% of all people have what eye color?","['Brown', 'Blue', 'Green']","2","Quizbiz" +" 9. Who was NOT in the car with JFK during his assassination?","['Jackie Kennedy', 'John Connally', 'Lyndon Johnson']","2","Quizbiz" +" 10. The first woman Oscar nominee for cinematography worked on what film?","['Mudbound', 'The Shape of Water', 'Bladerunner 2049']","0","Quizbiz" +" 11. Which Disney character is most likely capable of stridulation?","['Pumbaa', 'Jiminy Cricket', 'Dumbo']","1","Quizbiz" +" 12. What NBA team has never had a winner of the All-Star 3-Point Contest?","['Timberwolves', 'Bulls', 'Lakers']","2","Quizbiz" +" According to the phrase, which of these a day keeps the doctor away?","['Advil', 'Apple', 'Aardvark']","1","Joyride" +" Who is the author of ""Fifty Shades of Grey""?","['E. L. James', 'R. L. Stine', 'P. F. Chang']","0","Joyride" +" What is the capital of Peru?","['Pinto', 'Lima', 'Kidney']","1","Joyride" +" Which of these dishes originated in South Africa?","['Tajine', 'Bunny', 'Vada']","1","Joyride" +" Which Kiwi director has helmed films about vampires and superheroes?","['Peter Jackson', 'Jane Campion', 'Taika Waititi']","2","Joyride" +" In which sport do players ""twiddle""?","['Ping Pong', 'Curling', 'Wiffle Ball']","0","Joyride" +" Which of these TV shows is NOT part of the same shared ""universe""?","['Maude', 'Rhoda', 'Phyllis']","0","Joyride" +" 1.In the world of current Indian politics, who was born as Ajay Mohan Bisht?","['Amit Shah', 'Yogi Adityanath', 'Arvind Kejriwal']","1","QuizBiz" +" 2.Whose wife was businesswoman Sunanda Pushkar, who allegedly committed suicide in 2014?","['Rahul Gandhi', 'Arun Jaitley', 'Shashi Tharoor']","2","QuizBiz" +" 3.Whose debut film as a director is the 2017 movie 'A Death in the Gunj?""","['Konkona Sen Sharma', 'Richa Chadda', 'Huma Qureshi']","0","QuizBiz" +" 4.Which actor is best known for his work as the character Mr. Bean on screen?","['Gary Oldman', 'Rowan Atkinson', 'Ed Harris']","1","QuizBiz" +" 5.Which actor plays the role of Khal Drogo in the TV series 'Game of Thrones'?","['Jason Momoa', 'Kit Harington', 'Sean Bean']","0","QuizBiz" +" 6.Which Bollywood actor was the host of the 1st season of the TV reality show 'Big Boss?""","['Arshad Warsi', 'Sanjay Dutt', 'Salman Khan']","0","QuizBiz" +" 7.Which football club won the Indian I League 2017-18?","['Minerva Punjab', 'East Bengal', 'NEROCA F.С.']","1","QuizBiz" +" 8.Which scientist has written the book 'A Brief History of Time?","['Niels Bohr', 'James Clerk Maxwell', 'Stephen Hawking']","2","QuizBiz" +" 9.Which is the oldest national park in India, established in 1936?","['Jim Corbett National Park', 'Kaziranga National Park', 'Keoladeo National Park']","0","QuizBiz" +" 10.Which Indian city became India's first World Heritage City, declared by UNESCO?","['Ahmedabad', 'Kolkata', 'Ranchi']","0","QuizBiz" +" 11.Which Indian hospitality brand was founded by Ritesh Agarwal?","['OYO Rooms', 'Make My Trip', 'Trivago']","0","QuizBiz" +" 12.Which birds are generally associated with the spring season?","['Cuckoo', 'Owl', 'Peacock']","1","QuizBiz" +" In the movie 'Coco', Miguel dreams of becomina what?","['A Musician', 'A Painter', 'A Pirate']","0","Hangtime" +" What does the abbreviation 'CRT' stand for?","['Color Receiving Transducer', 'Chromatic Receiving Tube', 'Cathode Ray Tube']","2","Hangtime" +" What part of the brain is responsible for vision?","['Frontal', 'Occipital', 'Temporal']","1","Hangtime" +" What is the upper surface of the plant leaf called?","['Thermostat', 'Leafy Cambium', 'Upper Epidermis']","2","Hangtime" +" What is a xenophobe fearful of?","['Strangers', 'Night', 'Womern']","0","Hangtime" +" What famous lawman was credited with bringing John Dillinger to justice?","['Eliott Ness', 'J. Edgar Hoover', 'Melvin Purvis']","2","Hangtime" +" When is The Haight-Ashbury Street Fair held each year?","['Summer Solstice', 'Second Sunday Of June', 'Every Valentines Day']","1","Hangtime" +" Kaa-lya of the Gran Chaco National Park is located in what South American country?","['Bolivia', 'Paraguay', 'French Guiana']","0","Hangtime" +" In June 2013, Lucky Charms added 2 limited edition marshmalloWS celebrating what?","['Their 50th anniversary', 'LGBT Pride Month', 'Monsters University']","1","Hangtime" +" On the Isle of Man, they say 'longtail instead of naming this animal to avoid bad luck:","['Stoats', 'Polecats', 'Rats']","2","Hangtime" +" A ranch where city slickers get to play cowboy is also called a what?","['Spa Ranch', 'Dude Ranch', 'Hidden Valley Ranch']","1","Joyride" +" On ""Adventure Time,"" Finn's sidekick Jake is a what?","['Troll', 'Dog', 'Snake']","1","Joyride" +" Which of these birds can mimic human speech?","['Pigeons', 'Cockatoos', 'Doves']","1","Joyride" +" Which of these actors has NOT played the President of the US?","['Daniel Day-Lewis', 'Robin Wright', 'John Wayne']","2","Joyride" +" The Hoover Dam outside Las Vegas dams up which river?","['Red River', 'Nevada River', 'Colorado River']","2","Joyride" +" ""Fallingwater"" is a house designed by which famous architect?","['Frank Gehry', 'John Frank House', 'Frank Lloyd Wright']","2","Joyride" +" Which of these products was released in the year 2000?","['Sony Playstation 2', 'Nintendo Gamecube', 'Apple iPod']","0","Joyride" +" The Statue of Liberty was a gift from what country?","['France', 'England', 'Sweden']","0","Cash Show" +" What is the bottom part of a fraction called?","['Numerator', 'Denominator', 'Polynomial']","1","Cash Show" +" Which of these sports does not have a goalie?","['Hockey', 'Soccer', 'Baseball']","2","Cash Show" +" What is the nickname for a spoon- shaped fork?","['Foone', 'Spoonk', 'Spork']","2","Cash Show" +" Which is an example of a terrestrial planet?","['Venus', 'Neptune', 'Saturn']","0","Cash Show" +" What is the meaning of the Japanese word ""kimono"", the name given to a traditional garment?","['""Nice dress""', '""Thing to wear""', '""Body robe""']","1","Cash Show" +" In which 1960s musical would you hear the song 'Consider Yourself?","['Grease', 'The Music Man', 'Oliver!']","2","Cash Show" +" Which of these is NOT a part of a toilet?","['Cistern', 'Flapper', 'Crisper']","2","Cash Show" +" Which body of water separates the islands of Ireland and Great Britain?","['Irish Sea', 'British Lake', 'Atlantic Ocean']","0","Cash Show" +" Who unknowingly loaned Nikola Tesla the money for his wireless electrical grid?","['Robert Oppenheimer', 'John D. Rockefeller', 'JP Morgan']","2","Cash Show" +" Where would you find the Sea of Tranquility'?","['Turkey', 'Japan', 'The Moon']","2","Cash Show" +" In a 1994 episode of 'The Simpsons' Bart briefly becomes famous with which catchphrase?","['""It wasn\'t me.""', '""I didn\'t do it.""', '""Don\'t blame me.""']","1","Cash Show" +" What colour is Gin?","['Green', 'Blue', 'Colourless']","2","Cash Show" +" Start spreading the news, l'm leaving today"" are the opening lines of which song?","['New York New York', 'My Way', 'Moon River']","0","Cash Show" +" Yankee is a word to describe people from which country?","['Canada', 'China', 'America']","2","Cash Show" +" What was Jesus's mother called?","['Maggie', 'Mary', 'Margaret']","1","Cash Show" +" Which video game franchise features the characters Bowser and Princess Peach?","['Sonic the Hedgehog', 'Spyro the Dragon', 'Super Mario Brothers']","2","Cash Show" +" Who was the youngest Beatle?","['Paul McCartney', 'Ringo Starr', 'George Harrison']","2","Cash Show" +" In Scotland the white rose signifies the birth of which monarch?","['James Francis Stuart', 'Mary Queen of Scots', 'Bonnie Prince Charlie']","0","Cash Show" +" Which is the only continent without bees?","['Antarctica', 'Oceania', 'Africa']","0","Cash Show" +" In British history, which royal house preceded the Tudors?","['The Plantagenets', 'The Stuarts', 'The Jacobites']","0","Cash Show" +" 1. Which of these is the actual subtitle to the new Mission Impossible movie?","['Tom Cruise Runs More', 'Tom Cruise is 55', 'Fallout']","2","Beat The Q" +" 2. According to the Beatles, in the end, the love you take is equal to what?","['The Love You Make', 'How Handsome You Are', 'Half the Diameter']","0","Beat The Q" +" 3. Which of these Hollywood socialites is the heiress of a famous hotel fortune?","['Nicole Richie', 'Paris Hilton', 'Lindsay Lohan']","1","Beat The Q" +" 4. In The Matrix, Morpheus offers Neo a choice between a blue pill and what else?","['A Smartphone', 'A Red Pill', 'Cool Sunglasses']","1","Beat The Q" +" 5. Which of these stars has won a ""Best Original Screenplay"" Oscar?","['Ben Affleck', 'George Clooney', 'James Franco']","0","Beat The Q" +" 6. Referring to a superfan as a ""Stan"" originates from a song by what performer?","['Lady Gaga', 'Jay-Z', 'Eminem']","2","Beat The Q" +" 7. What artist went through a blue period between 1901-1904?","['Henri Matisse', 'Pablo Picasso', 'Georges Braque']","1","Beat The Q" +" 8. On her second studio album, Britney Spears covers a song by what artist?","['Sonny & Cher', 'Joan Jett', 'The Rolling Stones']","2","Beat The Q" +" 9. Which of these singers was murdered by their father?","['Sam Cooke', 'Jeff Buckley', 'Marvin Gaye']","2","Beat The Q" +" 10. Drew Scott, one of the Property Brothers, used to be a body double on what show?","['Angel', ""Dawson's Creek"", 'Smallville']","2","Beat The Q" +" 11. Who was Space Ghost's band leader on the cartoon Space Ghost: Coast to Coast?","['Brak', 'Zorak', 'Moltar']","1","Beat The Q" +" 12. Who was the first player prominently featured on a Madden NFL game cover?","['Eddie George', 'Michael Vick', 'Marshall Faulk']","0","Beat The Q" +" What travels at approximately 300,000 kilometers per second?","['Ferrari 458', 'Gossip', 'Light']","2","Joyride" +" In which US state is it illegal to pump your own gas?","['Hawaii', 'Texas', 'New Jersey']","2","Joyride" +" Dove Pan, Inexhaustible Bottle, and Zig-Zag Girl are names of what?","['Superheroes', 'Magic Tricks', 'Rock Formations']","1","Joyride" +" Which of the following words is a synonym for ""naissance""?","['Annoying', 'Rainy', 'Birth']","2","Joyride" +" The 2020 Summer Olympics will be the first to feature what event?","['Mixed Martial Arts', 'Softball', 'Skateboarding']","2","Joyride" +" Where did Martin Luther King, Jr., earn his doctorate?","['Boston University', 'Columbia University', 'Morehouse College']","0","Joyride" +" Mazagran, a sweet drink from Algeria, is an early version of what?","['Boba Tea', 'Iced Coffee', 'Rosé Wine']","1","Joyride" +" Spanish composer Franciso Tárrega composed which ""annoying"" sound?","['Car Alarm', 'Elevator Music', 'Nokia Ringtone']","2","Joyride" +" What challenge was inspired by Kylie Jenner's cosmetic surgery?","['Hair Challenge', 'Lip Challenge', 'Waist Challenge']","1","Cash Show" +" When a political party officially chooses a person to run for office, that person is called what?","['First choice', 'Nominee', 'Main person']","1","Cash Show" +" What sitcom was Roseanne Barr the star of?","['Laugh In', 'All In The Family', 'Roseanne']","2","Cash Show" +" What is the name for a quick series of drum beats, often played before announcing something?","['Mashing', 'Drum rol', 'Peak sound']","1","Cash Show" +" What is a person who smiles sardonically expressing?","['Bitterness', 'Compassion', 'Sleepiness']","0","Cash Show" +" What name is given to the distinctive smell which can be observed after rainfall on dry ground?","['Petrichor', 'Incandescence', 'Eau de Rainbow']","0","Cash Show" +" Which of these numbers does not have a whole number square root?","['9', '17', '100']","1","Cash Show" +" What item of furniture is also the collective term for a group of eels?","['Futon', 'Bed', 'Desk']","1","Cash Show" +" Which popular sitcom was developed under the working title of 'Insomnia Cafe'?","['Seinfeld', 'Friends', 'The Cafe']","1","Cash Show" +" Which non-Democratic or Non- Republican party was the last to win the US Presidential election?","['Libertarian', 'Whig', 'Independent']","1","Cash Show" +" The Cure's 1979 single 'Killing an Arab' was inspired by which book?","['Ulysses', 'The Stranger', '1984']","1","Cash Show" +" When a bad situation becomes worse, one might be 'out of the frying pan into the' what?","['Boiling pot', 'Fire', 'Skillet']","1","Cash Show" +" What is the name of Bruce Banner's alter ego?","['The Hulk', 'Captain America', 'Spider-Man']","0","Joyride" +" Which of these movies does NOT star a Marvel Avenger?","['Iron Man', 'Green Lantern', 'The Incredible Hulk']","1","Joyride" +" In comics, which of thes