Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Commit

Permalink
Fix issue with incorrect HTML handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Mottl committed Dec 3, 2018
1 parent c4ea631 commit ccc293c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion GetOldTweets3/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from . import models
from . import manager

__version__ = '0.0.8'
__version__ = '0.0.9'
3 changes: 3 additions & 0 deletions GetOldTweets3/manager/TweetManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ def getTweets(tweetCriteria, receiveBuffer=None, bufferLength=100, proxy=None, d
tweet = models.Tweet()

usernames = tweetPQ("span.username.u-dir b").text().split()
if not len(usernames): # fix for issue #13
continue

tweet.username = usernames[0]
tweet.to = usernames[1] if len(usernames) == 2 else None
tweet.text = re.sub(r"\s+", " ", tweetPQ("p.js-tweet-text").text())\
Expand Down
6 changes: 6 additions & 0 deletions bin/GetOldTweets3
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ GetOldTweets3 --username "barackobama" --maxtweets 10 --toptweets
"""

import os, sys, re, getopt
import traceback

if sys.version_info[0] < 3:
raise Exception("Python 2.x is not supported. Please upgrade to 3.x")

Expand Down Expand Up @@ -172,7 +174,11 @@ def main(argv):
print('Arguments parser error, try -h')
print('\t' + str(err))

except KeyboardInterrupt:
print("\r\nInterrupted.\r\n")

except Exception as err:
print(traceback.format_exc())
print(str(err))

finally:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setuptools.setup(
name="GetOldTweets3",
version="0.0.8",
version="0.0.9",
author="Dmitry Mottl",
author_email="[email protected]",
license='MIT',
Expand Down

0 comments on commit ccc293c

Please sign in to comment.