chiark / gitweb /
strip more garbage out of twitter urls (esp the ?s=[:digits:]) tracking code - thanks...
authorMatthew Vernon <matthewv@chiark.greenend.org.uk>
Tue, 11 Dec 2018 16:34:31 +0000 (16:34 +0000)
committerMatthew Vernon <matthewv@chiark.greenend.org.uk>
Tue, 11 Dec 2018 16:34:31 +0000 (16:34 +0000)
commands.py

index 3974bfbc8d9f9b886aed358f5d50b3c3a86fbab7..698bfdbe64c7161b83afba284a580203bfe2ff20 100755 (executable)
@@ -526,9 +526,9 @@ def getTweet(urlstring,twitapi,inclusion=False,recurlvl=0):
   unobfuscate_urls=True
   expand_included_tweets=True
   stringsout=[]
   unobfuscate_urls=True
   expand_included_tweets=True
   stringsout=[]
-  
-  parts = string.split(urlstring,'/')
-  tweetID = parts[-1]
+
+  path = urlparse.urlparse(urlstring).path
+  tweetID = path.split('/')[-1]
   try:
     status = twitapi.GetStatus(tweetID)
     if status == {}:
   try:
     status = twitapi.GetStatus(tweetID)
     if status == {}: