Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用新的280字符系统进行Twitter文本检索_Twitter_Google Apps Script - Fatal编程技术网

使用新的280字符系统进行Twitter文本检索

使用新的280字符系统进行Twitter文本检索,twitter,google-apps-script,Twitter,Google Apps Script,使用谷歌脚本,我有一个程序,从一个帐户的推文中检索文本,并将其用于其他各种事情。它已经运行了一年多,问题很少,但现在推文被调整为280个字符,我无法检索推文的后半部分。我有: function refreshing_v2() { var service = getTwitterService(); if (service.hasAccess()) { var url = 'https://api.twitter.com/1.1/statuses/user_timeline.jso

使用谷歌脚本,我有一个程序,从一个帐户的推文中检索文本,并将其用于其他各种事情。它已经运行了一年多,问题很少,但现在推文被调整为280个字符,我无法检索推文的后半部分。我有:

 function refreshing_v2() {


  var service = getTwitterService();
  if (service.hasAccess()) {

var url = 'https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=(redacted)&count=1&include_rts=0&exclude_replies=1';

var response = service.fetch(url);
var tweets = JSON.parse(response.getContentText());
for (var i = 0; i < tweets.length; i++) {

  //Parse the tweet
  var latest = new String(tweets[i].text); 
  var maxi_id = tweets[i].id;
  var startpos = latest.indexOf("1: ");
函数刷新_v2(){
var service=getTwitterService();
if(service.hasAccess()){
var url='1〕https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=(修订版)&count=1&include_rts=0&exclude_reply=1';
var response=service.fetch(url);
var tweets=JSON.parse(response.getContentText());
对于(var i=0;i
等等,等等,继续用发现的东西做事情

这允许我获取文本的前半部分。检索到的内容类似“[前半部分的内容]…(链接到tweet)”


如何获取全文?

您需要添加
tweet\u mode=extended
以获取响应中的全文。您可能需要检查收到的实体,以查看它是否符合您的期望

文件链接-

此外,您需要使用
全文
,而不仅仅是
文本

因此:


查看位于

的示例推文。您需要添加
tweet\u mode=extended
以获取响应中的全文。您可能需要检查收到的实体,以查看它是否符合您的预期

文件链接-

此外,您需要使用
全文
,而不仅仅是
文本

因此:


查看位于

的示例tweet抱歉,我不知道该放在哪里。该程序是从其他人那里继承的,因此我承认我对推特语法的理解有点动摇。我尝试将&tweet_mode=extended添加到url声明中,但它只返回了“undefined”而不是截短的tweet或完整的tweet。你能添加你程序的完整代码吗?编辑问题,这样我们就可以准确地看到发生了什么。用函数的完整开头编辑。我已经编辑了我的答案。当你解析使最新返回为未定义的tweet时,你应该使用
全文
。对不起,我不知道确切的位置。这个程序是从其他人那里继承的,所以我承认我对推特语法的理解有点动摇。我尝试将&tweet_mode=extended添加到url声明中,但它只是返回了“undefined”而不是截短的tweet或完整的tweet。你能添加你程序的完整代码吗?编辑问题,这样我们就可以确切地看到发生了什么。用函数的完整开头编辑。我已经编辑了我的答案。当你解析使最新返回为未定义的tweet时,你应该使用
full_text
//Parse the tweet
var latest = new String(tweets[i].full_text);