示例#1
0
def main():
    """
    main
    :return:
    """
    print('程序版本号:{}'.format(VERSION))
    print('激活窗口并按 CONTROL + C 组合键退出')
    debug.dump_device_info()
    screenshot.check_screenshot()

    i, next_rest, next_rest_time = (0, random.randrange(3, 10),
                                    random.randrange(5, 10))
    while True:
        next_page()

        time.sleep(1)
        screenshot.pull_screenshot()

        resize_image('autojump.png', 'optimized.png', 1024 * 1024)

        with open('optimized.png', 'rb') as bin_data:
            image_data = bin_data.read()

        ai_obj = apiutil.AiPlat(AppID, AppKey)
        rsp = ai_obj.face_detectface(image_data, 0)

        if rsp['ret'] == 0:
            beauty = 0
            for face in rsp['data']['face_list']:
                print(face)
                face_area = (face['x'], face['y'], face['x'] + face['width'],
                             face['y'] + face['height'])
                print(face_area)
                img = Image.open("optimized.png")
                cropped_img = img.crop(face_area).convert('RGB')
                cropped_img.save(FACE_PATH + face['face_id'] + '.png')
                # 性别判断
                if face['beauty'] > beauty and face['gender'] < 50:
                    beauty = face['beauty']

            # 是个美人儿~关注点赞走一波
            if beauty > BEAUTY_THRESHOLD:
                print('发现漂亮妹子!!!')
                thumbs_up()
                follow_user()

            i += 1
            if i == next_rest:
                print('')
            for j in range(next_rest_time):
                sys.stdout.write('\r程序将在 {}秒 后继续'.format(next_rest_time - j))
                sys.stdout.flush()
                time.sleep(1)
            print('\n继续')
            i, next_rest, next_rest_time = (0, random.randrange(30, 100),
                                            random.randrange(10, 60))

        else:
            print(rsp)
            continue
示例#2
0
def init(device_name):
    time.sleep(1)
    screenshot.pull_screenshot(device_name)
    resize_image('autojump.png', 'optimized.png', 1024 * 1024)
    with open('optimized.png', 'rb') as bin_data:
        image_data = bin_data.read()

    ai_obj = apiutil.AiPlat(AppID, AppKey)
    rsp = ai_obj.face_detectface(image_data, 0)
    major_total = 0
    minor_total = 0
    if rsp['ret'] == 0:
        beauty = 0
        for face in rsp['data']['face_list']:
            print(face)
            face_area = (face['x'], face['y'], face['x'] + face['width'], face['y'] + face['height'])
            print(face_area)
            img = Image.open("optimized.png")
            cropped_img = img.crop(face_area).convert('RGB')
            cropped_img.save(FACE_PATH + face['face_id'] + '.png')
            # 性别判断
            if face['beauty'] > beauty and face['gender'] < 50:
                beauty = face['beauty']

            if face['age'] > GIRL_MIN_AGE:
                major_total += 1
            else:
                minor_total += 1

        # 是个美人儿~关注点赞走一波
        if beauty > BEAUTY_THRESHOLD and major_total > minor_total:
            print('发现漂亮妹子!!!')
            thumbs_up(device_name)
            follow_user(device_name)
示例#3
0
def main():
    """
    main
    :return:
    """
    global img
    global imgOrg
    print('程序版本号:{}'.format(VERSION))
    print('激活窗口并按 CONTROL + C 组合键退出')
    debug.dump_device_info()
    screenshot.check_screenshot()

    while True:
        next_page()

        time.sleep(1)
        im = screenshot.pull_screenshot()
        cropped = im.crop((0, 0, 916, 1920))  # (left, upper, right, lower)
        cropped.load()
        cropped.save("./cropped.png")
        cropped.close()
        im.close()

        # resize_image('cropped.png', 'optimized.png', 1024*1024)

        with open('cropped.png', 'rb') as bin_data:
            image_data = bin_data.read()

        ai_obj = apiutil.AiPlat(SecretId, SecretKey)
        rsp = ai_obj.face_detectface(image_data)

        major_total = 0
        minor_total = 0
示例#4
0
def main():
    """
    main
    :return:
    """
    print('程序版本号:{}'.format(VERSION))
    print('激活窗口并按 CONTROL + C 组合键退出')
    debug.dump_device_info()
    screenshot.check_screenshot()

    while True:
        next_page()

        time.sleep(1)
        screenshot.pull_screenshot()

        resize_image('autojump.png', 'optimized.png', 1024 * 1024)

        with open('optimized.png', 'rb') as bin_data:
            image_data = bin_data.read()

        ai_obj = apiutil.AiPlat(AppID, AppKey)
        rsp = ai_obj.face_detectface(image_data, 0)

        major_total = 0
        minor_total = 0

        if rsp['ret'] == 0:
            beauty = 0
            for face in rsp['data']['face_list']:
                print(face)
                face_area = (face['x'], face['y'], face['x'] + face['width'],
                             face['y'] + face['height'])
                if face['width'] * face['height'] < 5000:
                    continue
                print(face_area)
                img = Image.open("optimized.png")
                cropped_img = img.crop(face_area).convert('RGB')
                cropped_img.save(FACE_PATH + face['face_id'] + '.png')
                # 性别判断
                if face['beauty'] > beauty and face['gender'] < 50:
                    beauty = face['beauty']

                if face['age'] > GIRL_MIN_AGE:
                    major_total += 1
                else:
                    minor_total += 1

            # 是个美人儿~关注点赞走一波
            if beauty > BEAUTY_THRESHOLD and major_total > minor_total:
                print('发现漂亮妹子!!!')
                #thumbs_up()
                #follow_user()
                getUserProfile()
                back()

        else:
            print(rsp)
            continue
示例#5
0
def TencentRun():
    global ts
    while True:
        next_page()

        time.sleep(1)
        screenshot.pull_screenshot()

        resize_image('autojump.png', 'optimized.png', 1024 * 1024)

        with open('optimized.png', 'rb') as bin_data:
            image_data = bin_data.read()

        #存储图片
        # 申请地址 http://ai.qq.com
        AppID = '2108770140'
        AppKey = 'JWZYO7SuPcsURp04'
        ai_obj = apiutil.AiPlat(AppID, AppKey)
        rsp = ai_obj.face_detectface(image_data, 0)

        major_total = 0
        minor_total = 0

        if rsp['ret'] == 0:
            beauty = 0
            for face in rsp['data']['face_list']:
                print(face)
                face_area = (face['x'], face['y'], face['x'] + face['width'],
                             face['y'] + face['height'])
                print(face_area)
                img = Image.open("optimized.png")
                cropped_img = img.crop(face_area).convert('RGB')
                cropped_img.save(FACE_PATH + face['face_id'] + '.png')
                # 性别判断
                if face['beauty'] > beauty and face['gender'] < 50:
                    beauty = face['beauty']

                if face['age'] > GIRL_MIN_AGE:
                    major_total += 1
                else:
                    minor_total += 1

            # 是个美人儿~关注点赞走一波
            if beauty > BEAUTY_THRESHOLD and major_total > minor_total:
                print('发现漂亮妹子!!!')
                thumbs_up()
                follow_user()
                #存储截图
                debug.save_debug_screenshot_font(ts, face['age'],
                                                 face['beauty'])
                ts += 1

        else:
            print(rsp)
            continue
示例#6
0
def main():
    """
    main
    :return:
    """
    print('程序版本号:{}'.format(VERSION))
    print('激活窗口并按 CONTROL + C 组合键退出')
    debug.dump_device_info()
    screenshot.check_screenshot()

    while True:
        next_page()

        time.sleep(1)
        screenshot.pull_screenshot()

        resize_image('autojump.png', 'optimized.png', 1024 * 1024)

        with open('optimized.png', 'rb') as bin_data:
            image_data = bin_data.read()

        ai_obj = apiutil.AiPlat(AppID, AppKey)
        rsp = ai_obj.face_detectface(image_data, 0)

        if rsp['ret'] == 0:
            beauty = 0
            for face in rsp['data']['face_list']:
                print(face)
                face_area = (face['x'], face['y'], face['x'] + face['width'],
                             face['y'] + face['height'])
                print(face_area)
                img = Image.open("optimized.png")
                cropped_img = img.crop(face_area).convert('RGB')
                cropped_img.save(FACE_PATH + face['face_id'] + '.png')
                # 性别判断
                if face['beauty'] > beauty and face['gender'] < 50:
                    print("颜值不达标跳过!")
                    beauty = face['beauty']

            # 是个美人儿~关注点赞走一波
            if beauty > BEAUTY_THRESHOLD:
                print('小姐姐还可以,点个赞!')
                thumbs_up()
                if beauty > BEAUTY_THRESHOLD + 10:
                    print('要细细看来,很不错,关注一下!')
                    follow_user()

        else:
            print(rsp)
            continue
示例#7
0
def getVideoData():
    """
    获取抖音视频数据
    :return:
    """
    screenshot.getVideoDataImage()
    #参数 左上右下
    cut_image('video_data.png', 'vdata.png', 960, 960, 1060, 1460)

    with open('vdata.png', 'rb') as bin_data:
        user_image = bin_data.read()

    ai_tools = apiutil.AiPlat(AppID, AppKey)
    video_data = ai_tools.getVideoData(user_image)
    v_data = video_data['data']['item_list']
    if (len(v_data) == 3):
        favorite_cnt = v_data[0]['itemstring']
        reply_cnt = v_data[1]['itemstring']
        forward_cnt = v_data[2]['itemstring']
        print("fav:{0},rep:{1},forward:{2}".format(favorite_cnt, reply_cnt,
                                                   forward_cnt))
示例#8
0
def getUserProfile():
    """
    获取抖音账号
    :return:
    """
    cmd = 'shell input tap {x} {y}'.format(
        x=config['user_bottom']['x'] + _random_bias(10),
        y=config['user_bottom']['y'] + _random_bias(10))
    adb.run(cmd)
    time.sleep(0.5)
    screenshot.getUserImage()
    #参数 左上右下
    cut_image('user_profile.png', 'user.png', 0, 510, 700, 570)

    with open('user.png', 'rb') as bin_data:
        user_image = bin_data.read()

    ai_tools = apiutil.AiPlat(AppID, AppKey)
    user_data = ai_tools.getUserData(user_image)
    for textData in user_data['data']['item_list']:
        if "抖音号" in textData['itemstring']:
            AddDouYinAccount(textData['itemstring'])
示例#9
0
def main0():
    print('程序版本号:{}'.format(VERSION))
    print('激活窗口并按 CONTROL + C 组合键退出')

    for p in os.listdir('.' % FACE_PATH):
        if os.path.isdir(p):  # 判断是否为文件夹,如果是输出所有文件就改成: os.path.isfile(p)
            print(p)
            with open(p, 'rb') as bin_data:
                image_data = bin_data.read()

            ai_obj = apiutil.AiPlat(AppID, AppKey)
            rsp = ai_obj.face_detectface(image_data, 0)

            if rsp['ret'] == 0:
                beauty = 0
                for face in rsp['data']['face_list']:
                    print(face)
                    face_area = (face['x'], face['y'],
                                 face['x'] + face['width'],
                                 face['y'] + face['height'])
                    print(face_area)
                    img = Image.open("optimized.png")
                    cropped_img = img.crop(face_area).convert('RGB')
                    cropped_img.save(FACE_PATH + face['face_id'] + '.png')
                    # 性别判断
                    if face['beauty'] > beauty and face['gender'] < 50:
                        beauty = face['beauty']

                # 是个美人儿~关注点赞走一波
                if beauty > BEAUTY_THRESHOLD:
                    print('发现漂亮妹子!!!')
                    thumbs_up()
                    follow_user()

            else:
                print(rsp)
                continue
