ohmuraken / vacatter

Application for enjoying Twitter
https://www.youtube.com/watch?v=1cfKaH7gLkY&feature=youtu.be&t=4742
1 stars 0 forks source link

TwitterAPIの開発者登録とTimelineの取得 #39

Closed ohmuraken closed 7 years ago

ohmuraken commented 7 years ago
ohmuraken commented 7 years ago

TwitterAPIの処理Tips

tweets = api.home_timeline(count=20) for tweet in tweets: if "extended_entities" in tweet._json.keys(): # 画像が複数枚(最大4枚) print([media["media_url_https"] for media in tweets._json["extended_entities"]["media"]]) elif "media" in tweet._json["entities"].keys(): # 画像が1枚 print([tweets._json["extended_entites"]["media"][0]["media_url_https"]]) else: # 画像を持たない print("no media")


- リツイートによりタイムラインに出現しているツイートかどうか
```python3:sample.py
tweets = api.home_timeline(count=20)
for tweet in tweets:
    if "retweeted_status" in tweet._json.keys():
        print("リツイートにより出現")
ohmuraken commented 7 years ago

開発者登録を行い, Timelineの取得や扱い方についても主な調査が終わったので閉じます.