4815162342lost / steam_gifts_bot

bot for http://www.steamgifts.com/
GNU General Public License v3.0
32 stars 6 forks source link

Script hangs if there is no lost giveaways #4

Closed grray closed 7 years ago

grray commented 7 years ago

It hangs when there is no items without "remove" button in this list https://www.steamgifts.com/giveaways/entered, or list is empty.

4815162342lost commented 7 years ago

Dear grray,

Could you, please, change

def get_entered_links(requests_result):
    """Entered giveaway list. ignore it"""
    global nedd_next_page_for_entered_link
    entered_list=[]
    soup=BeautifulSoup(requests_result.text, "html.parser")
    links=soup.find_all(class_="table__row-inner-wrap")
    for get_link in links:
        url=get_link.find(class_="table__column__heading").get("href")
        check_geaways_end=get_link.find(class_="table__remove-default is-clickable")
        if check_geaways_end!=None:
            entered_list.append(url)
        elif get_link.find(class_="table__column__deleted")!=None:
            continue
        else:
            nedd_next_page_for_entered_link=False
            return entered_list
return entered_list

to

def get_entered_links(requests_result):
    """Entered giveaway list. ignore it"""
    global nedd_next_page_for_entered_link
    entered_list=[]
    soup=BeautifulSoup(requests_result.text, "html.parser")
    links=soup.find_all(class_="table__row-inner-wrap")
    if links==None:
        nedd_next_page_for_entered_link=False
        return entered_list
    for get_link in links:
        url=get_link.find(class_="table__column__heading").get("href")
        check_geaways_end=get_link.find(class_="table__remove-default is-clickable")
        if check_geaways_end!=None:
            entered_list.append(url)
        elif get_link.find(class_="table__column__deleted")!=None:
            continue
        else:
            nedd_next_page_for_entered_link=False
            return entered_list
return entered_list

and test script? i can not test script now, but i hope, it is fix the issue.

Thanks a lot.

grray commented 7 years ago

It is working, but my "entered" list is not empty already.

4815162342lost commented 7 years ago

Bug has been fixed.