Instagram自动点赞
自动为你Instagram上关注的一个或几个朋友发布的新照片点赞
1. 注册成为[Instagram Developer](http://instagram.com/developer). Register Client 获得Client ID 和 Client Secret.
2. 在[Google App Engine](https://appengine.google.com/)上新建一个Application.
3. 调用Instagram的API 实现点赞功能。首先在[Jelled](http://jelled.com/instagram/lookup-user-id)上获得需要关注点赞用户的UserID. 获得用户的info, 然后找到用户最新发布的一张照片,判断是否已经点赞,若是没有,则调用like的API点赞。将整个脚本用GAE支持的webapp2 RequestHandler实现get和post。我用的是Instagram的 Media Endpoints 和 Like Endpoints API.
https://api.instagram.com/v1/users/UserID/media/recent/?access_token=ACCESS-TOKEN&count=1
返回的是Json数据,从返回的数据中得到mediaID,也就是关注用户最新照片的ID。然后like这张图片。
setLike_req = "https://api.instagram.com/v1/media/%s/likes" %(mi)
values = {'access_token':ACCESS_TOKEN}
setLike_return = json.loads(urllib2.urlopen(urllib2.Request(setLike_req,urllib.urlencode(values))).read())
application: your-app-id
version: 1
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /.*
  script: likeinsta.application
cron: 
- description: main job 
  url: /likeinsta 
  schedule: every 1 mins 
Useful link: python-instagram
Related: 为女神微博点赞
 
No comments:
Post a Comment