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)
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
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) # n=random.randint(1,3) # print('n:',n) # # if n ==3 or n==1: # # 关注点赞走一波 # time.sleep(1) action.action.move('center_point') #ocr.main() print('点赞并关注!!!')
def FacePPRun(): global source_image_data 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() AppID='kyvvWu38YdLNSElYJ474dZeqaxuom2pe' AppKey='gBivbqKgUVZOKKMYbfCWSIpBfOnqR8W0' ai_obj = apiutilFACEPP.AiPlatFACEPP(AppID, AppKey) im_s=source_image(source_image_data) confidence = ai_obj.compare_body(im_s,image_data) print('相似度:'+str(confidence)) if confidence>75: print("发现高度相似,已关注") follow_user()
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
def FacePPRun(): global ts global source_image_data 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() bin_data.close() AppID = 'kyvvWu38YdLNSElYJ474dZeqaxuom2pe' AppKey = 'gBivbqKgUVZOKKMYbfCWSIpBfOnqR8W0' ai_obj = apiutilFACEPP.AiPlatFACEPP(AppID, AppKey) rsp = ai_obj.face_detectfacePP(image_data, 1) print(rsp) im_s = source_image(source_image_data) confidence = ai_obj.compare_body(im_s, image_data) print('相似度:' + str(confidence)) if ('female_score' in rsp.keys()) and ('male_score' in rsp.keys()) and ( 'age' in rsp.keys()) and ('gender' in rsp.keys()): # 是个美人儿~关注点赞走一波 if rsp['female_score'] > BEAUTY_THRESHOLD and rsp[ 'male_score'] > BEAUTY_THRESHOLD and rsp[ 'age'] > GIRL_MIN_AGE and rsp['gender'] == 'Female': print('发现漂亮妹子!!!') thumbs_up() follow_user() #存储截图 rspk = ai_obj.body_segment(image_data) if confidence > 75: print("发现高度相似,已抠像") with open( os.path.join('screenshot_backups', '#segment-' + str(ts) + '.png'), 'wb') as bin_data: bin_data.write(rspk) bin_data.close() debug.save_debug_screenshot_font(ts, rsp['age'], rsp['male_score']) ts += 1 else: print(rsp) continue
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
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']) 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() else: print(rsp) continue
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
def main(): """ main :return: """ print('程序版本号:{}'.format(localConfig.VERSION)) 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() image_obj = apiutil.AiPlatImage(localConfig.imageAk, localConfig.imageSk) ad_obj = apiutil.AiPlatWord(localConfig.adAk, localConfig.adSk) adResult = ad_obj.ad_detectface(image_data) if adResult: print("这是一条广告,跳过下一条") continue rsp = image_obj.face_detectface(image_data) major_total = 0 minor_total = 0 if rsp['result'] != None: beauty = 0 for face in rsp['result']['face_list']: msg_log = '[INFO] gender: {gender} age: {age} expression: {expression} beauty: {beauty}'.format( gender=face['gender']['type'], age=face['age'], expression=face['expression']['type'], beauty=face['beauty'], ) print(msg_log) if face['beauty'] > beauty and face['gender'][ 'type'] == 'female': beauty = face['beauty'] if face['age'] > localConfig.GIRL_MIN_AGE: major_total += 1 else: minor_total += 1 if beauty > localConfig.BEAUTY_THRESHOLD and major_total > minor_total: print('发现漂亮妹子!!!') try: # 下载视频 download() except Exception as e: print(e) continue else: continue