# Avoid truncated tweets texts when using ServiceExecute?

GROUPS:
 I use the Twitter command to extract tweets and do some analysis twitter = ServiceConnect["Twitter", "New"] listTws = twitter["TweetSearch", "Query" -> "Trump", MaxItems -> 10]; For example, the text of the first tweet can be extracted with listTws[[1]]["Text"] whose output is "RT @BreitbartNews: \"Let\[CloseCurlyQuote]s turn a negative into a positive... I want them to say, \[OpenCurlyQuote]Look, we are not profiting off the deaths of children. We..." The tweet is truncated after "We..." . If I look at the original tweet (ID 966454631361589249) , the original phrase is completed. Who can I extract the whole sentence??Is there a way to avoid to import retweets?? They are the majority and look like "RT @name blabla"Here I read that I need to set "tweet_mode=extended". How can I do that with Mathematica?UPDATEI have noticed that the truncated tweets' length is 140, whereas the total length is 280. This may be related to the new feature of twitter. Is there a way to fix it?
1 month ago
5 Replies
 Bob Sandheinrich 1 Vote There will be a Twitter service connection update soon that retrieves longer tweets without truncating. Until then you can use this code to directly specify the query. This code is not guaranteed to be supported forever, so when the documented method you have above starts retrieving full texts - when we release our update - you should go back to using that approach. twitter = ServiceConnect["Twitter", "New"] response = OAuthClientrawoauthdata[twitter["ID"], "https://api.twitter.com/1.1/search/tweets.json?count=10&q=Olympics&tweet_mode=extended"]; Lookup[ImportString[response[[2]], "RawJSON"]["statuses"], "full_text"] 
1 month ago
 Thank you Bob, but this doesn't seem to resolve the problem. The texts are still truncated.For example, this may be related to "displaytextrange" which is set to be [0,140]? (see next figure)
 Bob Sandheinrich 1 Vote Good catch. Try this instead In[108]:= fulltweets = Lookup[Lookup[#, "retweeted_status", #] & /@ ImportString[response[[2]], "RawJSON"]["statuses"], "full_text"]; In[109]:= StringLength /@ fulltweets Out[109]= {45, 19, 206, 223, 172, 263, 240, 131, 126, 60} `
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.30852630734443665, "perplexity": 3673.9794157539714}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2018-13/segments/1521257648207.96/warc/CC-MAIN-20180323102828-20180323122828-00288.warc.gz"}