示例#10
0
def main(queue):
    """
    main
    :return:
    """
    print('程序版本号:{}'.format(VERSION))
    print('激活窗口并按 CONTROL + C 组合键退出')
    debug.dump_device_info()
    screenshot.check_screenshot()

    while True:
        next_page()

        time.sleep(random.randint(1, 5))
        screenshot.pull_screenshot()

        crop_image('douyin.png', 'optimized.png', config['crop_img']['x'],
                   config['crop_img']['y'], config['crop_img']['width'],
                   config['crop_img']['height'])

        with open('optimized.png', 'rb') as bin_data:
            image_data = bin_data.read()

        ai_obj = apiutil.AiPlat(AppID, AppKey)
        rsp = ai_obj.face_detectface(image_data, 0)

        major_total = 0
        minor_total = 0
        if rsp['ret'] == 0:
            beauty = 0
            for face in rsp['data']['face_list']:
                msg_log = '[INFO] gender: {gender} age: {age} expression: {expression} beauty: {beauty}'.format(
                    gender=face['gender'],
                    age=face['age'],
                    expression=face['expression'],
                    beauty=face['beauty'],
                )
                print(msg_log)
                with Image.open("optimized.png") as im:
                    crop_img = im.crop(
                        (face['x'], face['y'], face['x'] + face['width'],
                         face['y'] + face['height']))
                    crop_img.save(FACE_PATH + face['face_id'] + '.png')

                # 性别判断
                is_correct_gender = (face['gender'] < 50) if (
                    GENDER == 'female') else (face['gender'] > 50)
                if face['beauty'] > beauty and is_correct_gender:
                    beauty = face['beauty']

                if face['age'] > GIRL_MIN_AGE:
                    major_total += 1
                else:
                    minor_total += 1

            # 发现符合要求的视频
            if beauty > BEAUTY_THRESHOLD and major_total > minor_total:
                msg = '发现漂亮妹子👀' if (GENDER == 'female') else '发现帅气小哥👀'
                print(msg)
                thumbs_up()
                follow_user()
                share_video()
                left_swipe()
                video_url = copy_link()
                queue.put(video_url)
        else:
            print(rsp)
            continue
示例#11
0
def main0():
    print('程序版本号:{}'.format(VERSION))
    print('激活窗口并按 CONTROL + C 组合键退出')

    for p in os.listdir(  FACE_PATH):
        if os.path.isfile( FACE_PATH + p):  # 判断是否为文件夹,如果是输出所有文件就改成: os.path.isfile(p)
            print(p)
            (filepath, tempfilename)=os.path.split( FACE_PATH + p)
            (filename, extension)=os.path.splitext(tempfilename)
            if extension=='.jpg':
                with open( FACE_PATH + p, 'rb') as bin_data:
                    image_data = bin_data.read()

                ai_obj = apiutil.AiPlat(AppID, AppKey)
                rsp = ai_obj.face_detectface(image_data, 1)

                if rsp['ret'] == 0:
                    beauty = 0
                    for face in rsp['data']['face_list']:
                        print(face)
                        face_area = (face['x'], face['y'], face['x'] + face['width'], face['y'] + face['height'])
                        print(face_area)

                        img =Image.open( FACE_PATH + p)

                        #img.show()
                        drawObject=ImageDraw.Draw(img)
                        drawObject.rectangle(face_area, outline="red")

                        drawObject.polygon(getList(face['face_shape']['face_profile']), outline="yellow")
                        drawObject.polygon(getList(face['face_shape']['left_eyebrow']), outline="white")
                        drawObject.polygon(getList(face['face_shape']['right_eyebrow']), outline="white")
                        drawObject.polygon(getList(face['face_shape']['left_eye']), outline="white")
                        drawObject.polygon(getList(face['face_shape']['right_eye']), outline="white")
                        #'left_eyebrow'
                        drawObject.polygon(getList(face['face_shape']['mouth']), outline="green")
                        drawObject.polygon(getList(face['face_shape']['nose']), outline="#ffcc00")
                        BASE_PATH='.' + os.sep

                        hwls_path=os.path.join(BASE_PATH, "font", "STKAITI.ttf")
                        hwls_font=ImageFont.truetype(hwls_path, 14)
                        gender__format=u'魅力={},性别={}'.format(face['beauty'], face['gender'])
                        drawObject.text( (50,img.size[1]-50),
                                        gender__format, "#ccFFcc",hwls_font)
                        #
                        #drawObject.rectangle(face_area, fill=128)
                        img.save(FACE_PATH + face['face_id'] + 'box.png')
                        cropped_img = img.crop(face_area).convert('RGB')
                        cropped_img.save(FACE_PATH + face['face_id'] + 'crop.png')
                        # 性别判断
                        if face['beauty'] > beauty and face['gender'] < 50:
                            beauty = face['beauty']

                    # 是个美人儿~关注点赞走一波
                    if beauty > BEAUTY_THRESHOLD:
                        print('发现漂亮妹子!!!')


                else:
                    print(rsp)
                    continue