Check duplicated number or check it's already acting done

Let's say there are several posts.
They all have unique post ids as you may know.

We keep refreshing and get new posts.

Process

  1. Refresh
  2. Find strings on the title. ( we just need to search and check strings what we are looking for )
  3. Click
    .. and ...
  4. Done

But we also need to check if we already clicked on the post or not.

Therefore we need to get the post ID and save it somewhere ( I guess clipboard ) and check.

The code looks like this. Unfortunately, the post ID is not only numbers.
indent preformatted text by 4 spaces

<ul>
<li id="postid-12ree" class="mypost"> <a href="...">Post Title</a></li>
<li id="postid-12fewf" class="mypost"> <a href="...">Post Title</a></li>
<li id="postid-1233fwww" class="mypost"> <a href="...">Post Title</a></li>
<li id="postid-12erwss" class="mypost"> <a href="...">Post Title</a></li>
</ul>

I am trying to get the id or class by querySelector.

But I am not sure how I can save the listing ID and check if I clicked.

Is there any way to do?

The posts look like this.

Whenever you click refresh, new posts come. It can be NEW 1 ~3 posts every fresh.

Any advice, your experience would be very helpful and appreciated. :slight_smile:

Thank you,

Like your other request, this is also doable, but somewhat complex, or at least time-consuming to develop.

I'm not sure when I'll have time to devote to this, but to get started you need to provide either the page URL, or a zip file of the HTML source code.

Negative. No need for a clipboard here. A KM Global Variable will work just fine.

You can search, using JavaScript RegEx, the KM Variable in the JavaScript that extracts the link IDs, and then the script will return the new IDs that were found and a KM Action can add those to the KM Variable.

1 Like

Hello,

Oh ok, understood about the variable.
I have been studying KM every day as I am very new. I understand what you mean about using variables.

Yes, my other questions are all related.

Blockquote
You can search, using JavaScript RegEx, the KM Variable in the JavaScript that extracts the link IDs, and then the script will return the new IDs that were found and a KM Action can add those to the KM Variable.

Thank you for your explanation. This is also helpful.
I need to confirm and make sure if the processing is correct or not.
I will search and try to work on it as you adviced.

Thank you,