Handle URLs before translation
This commit is contained in:
parent
94bedf0488
commit
3b8dc335a9
1 changed files with 8 additions and 1 deletions
|
@ -45,7 +45,14 @@ for status in timeline:
|
||||||
|
|
||||||
for a in accounts:
|
for a in accounts:
|
||||||
two = twitools.twObject(ato=a[1], ase=a[2])
|
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("@", "@")
|
tstring = translator.translate(intext, target_language=a[0])['translatedText'].replace("@", "@")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue