TwitterAPIを使い始めてみました
ある程度インスタのアプリが完成しつつあるので、
インスタ側に追加データのリクエストを申請し、あとは審査待ち。
その間にTwitterのアプリの方も手を付けようと思い、
あるサイトを参考にしてみた結果、Twitterから得られるjsonが複雑すぎてわろてる。
参考URL:
{
- statuses:[
- 0:{
- created_at:Sun Jun 13 08:00:02 +0000 2021
- id:1403985497861599200
- id_str:1403985497861599234
- text:Day 164 Journey of ACIM Text Chapter 13: XI. 1-5 https://t.co/FQBnvnQUkl #acim #acimtext ACIM LESSON 164 Meditatio… https://t.co/FMOovu8Bqt
- truncated:true
- entities:{
- hashtags:[ ]
- symbols:
- user_mentions:
- urls:[
- 0:{
- url:https://t.co/FQBnvnQUkl
- expanded_url:https://youtu.be/vsiBSTniF4Y
- display_url:youtu.be/vsiBSTniF4Y
- indices:[
- 0:49
- 1:72
- 1:{
- url:https://t.co/FMOovu8Bqt
- expanded_url:https://twitter.com/i/web/status/1403985497861599234
- display_url:twitter.com/i/web/status/1…
- indices:[
- 0:117
- 1:140
- 0:{
- metadata:{
- iso_language_code:en
- result_type:recent
- source:<a href="https://www.ripl.com" rel="nofollow">Ripl App</a>
- in_reply_to_status_id:null
- in_reply_to_status_id_str:null
- in_reply_to_user_id:null
- in_reply_to_user_id_str:null
- in_reply_to_screen_name:null
- user:{
- id:35742622
- id_str:35742622
- name:Maureen L. Yarbrough
- screen_name:momohere
- location:Florida, USA
- description:Training in forgiveness. Educator. Life Care Services. ❤️ Ordained Minister Wedding & Funeral Officiator ❤️ Certified End of Life Doula
- url:https://t.co/FxxCj0DsmT
- entities:{
- url:{
- urls:[
- 0:{
- url:https://t.co/FxxCj0DsmT
- expanded_url:https://www.facebook.com/tismomo
- display_url:facebook.com/tismomo
- indices:[
- 0:0
- 1:23
- 0:{
- urls:[
- description:{
- urls:
- url:{
- protected:false
- followers_count:634
- friends_count:957
- listed_count:5
- created_at:Mon Apr 27 13:38:13 +0000 2009
- favourites_count:178
- utc_offset:null
- time_zone:null
- geo_enabled:true
- verified:false
- statuses_count:12722
- lang:null
- contributors_enabled:false
- is_translator:false
- is_translation_enabled:false
- profile_background_color:AADAAD
- profile_background_image_url:http://abs.twimg.com/images/themes/theme1/bg.png
- profile_background_image_url_https:https://abs.twimg.com/images/themes/theme1/bg.png
- profile_background_tile:true
- profile_image_url:http://pbs.twimg.com/profile_images/1281365824561971202/8-Audlty_normal.jpg
- profile_image_url_https:https://pbs.twimg.com/profile_images/1281365824561971202/8-Audlty_normal.jpg
- profile_banner_url:https://pbs.twimg.com/profile_banners/35742622/1594336395
- profile_link_color:55A16F
- profile_sidebar_border_color:0B2C04
- profile_sidebar_fill_color:116E4F
- profile_text_color:279247
- profile_use_background_image:true
- has_extended_profile:true
- default_profile:false
- default_profile_image:false
- following:false
- follow_request_sent:false
- notifications:false
- translator_type:none
- withheld_in_countries:
- geo:null
- coordinates:null
- place:null
- contributors:null
- is_quote_status:false
- retweet_count:0
- favorite_count:0
- favorited:false
- retweeted:false
- possibly_sensitive:false
- lang:en
- 0:{
例のごとく検索ワードは「オードリー」
するとjsonの相当深い第一層目が取得できた。。。インスタとは大違いだ。
今からこれの解読作業に移る。
{ …jsonの中身
created_at …日付
id …投稿id?(どうやって使うんだ...?)
id_str …投稿id?とは別のid。本物の投稿idか?(※こっち側をURLに埋め込むと該当ツイートに飛べる)
text …本文
truncated …?
text …ハッシュタグの文字
- 0:108
- 1:113
user:{
- id:940735939352997900
- id_str:940735939352997888
- name:もこ
- screen_name:moko030421
- location:日本
- description:松井珠理奈ちゃんを応援します😊無言でリツィート、いいねさせてもらいます。 初心者なので、迷惑をかけてしまったらすみません。
- url:null
- entities:{
- description:{
- urls:[]
- description:{
- followers_count:62
- friends_count:70
- statuses_count:24343 …ツイート数