Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问有没有将Twitter里点赞的视频保存到Google drive的ifttt吗? #17

Open
xyoungleo opened this issue Nov 29, 2018 · 12 comments

Comments

@xyoungleo
Copy link

我用Google搜索了2个ifttt,不过都是将Twitter的文字保存起来的,但是不能保存视频。

@gonejack
Copy link
Owner

#5

可以考虑,但目前没什么时间。

@xyoungleo
Copy link
Author

我也会点编程,不过是自学的,需不需要我来协助你做点什么呢?

@gonejack
Copy link
Owner

服务本身做起来倒是简单,需要看看API支持得怎样。

@xyoungleo
Copy link
Author

好的,那我先找找看Twitter的API信息。

@xyoungleo
Copy link
Author

我找到了这3个资料

资料1:
http://www.voidcn.com/article/p-tmrsasdp-btt.html

Tweet Entities是你正在寻找访问图片.实体提供来自Tweets的结构化数据,包括扩展的URL和媒体URL.它们位于Twitter REST和Streaming API的所有Tweet对象中的实体属性下.
因此,为了回答您的问题,如果Tweet包含一张照片,其网址将位于此处:

$media_url = $result->entities->media[0]->media_url;
以下是可以添加到现有foreach循环中的PHP代码片段,无论Tweet是否包含媒体URL,这都是一个更加细致的处理方式:

if (isset($result->entities->media)) {
foreach ($result->entities->media as $media) {
$media_url = $media->media_url; // Or $media->media_url_https for the SSL version.
}
}

资料2:
https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-show-id

"entities": {
  "url": {
    "urls": [
      {
        "expanded_url": null,
        "url": "",
        "indices": [
          0,
          22
        ]
      }
    ]
  },
  "description": {
    "urls": [

    ]
  }
},

资料3:
少数派提供的shortcut,可以直接在twitter分享中调用。
https://www.icloud.com/shortcuts/bea16bb81d1c403b8eb49e29cb00f205

因为我不会php,对资料1和2看的不是很明白,不知道是否有用。

@gonejack
Copy link
Owner

gonejack commented Dec 4, 2018

谢谢,我会尽快查看。

@gonejack
Copy link
Owner

在查看中,看到 API 限制挺多,可能不会做成服务而做成下载脚本。

@xyoungleo
Copy link
Author

下载脚本就不用ifttt了,改用其他程序了么?

@xyoungleo
Copy link
Author

https://blog.csdn.net/zhurui_idea/article/details/56481382

#导入tweepy
import tweepy
 
#填写twitter提供的开发Key和secret
consumer_key = 'xxxxxxxxxxxxxxxxx'
consumer_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxx'
access_token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
access_token_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
 
#提交你的Key和secret
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
 
#获取类似于内容句柄的东西
api = tweepy.API(auth)
 
#打印我自己主页上的时间轴里的内容
public_tweets = api.home_timeline()
for tweet in public_tweets:
    print tweet.text

发现这个方法,看起来还挺简单,不过是python语言的。

@DoubleShift
Copy link

找到了吗

@gonejack
Copy link
Owner

当时已看过,API路线不太行,twitter没有那么开放API。解析网页的话,相关的安卓和iOS快捷方式挺多的,浏览器扩展也不少,没什么必要了。

@DoubleShift
Copy link

当时已看过,API路线不太行,twitter没有那么开放API。解析网页的话,相关的安卓和iOS快捷方式挺多的,浏览器扩展也不少,没什么必要了。

能给个安卓或者浏览器的app么,我找了半天还是个python脚本,想那种点赞能存到google的,gmail也行,百度也行。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants