tweet_parser icon indicating copy to clipboard operation
tweet_parser copied to clipboard

Incompatibility with standard REST APIs in extended mode

Open jmargutt opened this issue 5 years ago • 2 comments

When using standard REST APIs in extended mode (passing tweet_mode=extended to any endpoint) the tweet contains no "text" field, only a "full_text" one. Therefore tweet_checking.check_tweet() throws a NotATweetError.

jmargutt avatar May 23 '19 11:05 jmargutt

Hi, Thanks for the note, that's a good point. I imagine fixing this bug would involve changing the tweet_text.py getters and checking others for compatibility with the "extended" mode. Are there any other areas where extended mode isn't functioning as expected with the tweet_parser package? Can you share any workarounds you've used?

fionapigott avatar May 28 '19 20:05 fionapigott

I did not encounter other areas where extended mode isn't functioning. Easy and ugly workaround: add to tweet_text.get_text() and .get_full_text() if ("text" not in tweet and "full_text" in tweet): return tweet["full_text"] elif ... and remove "text" from tweet_checking._check_original_format_tweet(), so that it looks like for key in ["user"]: if key not in tweet: raise NotATweetError("This dict has no '{}' key".format(key))

jmargutt avatar Jun 19 '19 12:06 jmargutt