- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在 Twitter 上,您只能发布适合 140 个字符的帖子。这包括您在推特上的句柄:@handle
.当试图在更大的群体中发推文时,这会产生问题。为了为我的篮球队创建一个解决方法,我正在尝试创建一个推特机器人,当它在推特上发送时,它会从推文中获取文本,然后发送一系列推文@团队中每个人的句柄。
我从 this tutorial 的代码开始.然后我编辑了 Wolfram Alpha 的东西并想出了这个代码开始:( key 和 secret 真的不是 xxxxx)
/** ScotsTeamRetweeter **/
/** ======================================= **/
/** Written by John Holland
/** Taken from: Amit Agarwal @labnol on 10/09/2013 **/
/** Tutorial link: http://www.labnol.org/?p=27902 **/
function start() {
Logger.log("Did actually start");
// REPLACE THESE DUMMY VALUES
var TWITTER_CONSUMER_KEY = "XXXXXX";
var TWITTER_CONSUMER_SECRET = "XXXXXX";
var TWITTER_HANDLE = "ScotsTeam";
// Store variables
ScriptProperties.setProperty("TWITTER_CONSUMER_KEY", TWITTER_CONSUMER_KEY);
ScriptProperties.setProperty("TWITTER_CONSUMER_SECRET", TWITTER_CONSUMER_SECRET);
ScriptProperties.setProperty("TWITTER_HANDLE", TWITTER_HANDLE);
ScriptProperties.setProperty("MAX_TWITTER_ID", 0);
// Delete exiting triggers, if any
var triggers = ScriptApp.getScriptTriggers();
for(var i=0; i < triggers.length; i++) {
ScriptApp.deleteTrigger(triggers[i]);
}
// Setup trigger to read Tweets every five minutes
ScriptApp.newTrigger("fetchTweets")
.timeBased()
.everyMinutes(1)
.create();
}
function oAuth() {
var oauthConfig = UrlFetchApp.addOAuthService("twitter");
oauthConfig.setAccessTokenUrl("https://api.twitter.com/oauth/access_token");
oauthConfig.setRequestTokenUrl("https://api.twitter.com/oauth/request_token");
oauthConfig.setAuthorizationUrl("https://api.twitter.com/oauth/authorize");
oauthConfig.setConsumerKey(ScriptProperties.getProperty("TWITTER_CONSUMER_KEY"));
oauthConfig.setConsumerSecret(ScriptProperties.getProperty("TWITTER_CONSUMER_SECRET"));
}
function fetchTweets() {
oAuth();
var twitter_handle = ScriptProperties.getProperty("TWITTER_HANDLE");
var phrase = "lang:en+to:" + twitter_handle;
var search = "https://api.twitter.com/1.1/search/tweets.json?count=5&include_entities=false&result_type=recent&q=";
search = search + encodeString(phrase) + "&since_id=" + ScriptProperties.getProperty("MAX_TWITTER_ID");
var options =
{
"method": "get",
"oAuthServiceName":"twitter",
"oAuthUseToken":"always"
};
try {
var result = UrlFetchApp.fetch(search, options);
if (result.getResponseCode() === 200) {
var data = Utilities.jsonParse(result.getContentText());
if (data) {
var tweets = data.statuses;
for (var i=tweets.length-1; i>=0; i--) {
var question = tweets[i].text.replace(new RegExp("\@" + twitter_handle, "ig"), "");
var answer = "Looks Like it worked"
sendTweet(tweets[i].user.screen_name, tweets[i].id_str, answer);
Logger.log("Tweet should have sent");
}
}
}
} catch (e) {
Logger.log(e.toString());
}
}
function sendTweet(user, reply_id, tweet) {
var options =
{
"method": "POST",
"oAuthServiceName":"twitter",
"oAuthUseToken":"always"
};
var status = "https://api.twitter.com/1.1/statuses/update.json";
status = status + "?status=" + encodeString("@" + user + " " + tweet);
status = status + "&in_reply_to_status_id=" + reply_id;
try {
var result = UrlFetchApp.fetch(status, options);
ScriptProperties.setProperty("MAX_TWITTER_ID", reply_id);
Logger.log(result.getContentText());
}
catch (e) {
Logger.log(e.toString());
}
}
function encodeString (q) {
// Update: 09/06/2013
// Google Apps Script is having issues storing oAuth tokens with the Twitter API 1.1 due to some encoding issues.
// Hence this workaround to remove all the problematic characters from the status message.
var str = q.replace(/\(/g,'{').replace(/\)/g,'}').replace(/\[/g,'{').replace(/\]/g,'}').replace(/\!/g, '|').replace(/\*/g, 'x').replace(/\'/g, '');
return encodeURIComponent(str);
// var str = encodeURIComponent(q);
// str = str.replace(/!/g,'%21');
// str = str.replace(/\*/g,'%2A');
// str = str.replace(/\(/g,'%28');
// str = str.replace(/\)/g,'%29');
// str = str.replace(/'/g,'%27');
// return str;
}
Your script, ScotsTeamRetweeter, has recently failed to finish successfully. A summary of the failure(s) is shown below. To configure the triggers for this script, or change your setting for receiving future failure notifications, click here.
Summary:
Error Message Count
Authorization is required to perform that action. 18
Details:
Start Function Error Message Trigger End
10/9/13 9:11 PM fetchTweets Authorization is required to perform that action. time-based 10/9/13 9:11 PM
10/9/13 9:12 PM fetchTweets Authorization is required to perform that action. time-based 10/9/13 9:12 PM
10/9/13 9:13 PM fetchTweets Authorization is required to perform that action. time-based 10/9/13 9:13 PM
10/9/13 9:14 PM fetchTweets Authorization is required to perform that action. time-based 10/9/13 9:14 PM
10/9/13 9:15 PM fetchTweets Authorization is required to perform that action. time-based 10/9/13 9:15 PM
10/9/13 9:16 PM fetchTweets Authorization is required to perform that action. time-based 10/9/13 9:16 PM
10/9/13 9:17 PM fetchTweets Authorization is required to perform that action. time-based 10/9/13 9:17 PM
10/9/13 9:18 PM fetchTweets Authorization is required to perform that action. time-based 10/9/13 9:18 PM
10/9/13 9:19 PM fetchTweets Authorization is required to perform that action. time-based 10/9/13 9:19 PM
10/9/13 9:20 PM fetchTweets Authorization is required to perform that action. time-based 10/9/13 9:20 PM
10/9/13 9:21 PM fetchTweets Authorization is required to perform that action. time-based 10/9/13 9:21 PM
10/9/13 9:22 PM fetchTweets Authorization is required to perform that action. time-based 10/9/13 9:22 PM
10/9/13 9:23 PM fetchTweets Authorization is required to perform that action. time-based 10/9/13 9:23 PM
10/9/13 9:24 PM fetchTweets Authorization is required to perform that action. time-based 10/9/13 9:24 PM
10/9/13 9:25 PM fetchTweets Authorization is required to perform that action. time-based 10/9/13 9:25 PM
10/9/13 9:26 PM fetchTweets Authorization is required to perform that action. time-based 10/9/13 9:26 PM
10/9/13 9:27 PM fetchTweets Authorization is required to perform that action. time-based 10/9/13 9:27 PM
10/9/13 9:28 PM fetchTweets Authorization is required to perform that action. time-based 10/9/13 9:28 PM
最佳答案
您需要进入脚本编辑器并直接调用您的函数。 (播放按钮)。
之后,它会向您显示一个授权屏幕,之后一切都会好起来的。
关于twitter - TweetBot Retweeter 授权失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19323996/
适用于 iOS 的 Tweetbot 和 Kickstarter 在具有横幅图像的用户个人资料上使用了一项很酷的功能。如果您在 tableView 上下拉,图像会缩放。 我使用下面的方法让它部分工作,
在 Twitter 上,您只能发布适合 140 个字符的帖子。这包括您在推特上的句柄:@handle .当试图在更大的群体中发推文时,这会产生问题。为了为我的篮球队创建一个解决方法,我正在尝试创建一个
我不知道如何创建一个带有相机按钮的文本字段,如屏幕截图中的按钮。 是否有任何开源项目可以创建这样的用户界面? 最佳答案 我认为您处理这个问题的方式是错误的。对我来说,这看起来像一个 UITextVie
使用 URL 方案是否可以从我的 iOS 应用程序打开 Tweetbot 并创建带有图像的帖子?我看过this page也许我只是想念它,但我所能看到的就是创建一个包含如下文本的帖子:tweetbot
我正在尝试重现 Mac 版最后一个 Tweetbot 的窗口捕捉/合并功能。如果您有 2 个窗口,并且将其中一个靠近另一个,它们就会对齐并合并在一个窗口中。 你知道我该怎么做吗? 谢谢 最佳答案 In
当用户点击表格行时,我一直试图让 Tweetbot 打开一个用户帐户。但是,尽管 Tweetbot 已打开,但它并未显示用户帐户。我一直在使用 Tweetbot URL Scheme page作为引用
我想复制一个类似导航栏的 Tweetbot。 我仍在搜索是否可以将 UIButton 放置在 UINavigationBar 栏 and 中的标题位置,以使其完美适合右侧和左键就像在 Tweetbot
有谁知道如何实现当前 View Controller 的 View 缩小并透明地放置另一个 View ?在 Tweetbot 3 中点击导航栏左上角的头像即可实现。例如,我应该拍摄快照吗? 最佳答案
我想制作一个像这样的NSWindow。我该怎么做? 抱歉,如果这是一个菜鸟问题,但我正在弄清楚。 最佳答案 像这样隐藏标题栏: [myWindow setStyleMask:NSBorderlessW
我可以使用任何 Cocoa Pod 来实现像下面的 Instagram Tweetbot 这样的自动关闭弹出窗口吗? 或者我需要自己继承UIView来完成? 谢谢 最佳答案 您显示的屏幕截图实际上来自
您在下面看到的是 Tweetbot iPhone application 的屏幕截图.我想问的是,如果您知道我可以实现 Tapbots 人员在他们的 tableView 中实现的目标的方法:您点击前
我正在尝试创建一个与 Tweetbot 非常相似的搜索 View Controller ,其中向搜索栏添加文本会在 tableView 中插入一个新部分和新行, like so . 我尝试使用 sea
“TweetBot”应用程序在每个单元格下方都有一个下拉菜单,点击单元格时会出现该菜单。菜单显示为不同的单元格,直接位于点击的单元格下方。这是一个(相当大的)屏幕截图,以使其更加清晰: 这个界面创意非
我对 UIPageViewController 有点陌生我读过的所有教程都展示了如何将它与完整的 View Controller 一起使用,你可以在其中滑动它们。是否可以将其呈现在现有的 View C
在新的 Tweetbot 应用程序中,图像可以向各个方向“抛出”以关闭它们。在 Facebook 的应用程序中,您可以将其下拉或向上拉以将其关闭。 我很好奇这种效果是如何实现的。我正在使用 UIScr
我是一名优秀的程序员,十分优秀!