This repository has been archived by the owner on Jul 8, 2024. It is now read-only.
Implemented NoneType check for html parameter #55
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Parameter html was assumed to be type of string. This is not always the case, therefore a check is implemented to prevent the application from crashing
I executed the following code and after a while it threw an error because the html parameter did not have the proper type.
tweetCriteria = got.manager.TweetCriteria().setQuerySearch('SEZ').setEmoji("unicode")
tweets = got.manager.TweetManager.getTweets(tweetCriteria)
Thrown Error:
AttributeError Traceback (most recent call last)
in ()
45 for st in searchterms:
46 tweetCriteria = got.manager.TweetCriteria().setQuerySearch(st).setEmoji("unicode")
---> 47 tweets = got.manager.TweetManager.getTweets(tweetCriteria)
48 ct = ct + 1
49 print('st number ' + str(ct))
1 frames
/usr/local/lib/python3.6/dist-packages/GetOldTweets3/manager/TweetManager.py in getTweets(tweetCriteria, receiveBuffer, bufferLength, proxy, debug)
86 tweet.username = usernames[0]
87 tweet.to = usernames[1] if len(usernames) >= 2 else None # take the first recipient if many
---> 88 rawtext = TweetManager.textify(tweetPQ("p.js-tweet-text").html(), tweetCriteria.emoji)
89 tweet.text = re.sub(r"\s+", " ", rawtext)
90 .replace('# ', '#').replace('@ ', '@').replace('$ ', '$')
/usr/local/lib/python3.6/dist-packages/GetOldTweets3/manager/TweetManager.py in textify(html, emoji)
182 # Step 1, prepare a single-line string for re convenience
183 puc = chr(0xE001)
--> 184 html = html.replace("\n", puc)
185
186 # Step 2, find images that represent emoji, replace them with the
AttributeError: 'NoneType' object has no attribute 'replace'