diff --git a/transbot.py b/transbot.py index f9e3faa..469c84b 100755 --- a/transbot.py +++ b/transbot.py @@ -45,7 +45,14 @@ for status in timeline: for a in accounts: two = twitools.twObject(ato=a[1], ase=a[2]) - intext = re.sub(r'https?:\/\/[\S]*', '', text) + split = text.split() + intext = "" + + for s in split: + if re.match(r'https?:\/\/[\S]*', s): + out = " ".join([out, httptools.shortURL(s)]) + else: + out = " ".join([out, s]) tstring = translator.translate(intext, target_language=a[0])['translatedText'].replace("@", "@​") try: