コード例 #1
0
ファイル: filter.py プロジェクト: soulpawa/Insomniac
    def _get_followers_and_followings(device):
        followers = 0
        followers_text_view = device(resourceId='com.instagram.android:id/row_profile_header_textview_followers_count',
                                     className='android.widget.TextView')
        if followers_text_view.exists(timeout=UI_TIMEOUT):
            followers_text = followers_text_view.info['text']
            if followers_text:
                followers = parse(device, followers_text)
            else:
                print_timeless(COLOR_FAIL + "Cannot get followers count text, default is " + str(followers) +
                               COLOR_ENDC)
        else:
            print_timeless(COLOR_FAIL + "Cannot find followers count view, default is " + str(followers) + COLOR_ENDC)

        followings = 0
        followings_text_view = device(resourceId='com.instagram.android:id/row_profile_header_textview_following_count',
                                      className='android.widget.TextView')
        if followings_text_view.exists(timeout=UI_TIMEOUT):
            followings_text = followings_text_view.info['text']
            if followings_text:
                followings = parse(device, followings_text)
            else:
                print_timeless(COLOR_FAIL + "Cannot get followings count text, default is " + str(followings) +
                               COLOR_ENDC)
        else:
            print_timeless(COLOR_FAIL + "Cannot find followings count view, default is " + str(followings) + COLOR_ENDC)

        return followers, followings
コード例 #2
0
def _get_following_count(device):
    following = None
    following_text_view = device(resourceId='com.instagram.android:id/row_profile_header_textview_following_count',
                                 className='android.widget.TextView')
    if following_text_view.exists:
        following_text = following_text_view.text
        if following_text:
            following = parse(device, following_text)
        else:
            print(COLOR_FAIL + "Cannot get your following count text" + COLOR_ENDC)
    else:
        print(COLOR_FAIL + "Cannot find your following count view" + COLOR_ENDC)

    return following
コード例 #3
0
def _get_followers_count(device):
    followers = None
    followers_text_view = device(
        resourceId=
        'com.instagram.android:id/row_profile_header_textview_followers_count',
        className='android.widget.TextView')
    if followers_text_view.exists(timeout=UI_TIMEOUT):
        followers_text = followers_text_view.info['text']
        if followers_text:
            followers = parse(device, followers_text)
        else:
            print(COLOR_FAIL + "Cannot get your followers count text" +
                  COLOR_ENDC)
    else:
        print(COLOR_FAIL + "Cannot find your followers count view" +
              COLOR_ENDC)

    return followers