How to get the youtube comment which user is reading through accessibility service?

Viewed 29

I want to know which comments users are currently reading and replying to on Youtube through Android Accessibility Service.

@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
  AccessibilityNodeInfo nodeInfo = event.getSource();
  if(nodeInfo != null) {
    Log.d(TAG, "NodeInfo: " + nodeInfo);
    Log.d(TAG, "NodeInfo: " + nodeInfo.getContentDescription());
    dfs(nodeInfo);
  }
  ...
}

I tried using event.getSource() and DFS to log all the AccessibilityNodeInfo in onAccessibilityEvent() but I can't get the comment content without enabling the talkback function on the phone.
Once the talkback function of the phone is enabled, the comment content on the phone screen could be logged with the exact same code running.

Did anyone have the same problem as me?
Is there any possibility of NOT enabling the talkback function and also getting the comment content showing on the phone screen?

0 Answers
Related