chat-downloader
chat-downloader copied to clipboard
Incomplete Parsing of Fundraising Donation Messages in Live Chat
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:
-
Enhanced Handling of
donation_details
in_REMAPPING
: Update the_REMAPPING
dictionary to accurately capturedonation_details
:
_REMAPPING = {
...
'text': r('donation_details', _parse_runs, False),
...
}
-
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
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!
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.