chat-downloader icon indicating copy to clipboard operation
chat-downloader copied to clipboard

Incomplete Parsing of Fundraising Donation Messages in Live Chat

Open repollo opened this issue 1 year ago • 2 comments

Description:

Hello maintainers of chat-downloader,

Firstly, I'd like to express my appreciation for the incredible work on this library. I've been using the tool to parse live chat fundraising donation messages from YouTube and identified some issues in the extraction process.

Issue: The current parsing mechanism for the donation_announcement messages doesn't correctly extract all pertinent details, such as the donation amount and currency. This leads to the constructed output message lacking essential information about the donation.

Proposed Changes:

  1. Enhanced Handling of donation_details in _REMAPPING: Update the _REMAPPING dictionary to accurately capture donation_details:
_REMAPPING = {
    ...
    'text': r('donation_details', _parse_runs, False),
    ...
}
  1. Improved Parsing Logic in _parse_item: Modify the _parse_item function to better handle donation details:
...
# After the remapping is done, now handle the custom logic for donations
if 'donation_details' in info:
    donation_text = info['donation_details']['message']
    # Extract the donation amount using a split method
    match = donation_text.split('donated')
    if match:
        amount_text = match[-1].strip()
        dummy_load = {"simpleText": amount_text}
        currency_info = YouTubeChatDownloader._parse_currency(dummy_load)
        info['donation_details'] = currency_info
...

By implementing these changes, the parser should be able to extract all relevant details about the donation, making the output message more complete and informative.

I hope you consider integrating these adjustments into the main library. It would greatly enhance the capability and accuracy of the tool when parsing fundraising donation messages.

Thank you for your attention to this matter.

Warm regards, repollo

repollo avatar Oct 09 '23 22:10 repollo

Thanks for this! @repollo would you like to open a PR (since you already seem to have found a fix). That would help a lot!

xenova avatar Oct 15 '23 05:10 xenova

Do you have a specific preference of the key you would like to use? Any standardization on the matter? Right now I implemented with donation_details but that was for my use case. Let me know.

repollo avatar Oct 21 '23 22:10 repollo