diff --git a/mastotuit.py b/mastotuit.py index 094a710..955cfa7 100644 --- a/mastotuit.py +++ b/mastotuit.py @@ -37,30 +37,44 @@ def get_toot_text(title): def get_poll(tuit_text): - poll_substring = '[ ]' - poll_options = tuit_text.count(poll_substring) - - is_poll = False if poll_options == 0 else True + poll_options = 0 options_lst = [] - remain_str = tuit_text.replace('\n', '') - - i = poll_options - while (i > 0): - - last_option_index = remain_str.rfind('[ ]') - option_str = remain_str[last_option_index+3:].strip() - options_lst.append(option_str) - remain_str = remain_str[:last_option_index] - i-=1 + is_poll = False if "input disable" not in entry.summary else True if is_poll: + poll_substring = """""" + + poll_options = title.count(poll_substring) + + remaining_str = title + + i = poll_options + while (i > 0): + + last_option_index = remaining_str.rfind(poll_substring) + + if i == poll_options: + + option_str = remaining_str[last_option_index+42:].strip().replace('
','') + + else: + + option_str = remaining_str[last_option_index+42:].strip().replace('