MCPcopy
hub / github.com/InstaPy/InstaPy / process_comments

Function process_comments

instapy/comment_util.py:393–470  ·  view source on GitHub ↗
(
    comments,
    clarifai_comments,
    delimit_commenting,
    max_comments,
    min_comments,
    comments_mandatory_words,
    owner,
    user_name,
    blacklist,
    browser,
    link,
    logger,
    logfolder,
    publish=True,
)

Source from the content-addressed store, hash-verified

391
392
393def process_comments(
394 comments,
395 clarifai_comments,
396 delimit_commenting,
397 max_comments,
398 min_comments,
399 comments_mandatory_words,
400 owner,
401 user_name,
402 blacklist,
403 browser,
404 link,
405 logger,
406 logfolder,
407 publish=True,
408):
409
410 # comments
411 if delimit_commenting:
412 (commenting_approved, disapproval_reason,) = verify_commenting(
413 browser,
414 max_comments,
415 min_comments,
416 logger,
417 )
418 if not commenting_approved:
419 logger.info(disapproval_reason)
420 return False
421
422 (
423 commenting_approved,
424 selected_comments,
425 disapproval_reason,
426 ) = verify_mandatory_words(
427 comments_mandatory_words,
428 comments,
429 browser,
430 logger,
431 )
432
433 if not commenting_approved:
434 logger.info(disapproval_reason)
435 return False
436
437 if len(clarifai_comments) > 0:
438 selected_comments = clarifai_comments
439
440 # smart commenting
441 if comments and publish:
442 # Check if InstaPy already commented on this post, it could be the
443 # case that the image has been liked (manually) but not commented, so
444 # we want to comment the post like usually we do.
445 commented_image, message = verify_commented_image(browser, link, owner, logger)
446
447 if commented_image:
448 # The post has already been commented, either manually or InstaPy
449 # Commenting twice by InstaPy user is not allowed by now or could
450 # not get comments on this post to check if InstaPy user commented

Callers 8

like_by_locationsMethod · 0.85
comment_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 5

verify_commentingFunction · 0.85
verify_mandatory_wordsFunction · 0.85
verify_commented_imageFunction · 0.85
comment_imageFunction · 0.85
web_address_navigatorFunction · 0.85

Tested by

no test coverage detected