summaryrefslogtreecommitdiff
path: root/desk/sur/twatter/json.hoon
blob: 476508bcbb66c9eb85de2605049a054af04a2bd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
=,  dejs-soft:format
|%
++  username
%-  ot  :_  ~  :-  'data'
%-  ot  :_  ~  :-  'user'
%-  ot  :_  ~  :-  'result'
%-  ot  
  :~  ::  :-  '__typename'  so
      :: :-  'id'          so
      :-  'rest_id'          so
      :: :-  'profile_image_shape'      so
      :: :-  'is_profile-translatable'  bo
      :: :-  'is_blue_verified'         bo
      :: :-  'has_graduated_access'     bo
      :: :-  'is_profile-translatable'  bo
      :: :-  'creator_subscriptions_count'     ni
      :: :-  'legacy_extended_profile'     so  ::  empty objects
      :: :-  'verification_info'     so
      :: :-  'business_account'     so
      :: :-  'affiliates_highlighted_label'     so
      :: :-  'legacy'     %-  ot
      ::   :~  :-  'can-dm'  bo
            :: :-  'can-media-tag'  bo
            :: :-  'can-media-tag'  bo
            :: :-  'default_profile'  bo
            :: :-  'default_profile_image'  bo
            :: :-  'has_custom_timelines'  bo
            :: :-  'is_translator'  bo
            :: :-  'possibly_sensitive'  bo
            :: :-  'verified'  bo
            :: :-  'want_retweets'  bo
            :: :-  'fast_followers_count'  ni
            :: :-  'favourites_count'  ni
            :: :-  'followers_count'  ni
            :: :-  'friends_count'  ni
            :: :-  'listed_count'  ni
            :: :-  'media_count'  ni
            :: :-  'normal_followers_count'  ni
            :: :-  'statuses_count'  ni
            :: :-  'description'  so
            :: :-  'location'  so
            :: :-  'name'  so
            :: :-  'profile_banner_url'  so
            :: :-  'profile_image_url_https'  so
            :: :-  'screen_name'  so
            :: :-  'profile_interstitial_type'  so  :: mmm
            :: :-  'translator_type'  so
            :: :-  'pinned_tweets_ids_str'  (ar so)
            :: :-  'withheld_in_countries'  (ar so)
            :: :-  'entities'  %-  ot
            ::   :~  :-  'description'  %-  ot
            ::     :~  :-  'urls'  (ar so)
            ::     ==
            ::   ==
        :: ==
  ==
++  user-tweets
=,  dejs-soft:format
%-  ot  :_  ~  :-  'data'
%-  ot  :_  ~  :-  'user'
%-  ot  :_  ~  :-  'result'
%-  ot  
  :~  :-  '__typename'  so
      :-  'timeline_v2'  %-  ot  :_  ~
      :-  'timeline'     %-  ot  
    :~  :-  'metadata'   %-  ot  ~
        :-  'instructions'  (ar instruction)  
    ==
  ==
++  instruction
|=  jon=json
  :: ?>(%o -.jon)
  =/  type  (~(got by p.jon) 'type')
  ?:  .=([%s 'TimelineClearCache'] type)  ((ot ~) jon)
  ?:  .=([%s 'TimelinePinEntry'] type)    ((ot timeline-pin-entry) jon)
  ?:  .=([%s 'TimelineAddEntries'] type)  ((ot timeline-add-entries) jon)
  !!
  
:~  :-  'TimelinePinEntry'    timeline-pin-entry
    :-  'TimelineAddEntries'  timeline-add-entries
==

++  timeline-pin-entry
%-  ot
:~  :-  'type'  so  
    :-  'entry'  %-  ot
  :~  :-  'entryId'  so
      :-  'sortIndex'  so
      :-  'content'  content
  ==
==
++  timeline-add-entries
so
++  content  
%-  ot
:~  :-  'entryType'   so
    :-  '__typename'  so
    :-  'itemContent'  item-content
    :-  'clientEventInfo'  client-event-info
==
++  item-content
so
++  client-event-info
so
--