def check_nonactivated(user):
    nonactivated_page_content = WebUtils.get_page_content(
        SGToolsConsts.SGTOOLS_CHECK_NONACTIVATED_LINK + user)
    return nonactivated_page_content.find(
        ' has activated all his/her games!'
    ) == -1 and nonactivated_page_content.find(
        'Games wins not activated') != -1
def get_steam_id(steam_user_link):
    steam_alt_user_id = steam_user_link.split(
        SteamConsts.STEAM_USER_ID_LINK)[1]
    page_content = WebUtils.get_page_content(
        SteamFinderConsts.STEAMFINDER_LOOKUP_LINK + steam_alt_user_id)
    partial_page = page_content[:page_content.find('" target="_blanl"')]
    steam_id = partial_page[partial_page.find('<br>profile <code><a href="') +
                            27:].split(SteamConsts.STEAM_USER_ID_LINK)[1]
    return steam_id
Exemple #3
0
def verify_after_n_giveaways(steam_after_n_thread_link, giveaways, group_users, max_pages=0):
    after_n_giveaways = dict()
    steam_id_to_user = get_steam_id_to_user_dict(group_users.values())
    page_index = 1
    while page_index < max_pages or max_pages == 0:
        page_content = WebUtils.get_page_content(steam_after_n_thread_link + SteamConsts.STEAM_SEARCH_QUERY + str(page_index))
        partial_page = page_content[page_content.find('_pageend') + 10:]
        page_end = partial_page[:partial_page.find('</span>')]
        partial_page = page_content[page_content.find('_pagetotal') + 12:]
        page_total = partial_page[:partial_page.find('</span>')]

        html_content = html.fromstring(page_content)
        gifter_elemens = WebUtils.get_items_by_xpath(html_content, u'.//div[@class="commentthread_comment responsive_body_text  "]')
        for gifter_elem in gifter_elemens:
            steam_user = WebUtils.get_item_by_xpath(gifter_elem, u'.//a[@class="hoverunderline commentthread_author_link "]/@href')
            if not steam_user:
                continue  # this means this is the creator of the thread

            if SteamConsts.STEAM_PROFILE_LINK in steam_user:
                steam_id = steam_user.split(SteamConsts.STEAM_PROFILE_LINK)[1]
            else:
                steam_id = SteamFinderScrapingUtils.get_steam_id(steam_user)
            # Check if steam_id is currently in SG group
            if steam_id in steam_id_to_user:
                user = steam_id_to_user[steam_id]
                giveaway_links = WebUtils.get_items_by_xpath(gifter_elem, u'.//div[@class="commentthread_comment_text"]/a/@href')
                for giveaway_link in giveaway_links:
                    giveaway_link = str(giveaway_link).replace(SteamConsts.STEAM_FILTER_LINK, '')
                    if (giveaway_link in giveaways.keys() and giveaways[giveaway_link].creator == user and giveaway_link
                        and giveaway_link.startswith(SteamGiftsConsts.STEAMGIFTS_GIVEAWAY_LINK)):
                        if user not in after_n_giveaways:
                            after_n_giveaways[user] = set()
                        after_n_giveaways[user].add(giveaway_link)

        if page_end == page_total:
            break
        page_index += 1

    return after_n_giveaways
Exemple #4
0
def test(cookies):
    WebUtils.get_page_content(
        'https://www.steamgifts.com/giveaway/Rjkdw/sins-of-a-solar-empire-trinity',
        cookies)
def check_multiple_wins(user):
    return WebUtils.get_page_content(
        SGToolsConsts.SGTOOLS_CHECK_MULTIPLE_WINS_LINK +
        user).find(' has no multiple wins for the same game!') == -1