我在Github上找到了这个机器人,但它似乎过时了,代码会在以下几行中断:
# Get Checkbox ID
ind = page.find ("\"field-options-")
checkboxID = page [ind:]
checkboxID = checkboxID [checkboxID.find ("value=\"") + len ("value=\""):]
checkboxID = checkboxID [:checkboxID.find ("\"")]
checkboxID = str (int (checkboxID) + opt - 1)带此错误消息:ValueError:带基10的int()无效文本:''
下面是投票页面代码:
<div class="block">
<div class="field is-poll-answer">
<label class="b-radio radio">
<input type="radio" name="poll_answer" value="rzgrdf2fh2sb">
<span class="check"></span>
<span class="control-label">A</span>
</label>
</div>
<div class="field is-poll-answer">
<label class="b-radio radio">
<input type="radio" name="poll_answer" value="gd1br74f8xhx">
<span class="check"></span>
<span class="control-label">B</span>
</label>
</div>
</div>发布于 2020-12-20 19:57:54
我去派对有点晚了,但你可能想看看https://github.com/sendQueue/Strawpoll-Bot。
查找复选框值的有效解决方案是:
def find_checkbox(content, op):
option = content[content.find("options"):]
option = option[option.find("value=\"") + len("value=\""):]
option = option[:option.find("\"")]
return int(option) + op - 1内容是html源,并从1..n中计数复选框
https://stackoverflow.com/questions/61976670
复制相似问题