Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvement: recipient_id #87

Open
bernard01 opened this issue Aug 6, 2021 · 7 comments
Open

improvement: recipient_id #87

bernard01 opened this issue Aug 6, 2021 · 7 comments

Comments

@bernard01
Copy link

It's quite amazing what can be done with the database. Now I am looking at comments where the recipient is not the parent, the original poster, but another user in the same thread. Perhaps the YouTube API does not reveal that case except one has to take that from the @user Name prefix of the text. The best place to do this IMHO would be when importing into the database, especially in light of the fact that a user can change name while the ID remains the same.

To resolve this, the comments table would need an additional field, like recipient_id which would be the same as parent_id in case the comment is directed at the parent.

@bernard01
Copy link
Author

parent_id is perhaps not a good field name as it would be misleading as if it was a channel ID. Perhaps to_message_id?

@mattwright324
Copy link
Owner

mattwright324 commented Aug 7, 2021

Well, here are some thoughts/issues

  • YouTube does not provide this detail unfortunately. Comment text from the API is simply @Display Name this is the reply in the response and not <a href=".../channelId">@Display Name</a> this is the reply
  • For those @'s to appear you have to either hit the Reply button in the YouTube webpage or manually type @channelId. I seem to be doing replies wrong in the app then so this is something I need to fix.
  • In the YouTube webpage @Display Name is not a reference to a specific comment but to the channel so if it were to be a new feature, it could only be channelId and not commentId.
  • It could be possible to match up display names in the thread to the message... pseudo code commentText.startsWith("@" + displayName)
    • However, people can change their name as you've noted.
    • Also, multiple people can have the same display name, this could result in wrong id's on occasion (e.g. popular creators and spam lookalikes)

Edit: Taking back that I am doing the @'s wrong. It appears that this isn't the case. Manually typing @channelId does not work, it just appeared to work on my first check. It seems you can only get the linked channel by hitting reply to a reply in a thread. I'm not sure if there is a way to create a linked @ outside the YouTube web interface.

@mattwright324
Copy link
Owner

mattwright324 commented Aug 8, 2021

Another interesting detail, it appears that the displayed name in the comment does change when someone changes their name though it can take a few minutes for it to update for all @ references. I saw one reply as the new name and the others as the previous name until a few minutes went by.

image

Then rename the account to Foo Bar

image

@mattwright324
Copy link
Owner

I have submitted an issue feature request about this to Google to see if they can add the channel reference to the textDisplay field.

https://issuetracker.google.com/issues/195757169

@bernard01
Copy link
Author

Thanks for posting the link to the Google request.
I checked in the Google request what you are requesting. I am sure we have a misunderstanding. I wasn't quite clear about my intentions. Here you pointed out the difficulties quite correctly. Let me just repeat this to see whether I get this right. As it stands, the browser link in the text to the author who is being responded to contains the channel ID of that author. That link is ONLY present in the message text if the author is the author of a message that is a RESPONSE to the message of the original poster. Otherwise if the message is in response to the original poster then there is no link at all. Now I am not interested in that author, and I am not interested in the link, either. I am interested in the id of the last message of that author in the thread. If I have the message ID of that message then I should be able to get the author ID from that message. But there is a difficulty. If I do NOT have that message in the database, then I cannot cannot even get the author. But on the other hand, it should not be possible that someone posts such a response without that author having a message in that thread to respond to. So we would need to negotiate with Google which of the additional IDs - respond_to_message_id, respond_to_channel_id we can get. I don't know how the markup of a URL to the channel as you are requesting could be of much use as it would require additional parsing. In other words, I am looking at the data model. I need more than the discriminator being that the parent_id is null. If I could get that respond_to_message_id then this would be ideal. If I could get the to respond_to_channel_id then this would be good, too.

@mattwright324
Copy link
Owner

mattwright324 commented Aug 9, 2021

Sure, though having that channel id detail somewhere is better than nowhere. If the channel url is added to textDisplay then it can be extracted and there is a guarantee it is the right person. With the guaranteed right person it could be possible to find the most recent comment id(s) of that person that you are looking for. Without that guarantee (issues as listed earlier), I think that these fields would be unreliable.

I'm not sure that Google has that kind of reply-to-reply id stored to provide. For example, in their API notes, it mentions that they only support replies to top-level-comments which is probably why they only reference the channel.
image

@bernard01
Copy link
Author

Some background. There is a need to at least identify replies to replies. That need arises from the difference between notification of listeners in a comment thread. Because such a reply does not notify the original poster of the common parent message. Currently I use this SQL criterion as a hack:
comments.comment_text like '@%'
It is not 100% safe though and it does not get the channel ID. But it works in most cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants