RoboBrowser getting type error NoneType object is not subscriptable

2024/10/10 8:26:18

I'm trying to make a kahoot spammer which inputs a pin number and a username, decided by the user. I'm getting a type error when I run this code:

import re
from robobrowser import RoboBrowser#Getting pin number for kahoot
pin = int(input("What is the pin number of the Kahoot?"))
# Getting number of bots to be deployed
number_of_bots = int(input("How many bots would you like?"))
#Getting base name
name = str(input("What would you like your bots' name to be (number will be added to the end of the name)?"))
#counter
counter = 0
#Number on end of name
num = 1def joinKahoot(pin, number_of_bots, name):browser = RoboBrowser(history = True)#Connect to kahoot's websitebrowser.open("https://kahoot.it/")pin_form = browser.get_form()pin_form['inputSession'].value == pinbrowser.submit_form(pin_form)name_form = browser.get_form()name_form["username"].value == namebrowser.submit_form(name_form)#While counter is less than number_of_bots flood kahoot
while counter < number_of_bots:joinKahoot(pin, number_of_bots, name)counter += 1num += 1name = name + str(num)

Error:

Traceback (most recent call last):File "C:\Users\Vincent\Documents\Kahoot Spammer V2\flood.py", line 29, in <module>joinKahoot(pin, number_of_bots, name)File "C:\Users\Vincent\Documents\Kahoot Spammer V2\flood.py", line 20, in joinKahootpin_form['inputSession'].value == pin
TypeError: 'NoneType' object is not subscriptable

What I am doing wrong?

Answer

The page you are opening, https://kahoot.it/#/, does not contain an HTML <form> tag. The form you see is created using Javascript, undoubtedly to defeat DoS attacks using elementary HTML parsing techniques.

That is why browser.get_form() returns nothing. The function tries to return an instance of of robobrowser.forms.form.Form, which is a representation of an HTML form, but it can't find one.

I suspect you won't be able to get robobrowser to do what you want on this particular website. Good thing too.

https://en.xdnf.cn/q/118476.html

Related Q&A

How to create a 2d list with all same values but can alter multiple elements within? (python)

Im trying to create a list that holds this exact format: [[2],[2],[2],[2],[2],[2],[2],[2],[2],[2]]and when list[3][0] = 9 is called, the list becomes [[2],[9],[2],[9],[2],[9],[2],[9],[2],[9]]How do I c…

Understanding Function Closures [duplicate]

This question already has answers here:Why arent python nested functions called closures?(10 answers)Closed 9 years ago.Im struggling to understand Function closures properly. For example in the code …

Update value for every row based on either of two previous columns

I am researching ATP Tour male tennis data. Currently, I have a Pandas dataframe that contains ~60,000 matches. Every row contains information / statistics about the match, split between the winner and…

Count consecutive equal values in array [duplicate]

This question already has answers here:Count consecutive occurences of values varying in length in a numpy array(5 answers)Closed 5 years ago.Say I have the following numpy array:a = np.array([1,5,5,2,…

how can I show please wait gif image before the process is complete

I want to show "please wait gif" image from img() class before the ListApp() class process is complete and then as soon as the process of that class is completed the screeen of ListApp should…

TypeError: list of indices must be integers, not str

What is wrong in my code to give me the error:TypeError: List of indices must be integers, not strHere is my code:print("This programe will keep track of your TV schedule.") Finish = False Sh…

Assignment in conditional not permitted in Python?

Why is code like if a = "hello":passinvalid in Python? The a = "Hello" is just a expression whose value is the Rvalue. Its valid in most languages like C or php. Some opinions?

Django - Join two Table without Foreign key

I have two tables and want to join them.. but I cant do that without rawQueryset and raw SQL. how can i join two models without foreign key? The columns for JOIN is not unique so it cant be PK and For…

Understanding lambda functions

Well I did try to read about Lambda functions but did not get across any link which explains few questions about its flow and the way it is handled by python interpretor or may be I could not understan…

JSON to Python dataframe: mapping values from another API

I have an API with student data like this, for every student id there will be a corresponding API link with mark details. for example: https://api.school.com/2020/students.json {"Students": […