Hey! This is a pull request to fix issue #7 (Drop Attribution?)
The code adds another function remove_credit which takes the text of the ebook tweet and searches it to see if the second-to-last word is 'via' or 'says'. If so, it removes that and anything after. The logic here being that 'via' or 'says' style RTs will always have 'via' or 'says' as their second to last word (the last word being the username)
The function gets called twice, once after the initial ebook_tweet is generated and once again if the tweet is determined to be too short and additional text is added. This is so that if the first tweet had a 'via' credit, it still gets removed, along with the second tweet's 'via' credit (if any.)
This is my first real PR, so I welcome feedback / improvements / whatever else. Thanks!
Thanks for this New Year's Day pull request, @sparky005!
Let me take a look at this over the next couple days to see if there's any questions I have. Then I'll try to merge as soon as I can.
Hey! This is a pull request to fix issue #7 (Drop Attribution?) The code adds another function remove_credit which takes the text of the ebook tweet and searches it to see if the second-to-last word is 'via' or 'says'. If so, it removes that and anything after. The logic here being that 'via' or 'says' style RTs will always have 'via' or 'says' as their second to last word (the last word being the username)
The function gets called twice, once after the initial ebook_tweet is generated and once again if the tweet is determined to be too short and additional text is added. This is so that if the first tweet had a 'via' credit, it still gets removed, along with the second tweet's 'via' credit (if any.)
This is my first real PR, so I welcome feedback / improvements / whatever else. Thanks!