MCPcopy
hub / github.com/InstaPy/InstaPy / verify_liking

Function verify_liking

instapy/like_util.py:922–947  ·  view source on GitHub ↗

Get the amount of existing existing likes and compare it against maximum & minimum values defined by user

(browser, maximum, minimum, logger)

Source from the content-addressed store, hash-verified

920
921
922def verify_liking(browser, maximum, minimum, logger):
923 """Get the amount of existing existing likes and compare it against maximum
924 & minimum values defined by user"""
925
926 post_page = get_additional_data(browser)
927 likes_count = post_page["graphql"]["shortcode_media"]["edge_media_preview_like"][
928 "count"
929 ]
930
931 if not likes_count:
932 likes_count = 0
933
934 if maximum is not None and likes_count > maximum:
935 logger.info(
936 "Not liked this post! ~more likes exist off maximum limit at "
937 "{}".format(likes_count)
938 )
939 return False
940 elif minimum is not None and likes_count < minimum:
941 logger.info(
942 "Not liked this post! ~less likes exist off minimum limit "
943 "at {}".format(likes_count)
944 )
945 return False
946
947 return True
948
949
950def like_comment(browser, original_comment_text, logger):

Callers 7

like_by_locationsMethod · 0.85
like_by_tagsMethod · 0.85
like_by_usersMethod · 0.85
interact_by_usersMethod · 0.85
interact_by_URLMethod · 0.85

Calls 1

get_additional_dataFunction · 0.85

Tested by

no test coverage detected