line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::SinaWeibo; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
4
|
|
|
4
|
|
79133
|
$Net::SinaWeibo::VERSION = '0.003'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
# ABSTRACT: A simple and lightweight OAuth api for SinaWeibo |
6
|
4
|
|
|
4
|
|
38
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
277
|
|
7
|
4
|
|
|
4
|
|
22
|
use warnings; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
134
|
|
8
|
4
|
|
|
4
|
|
20
|
use base 'Net::SinaWeibo::OAuth'; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
2125
|
|
9
|
4
|
|
|
4
|
|
31
|
use JSON; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
24
|
|
10
|
|
|
|
|
|
|
use constant { |
11
|
4
|
|
|
|
|
4365
|
SINA_SITE => 'http://api.t.sina.com.cn/', |
12
|
|
|
|
|
|
|
SINA_REQUEST_TOKEN_URL => 'http://api.t.sina.com.cn/oauth/request_token', |
13
|
|
|
|
|
|
|
SINA_AUTHORIZATION_URL => 'http://api.t.sina.com.cn/oauth/authorize', |
14
|
|
|
|
|
|
|
SINA_ACCESS_TOKEN_URL => 'http://api.t.sina.com.cn/oauth/access_token', |
15
|
|
|
|
|
|
|
SINA_FORMAT => 'json', |
16
|
4
|
|
|
4
|
|
614
|
}; |
|
4
|
|
|
|
|
16
|
|
17
|
|
|
|
|
|
|
# SINA SDK API |
18
|
|
|
|
|
|
|
our %SINA_API = ( |
19
|
|
|
|
|
|
|
public_timeline => { |
20
|
|
|
|
|
|
|
uri => 'statuses/public_timeline', |
21
|
|
|
|
|
|
|
method => 'GET', |
22
|
|
|
|
|
|
|
restricted => 0, |
23
|
|
|
|
|
|
|
}, |
24
|
|
|
|
|
|
|
home_timeline => { |
25
|
|
|
|
|
|
|
uri => 'statuses/public_timeline', |
26
|
|
|
|
|
|
|
method => 'GET', |
27
|
|
|
|
|
|
|
restricted => 0, |
28
|
|
|
|
|
|
|
}, |
29
|
|
|
|
|
|
|
friends_timeline => { |
30
|
|
|
|
|
|
|
uri => 'statuses/friends_timeline', |
31
|
|
|
|
|
|
|
method => 'GET', |
32
|
|
|
|
|
|
|
restricted => 1, |
33
|
|
|
|
|
|
|
}, |
34
|
|
|
|
|
|
|
user_timeline => { |
35
|
|
|
|
|
|
|
uri => 'statuses/user_timeline', |
36
|
|
|
|
|
|
|
method => 'GET', |
37
|
|
|
|
|
|
|
restricted => 1, |
38
|
|
|
|
|
|
|
}, |
39
|
|
|
|
|
|
|
mentions => { |
40
|
|
|
|
|
|
|
uri => 'statuses/mentions', |
41
|
|
|
|
|
|
|
method => 'GET', |
42
|
|
|
|
|
|
|
restricted => 1, |
43
|
|
|
|
|
|
|
}, |
44
|
|
|
|
|
|
|
comments_timeline => { |
45
|
|
|
|
|
|
|
uri => 'statuses/comments_timeline', |
46
|
|
|
|
|
|
|
method => 'GET', |
47
|
|
|
|
|
|
|
restricted => 1, |
48
|
|
|
|
|
|
|
}, |
49
|
|
|
|
|
|
|
comments_by_me => { |
50
|
|
|
|
|
|
|
uri => 'statuses/comments_by_me', |
51
|
|
|
|
|
|
|
method => 'GET', |
52
|
|
|
|
|
|
|
restricted => 1, |
53
|
|
|
|
|
|
|
}, |
54
|
|
|
|
|
|
|
comments_to_me => { |
55
|
|
|
|
|
|
|
uri => 'statuses/comments_to_me', |
56
|
|
|
|
|
|
|
method => 'GET', |
57
|
|
|
|
|
|
|
restricted => 1, |
58
|
|
|
|
|
|
|
}, |
59
|
|
|
|
|
|
|
comments => { |
60
|
|
|
|
|
|
|
uri => 'statuses/comments', |
61
|
|
|
|
|
|
|
method => 'GET', |
62
|
|
|
|
|
|
|
restricted => 1, |
63
|
|
|
|
|
|
|
}, |
64
|
|
|
|
|
|
|
status_counts => { |
65
|
|
|
|
|
|
|
uri => 'statuses/counts', |
66
|
|
|
|
|
|
|
method => 'GET', |
67
|
|
|
|
|
|
|
restricted => 1, |
68
|
|
|
|
|
|
|
}, |
69
|
|
|
|
|
|
|
status_unread => { |
70
|
|
|
|
|
|
|
uri => 'statuses/unread', |
71
|
|
|
|
|
|
|
method => 'GET', |
72
|
|
|
|
|
|
|
restricted => 1, |
73
|
|
|
|
|
|
|
}, |
74
|
|
|
|
|
|
|
status_reset_count => { |
75
|
|
|
|
|
|
|
uri => 'statuses/reset_count', |
76
|
|
|
|
|
|
|
method => 'POST', |
77
|
|
|
|
|
|
|
restricted => 1, |
78
|
|
|
|
|
|
|
}, |
79
|
|
|
|
|
|
|
emotions => { |
80
|
|
|
|
|
|
|
uri => 'statuses/emotions', |
81
|
|
|
|
|
|
|
method => 'GET', |
82
|
|
|
|
|
|
|
restricted => 0, |
83
|
|
|
|
|
|
|
}, |
84
|
|
|
|
|
|
|
show_status => { |
85
|
|
|
|
|
|
|
uri => 'statuses/show', |
86
|
|
|
|
|
|
|
method => 'GET', |
87
|
|
|
|
|
|
|
restricted => 1, |
88
|
|
|
|
|
|
|
}, |
89
|
|
|
|
|
|
|
post_status => { |
90
|
|
|
|
|
|
|
uri => 'statuses/update', |
91
|
|
|
|
|
|
|
method => 'POST', |
92
|
|
|
|
|
|
|
restricted => 1, |
93
|
|
|
|
|
|
|
}, |
94
|
|
|
|
|
|
|
upload_status => { |
95
|
|
|
|
|
|
|
uri => 'statuses/upload', |
96
|
|
|
|
|
|
|
method => 'POST', |
97
|
|
|
|
|
|
|
restricted => 1, |
98
|
|
|
|
|
|
|
multi_part => 'pic', |
99
|
|
|
|
|
|
|
}, |
100
|
|
|
|
|
|
|
remove_status => { |
101
|
|
|
|
|
|
|
uri => 'statuses/destroy', |
102
|
|
|
|
|
|
|
method => 'POST', |
103
|
|
|
|
|
|
|
restricted => 1, |
104
|
|
|
|
|
|
|
}, |
105
|
|
|
|
|
|
|
repost_status => { |
106
|
|
|
|
|
|
|
uri => 'statuses/repost', |
107
|
|
|
|
|
|
|
method => 'POST', |
108
|
|
|
|
|
|
|
restricted => 1, |
109
|
|
|
|
|
|
|
}, |
110
|
|
|
|
|
|
|
retweet => { |
111
|
|
|
|
|
|
|
uri => 'statuses/repost', |
112
|
|
|
|
|
|
|
method => 'POST', |
113
|
|
|
|
|
|
|
restricted => 1, |
114
|
|
|
|
|
|
|
}, |
115
|
|
|
|
|
|
|
post_comment => { |
116
|
|
|
|
|
|
|
uri => 'statuses/comment', |
117
|
|
|
|
|
|
|
method => 'POST', |
118
|
|
|
|
|
|
|
restricted => 1, |
119
|
|
|
|
|
|
|
}, |
120
|
|
|
|
|
|
|
remove_comment => { |
121
|
|
|
|
|
|
|
uri => 'statuses/comment_destroy', |
122
|
|
|
|
|
|
|
method => 'POST', |
123
|
|
|
|
|
|
|
restricted => 1, |
124
|
|
|
|
|
|
|
}, |
125
|
|
|
|
|
|
|
batch_remove_comments => { |
126
|
|
|
|
|
|
|
uri => 'statuses/comment/destroy_batch', |
127
|
|
|
|
|
|
|
method => 'POST', |
128
|
|
|
|
|
|
|
restricted => 1, |
129
|
|
|
|
|
|
|
}, |
130
|
|
|
|
|
|
|
reply_comment => { |
131
|
|
|
|
|
|
|
uri => 'statuses/reply', |
132
|
|
|
|
|
|
|
method => 'POST', |
133
|
|
|
|
|
|
|
restricted => 1, |
134
|
|
|
|
|
|
|
}, |
135
|
|
|
|
|
|
|
hot_users => { |
136
|
|
|
|
|
|
|
uri => 'users/hot', |
137
|
|
|
|
|
|
|
method => 'GET', |
138
|
|
|
|
|
|
|
restricted => 1, |
139
|
|
|
|
|
|
|
}, |
140
|
|
|
|
|
|
|
show_user => { |
141
|
|
|
|
|
|
|
uri => 'users/show', |
142
|
|
|
|
|
|
|
method => 'GET', |
143
|
|
|
|
|
|
|
restricted => 1, |
144
|
|
|
|
|
|
|
}, |
145
|
|
|
|
|
|
|
friends => { |
146
|
|
|
|
|
|
|
uri => 'statuses/friends', |
147
|
|
|
|
|
|
|
method => 'GET', |
148
|
|
|
|
|
|
|
restricted => 1, |
149
|
|
|
|
|
|
|
}, |
150
|
|
|
|
|
|
|
followers => { |
151
|
|
|
|
|
|
|
uri => 'statuses/followers', |
152
|
|
|
|
|
|
|
method => 'GET', |
153
|
|
|
|
|
|
|
restricted => 1, |
154
|
|
|
|
|
|
|
}, |
155
|
|
|
|
|
|
|
dm => { |
156
|
|
|
|
|
|
|
uri => 'direct_messages', |
157
|
|
|
|
|
|
|
method => 'GET', |
158
|
|
|
|
|
|
|
restricted => 1, |
159
|
|
|
|
|
|
|
}, |
160
|
|
|
|
|
|
|
dm_sent => { |
161
|
|
|
|
|
|
|
uri => 'direct_messages/sent', |
162
|
|
|
|
|
|
|
method => 'GET', |
163
|
|
|
|
|
|
|
restricted => 1, |
164
|
|
|
|
|
|
|
}, |
165
|
|
|
|
|
|
|
send_dm => { |
166
|
|
|
|
|
|
|
uri => 'direct_messages/new', |
167
|
|
|
|
|
|
|
method => 'POST', |
168
|
|
|
|
|
|
|
restricted => 1, |
169
|
|
|
|
|
|
|
}, |
170
|
|
|
|
|
|
|
remove_dm => { |
171
|
|
|
|
|
|
|
uri => 'direct_messages/destroy', |
172
|
|
|
|
|
|
|
method => 'POST', |
173
|
|
|
|
|
|
|
restricted => 1, |
174
|
|
|
|
|
|
|
}, |
175
|
|
|
|
|
|
|
batch_remove_dm => { |
176
|
|
|
|
|
|
|
uri => 'direct_messages/destroy_batch', |
177
|
|
|
|
|
|
|
method => 'POST', |
178
|
|
|
|
|
|
|
restricted => 1, |
179
|
|
|
|
|
|
|
}, |
180
|
|
|
|
|
|
|
follow => { |
181
|
|
|
|
|
|
|
uri => 'friendships/create', |
182
|
|
|
|
|
|
|
method => 'POST', |
183
|
|
|
|
|
|
|
restricted => 1, |
184
|
|
|
|
|
|
|
}, |
185
|
|
|
|
|
|
|
unfollow => { |
186
|
|
|
|
|
|
|
uri => 'friendships/destroy', |
187
|
|
|
|
|
|
|
method => 'POST', |
188
|
|
|
|
|
|
|
restricted => 1, |
189
|
|
|
|
|
|
|
}, |
190
|
|
|
|
|
|
|
is_followed => { |
191
|
|
|
|
|
|
|
uri => 'friendships/show', |
192
|
|
|
|
|
|
|
method => 'GET', |
193
|
|
|
|
|
|
|
restricted => 1, |
194
|
|
|
|
|
|
|
}, |
195
|
|
|
|
|
|
|
get_friends_id_list => { |
196
|
|
|
|
|
|
|
uri => 'friends/ids', |
197
|
|
|
|
|
|
|
method => 'GET', |
198
|
|
|
|
|
|
|
restricted => 1, |
199
|
|
|
|
|
|
|
}, |
200
|
|
|
|
|
|
|
get_followers_id_list => { |
201
|
|
|
|
|
|
|
uri => 'followers/ids', |
202
|
|
|
|
|
|
|
method => 'GET', |
203
|
|
|
|
|
|
|
restricted => 1, |
204
|
|
|
|
|
|
|
}, |
205
|
|
|
|
|
|
|
update_privacy => { |
206
|
|
|
|
|
|
|
uri => 'account/update_privacy', |
207
|
|
|
|
|
|
|
method => 'POST', |
208
|
|
|
|
|
|
|
restricted => 1, |
209
|
|
|
|
|
|
|
}, |
210
|
|
|
|
|
|
|
get_privacy => { |
211
|
|
|
|
|
|
|
uri => 'account/get_privacy', |
212
|
|
|
|
|
|
|
method => 'POST', |
213
|
|
|
|
|
|
|
restricted => 1, |
214
|
|
|
|
|
|
|
}, |
215
|
|
|
|
|
|
|
block_user => { |
216
|
|
|
|
|
|
|
uri => 'blocks/create', |
217
|
|
|
|
|
|
|
method => 'POST', |
218
|
|
|
|
|
|
|
restricted => 1, |
219
|
|
|
|
|
|
|
}, |
220
|
|
|
|
|
|
|
unblock_user => { |
221
|
|
|
|
|
|
|
uri => 'blocks/destroy', |
222
|
|
|
|
|
|
|
method => 'POST', |
223
|
|
|
|
|
|
|
restricted => 1, |
224
|
|
|
|
|
|
|
}, |
225
|
|
|
|
|
|
|
is_blocked => { |
226
|
|
|
|
|
|
|
uri => 'blocks/exists', |
227
|
|
|
|
|
|
|
method => 'POST', |
228
|
|
|
|
|
|
|
restricted => 1, |
229
|
|
|
|
|
|
|
}, |
230
|
|
|
|
|
|
|
blocking => { |
231
|
|
|
|
|
|
|
uri => 'blocks/blocking', |
232
|
|
|
|
|
|
|
method => 'GET', |
233
|
|
|
|
|
|
|
restricted => 1, |
234
|
|
|
|
|
|
|
}, |
235
|
|
|
|
|
|
|
blocking_id_list => { |
236
|
|
|
|
|
|
|
uri => 'blocks/blocking/ids', |
237
|
|
|
|
|
|
|
method => 'GET', |
238
|
|
|
|
|
|
|
restricted => 1, |
239
|
|
|
|
|
|
|
}, |
240
|
|
|
|
|
|
|
tags => { |
241
|
|
|
|
|
|
|
uri => 'tags', |
242
|
|
|
|
|
|
|
method => 'GET', |
243
|
|
|
|
|
|
|
restricted => 1, |
244
|
|
|
|
|
|
|
}, |
245
|
|
|
|
|
|
|
add_tag => { |
246
|
|
|
|
|
|
|
uri => 'tags/create', |
247
|
|
|
|
|
|
|
method => 'POST', |
248
|
|
|
|
|
|
|
restricted => 1, |
249
|
|
|
|
|
|
|
}, |
250
|
|
|
|
|
|
|
tag_suggestions => { |
251
|
|
|
|
|
|
|
uri => 'tags/suggestions', |
252
|
|
|
|
|
|
|
method => 'GET', |
253
|
|
|
|
|
|
|
restricted => 1, |
254
|
|
|
|
|
|
|
}, |
255
|
|
|
|
|
|
|
remove_tag => { |
256
|
|
|
|
|
|
|
uri => 'tags/destroy', |
257
|
|
|
|
|
|
|
method => 'POST', |
258
|
|
|
|
|
|
|
restricted => 1, |
259
|
|
|
|
|
|
|
}, |
260
|
|
|
|
|
|
|
batch_remove_tags => { |
261
|
|
|
|
|
|
|
uri => 'tags/destroy_batch', |
262
|
|
|
|
|
|
|
method => 'POST', |
263
|
|
|
|
|
|
|
restricted => 1, |
264
|
|
|
|
|
|
|
}, |
265
|
|
|
|
|
|
|
verify_credentials => { |
266
|
|
|
|
|
|
|
uri => 'account/verify_credentials', |
267
|
|
|
|
|
|
|
method => 'GET', |
268
|
|
|
|
|
|
|
restricted => 1, |
269
|
|
|
|
|
|
|
}, |
270
|
|
|
|
|
|
|
rate_limit_status => { |
271
|
|
|
|
|
|
|
uri => 'account/rate_limit_status', |
272
|
|
|
|
|
|
|
method => 'GET', |
273
|
|
|
|
|
|
|
restricted => 1, |
274
|
|
|
|
|
|
|
}, |
275
|
|
|
|
|
|
|
end_session => { |
276
|
|
|
|
|
|
|
uri => 'account/end_session', |
277
|
|
|
|
|
|
|
method => 'POST', |
278
|
|
|
|
|
|
|
restricted => 1, |
279
|
|
|
|
|
|
|
}, |
280
|
|
|
|
|
|
|
update_profile_image => { |
281
|
|
|
|
|
|
|
uri => 'account/update_profile_image', |
282
|
|
|
|
|
|
|
method => 'POST', |
283
|
|
|
|
|
|
|
restricted => 1, |
284
|
|
|
|
|
|
|
multi_part => 'image', |
285
|
|
|
|
|
|
|
}, |
286
|
|
|
|
|
|
|
update_profile => { |
287
|
|
|
|
|
|
|
uri => 'account/update_profile', |
288
|
|
|
|
|
|
|
method => 'POST', |
289
|
|
|
|
|
|
|
restricted => 1, |
290
|
|
|
|
|
|
|
}, |
291
|
|
|
|
|
|
|
favorites => { |
292
|
|
|
|
|
|
|
uri => 'favorites', |
293
|
|
|
|
|
|
|
method => 'GET', |
294
|
|
|
|
|
|
|
restricted => 1, |
295
|
|
|
|
|
|
|
}, |
296
|
|
|
|
|
|
|
add_favorite => { |
297
|
|
|
|
|
|
|
uri => 'favorites/create', |
298
|
|
|
|
|
|
|
method => 'POST', |
299
|
|
|
|
|
|
|
restricted => 1, |
300
|
|
|
|
|
|
|
}, |
301
|
|
|
|
|
|
|
remove_favorite => { |
302
|
|
|
|
|
|
|
uri => 'favorites/destroy', |
303
|
|
|
|
|
|
|
method => 'POST', |
304
|
|
|
|
|
|
|
restricted => 1, |
305
|
|
|
|
|
|
|
}, |
306
|
|
|
|
|
|
|
batch_remove_favorites => { |
307
|
|
|
|
|
|
|
uri => 'favorites/destroy_batch', |
308
|
|
|
|
|
|
|
method => 'POST', |
309
|
|
|
|
|
|
|
restricted => 1, |
310
|
|
|
|
|
|
|
}, |
311
|
|
|
|
|
|
|
); |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
sub new { |
314
|
0
|
|
|
0
|
1
|
0
|
my $class = shift; |
315
|
0
|
|
|
|
|
0
|
my %args = @_; |
316
|
0
|
|
|
|
|
0
|
my $client = $class->SUPER::new( |
317
|
|
|
|
|
|
|
consumer_key => $args{app_key}, |
318
|
|
|
|
|
|
|
consumer_secret => $args{app_secret}, |
319
|
|
|
|
|
|
|
request_token_path => SINA_REQUEST_TOKEN_URL, |
320
|
|
|
|
|
|
|
access_token_path => SINA_ACCESS_TOKEN_URL, |
321
|
|
|
|
|
|
|
authorize_path => SINA_AUTHORIZATION_URL, |
322
|
|
|
|
|
|
|
tokens => $args{tokens} |
323
|
|
|
|
|
|
|
); |
324
|
0
|
|
|
|
|
0
|
$client; |
325
|
|
|
|
|
|
|
} |
326
|
|
|
|
|
|
|
|
327
|
0
|
|
|
0
|
0
|
0
|
sub app_key { shift->consumer_key } |
328
|
|
|
|
|
|
|
|
329
|
0
|
|
|
0
|
0
|
0
|
sub app_secret { shift->consumer_secret } |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
sub _build_api_proxy_sub { |
332
|
232
|
|
|
232
|
|
261
|
my ($api) = @_; |
333
|
|
|
|
|
|
|
return sub { |
334
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
335
|
0
|
|
|
|
|
0
|
$self->last_api($api->{uri}); |
336
|
0
|
|
|
|
|
0
|
my %params = @_; |
337
|
0
|
|
|
|
|
0
|
my $uri; |
338
|
0
|
0
|
|
|
|
0
|
if (exists $params{id}) { |
339
|
0
|
|
|
|
|
0
|
$uri = $api->{uri}.'/'.(delete $params{id}); |
340
|
|
|
|
|
|
|
} |
341
|
|
|
|
|
|
|
else { |
342
|
0
|
|
|
|
|
0
|
$uri = $api->{uri}; |
343
|
|
|
|
|
|
|
} |
344
|
0
|
0
|
|
|
|
0
|
if ($api->{multi_part}) { |
345
|
0
|
|
|
|
|
0
|
$params{'@'.$api->{multi_part}} = delete $params{ $api->{multi_part} }; |
346
|
|
|
|
|
|
|
} |
347
|
0
|
|
|
|
|
0
|
$self->make_restricted_request($uri,$api->{method},%params); |
348
|
232
|
|
|
|
|
1007
|
}; |
349
|
|
|
|
|
|
|
} |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
sub status_url { |
352
|
0
|
|
|
0
|
1
|
0
|
my ($self,$user_id,$status_id) = @_; |
353
|
|
|
|
|
|
|
|
354
|
0
|
|
|
|
|
0
|
return $self->{site}.'/'.$user_id.'/statuses/'.$status_id; |
355
|
|
|
|
|
|
|
} |
356
|
|
|
|
|
|
|
# auto compile api proxy method |
357
|
|
|
|
|
|
|
sub import { |
358
|
4
|
|
|
4
|
|
37
|
shift; |
359
|
4
|
|
|
4
|
|
27
|
no strict 'refs'; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
1667
|
|
360
|
4
|
|
|
|
|
39
|
foreach my $k (keys %SINA_API) { |
361
|
232
|
|
|
|
|
459
|
*{__PACKAGE__.'::'.$k } = _build_api_proxy_sub($SINA_API{$k}); |
|
232
|
|
|
|
|
5621
|
|
362
|
|
|
|
|
|
|
} |
363
|
|
|
|
|
|
|
} |
364
|
|
|
|
|
|
|
1; |
365
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
=pod |
368
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
=head1 NAME |
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
Net::SinaWeibo - A simple and lightweight OAuth api for SinaWeibo |
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
=head1 VERSION |
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
version 0.003 |
376
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
=head1 SYNOPSIS |
378
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
# from sinaweibo app setting |
380
|
|
|
|
|
|
|
my $app_key = 'xxxx'; |
381
|
|
|
|
|
|
|
my $app_key_secret = 'xxxxxxxxx'; |
382
|
|
|
|
|
|
|
my $client = Net::SinaWeibo->new( |
383
|
|
|
|
|
|
|
app_key => $app_key, |
384
|
|
|
|
|
|
|
app_key_secret => $app_key_secret); |
385
|
|
|
|
|
|
|
# authorization |
386
|
|
|
|
|
|
|
my $callback_url = 'http://youdomain.com/app_callback'; |
387
|
|
|
|
|
|
|
my $url = $client->get_authorize_url(callback_url => $callback_url); |
388
|
|
|
|
|
|
|
# or don't use callback_url,just like a desktop client. |
389
|
|
|
|
|
|
|
my $url = $client->get_authorize_url; |
390
|
|
|
|
|
|
|
# now $client hold the request_token, but you must authorize your app first. |
391
|
|
|
|
|
|
|
# let user go to visit the authorize url. |
392
|
|
|
|
|
|
|
say 'Please goto this url:',$url; |
393
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
# save these tokens to your file. |
395
|
|
|
|
|
|
|
Net::SinaWeibo->save_tokens('~/app/var/tokens/my.tokens', |
396
|
|
|
|
|
|
|
app_key => $app_key, |
397
|
|
|
|
|
|
|
app_key_secret => $app_key_secret, |
398
|
|
|
|
|
|
|
_request_token => $client->request_token->token, |
399
|
|
|
|
|
|
|
_request_token_secret => $client->request_token->secret, |
400
|
|
|
|
|
|
|
); |
401
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
# later,you can load tokens |
403
|
|
|
|
|
|
|
my %tokens = Net::SinaWeibo->load_tokens '~/app/var/tokens/my.tokens'; |
404
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
# After user authorized,you can request access_token with the request token |
406
|
|
|
|
|
|
|
my $client = Net::SinaWeibo->new( |
407
|
|
|
|
|
|
|
app_key => $tokens{app_key}, |
408
|
|
|
|
|
|
|
app_secret => $tokens{app_secret}, |
409
|
|
|
|
|
|
|
tokens => { |
410
|
|
|
|
|
|
|
request_token => $tokens{_request_token}, |
411
|
|
|
|
|
|
|
request_token_secret => $tokens{_request_token_secret}, |
412
|
|
|
|
|
|
|
} |
413
|
|
|
|
|
|
|
); |
414
|
|
|
|
|
|
|
my $verifier = '5123876'; |
415
|
|
|
|
|
|
|
my ($access_token,$access_token_secret) = $client->get_access_token( |
416
|
|
|
|
|
|
|
verifier => $verifier, |
417
|
|
|
|
|
|
|
); |
418
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
# now you can retrieve any restricted resources. |
420
|
|
|
|
|
|
|
my $friends = $client->friends; |
421
|
|
|
|
|
|
|
# any api can pass any specific parameters |
422
|
|
|
|
|
|
|
my $latest_mentions = $client->mentions since_id => 25892384,count => 10,page => 1; |
423
|
|
|
|
|
|
|
# upload also support. |
424
|
|
|
|
|
|
|
my $ok = $client->upload(status => 'Hello,this first image file', pic => 'images/demo.jpg'); |
425
|
|
|
|
|
|
|
# profile image |
426
|
|
|
|
|
|
|
my $ok = update_profile_image(image => 'images/my_avatar.jpg'); |
427
|
|
|
|
|
|
|
# enjoy! |
428
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
=head1 DESCRIPTION |
430
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
This is a lite OAuth client for SinaWeibo(http://t.sina.com.cn/). |
432
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
=encoding utf-8 |
434
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
=head1 METHODS |
436
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
=head2 new(params) |
438
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
my $client = Net::SinaWeibo->new( |
440
|
|
|
|
|
|
|
app_key => 'sinaweibo_app_key', |
441
|
|
|
|
|
|
|
app_secret => 'sina_weibo_app_secret', |
442
|
|
|
|
|
|
|
# optional,you can pass access_token/request_token |
443
|
|
|
|
|
|
|
tokens => { |
444
|
|
|
|
|
|
|
access_token => 'xxxxxx', |
445
|
|
|
|
|
|
|
access_token_secret => 'xxxxxxxx', |
446
|
|
|
|
|
|
|
# or |
447
|
|
|
|
|
|
|
request_token => 'xxxxxxx', |
448
|
|
|
|
|
|
|
request_token_secret => 'xxxxx', |
449
|
|
|
|
|
|
|
} |
450
|
|
|
|
|
|
|
); |
451
|
|
|
|
|
|
|
|
452
|
|
|
|
|
|
|
=head2 get_authorize_url(%params) |
453
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
=head3 parameters |
455
|
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
=over |
457
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
=item callback_url |
459
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
Url which service provider redirect end-user to after authorization. |
461
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
=back |
463
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
Get the URL to authorize a user as a URI object. |
465
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
=head2 get_request_token |
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
Request the request token and request token secret for this user. |
469
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
This is called automatically by C if necessary. |
471
|
|
|
|
|
|
|
|
472
|
|
|
|
|
|
|
=head2 get_access_token(%params) |
473
|
|
|
|
|
|
|
|
474
|
|
|
|
|
|
|
=head3 parameters |
475
|
|
|
|
|
|
|
|
476
|
|
|
|
|
|
|
=over |
477
|
|
|
|
|
|
|
|
478
|
|
|
|
|
|
|
=item verifier |
479
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
Verfication code which SinaWeibo returns. |
481
|
|
|
|
|
|
|
|
482
|
|
|
|
|
|
|
=item token |
483
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
Request token object. Optional, if you has been set request_token. |
485
|
|
|
|
|
|
|
|
486
|
|
|
|
|
|
|
=back |
487
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
my $access_token = $sina->get_access_token(verifier => '589893'); |
489
|
|
|
|
|
|
|
# or |
490
|
|
|
|
|
|
|
my $access_token = $sina->get_access_token(verifier => '589893',token => $request_token); |
491
|
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
Request the access token for this user. |
493
|
|
|
|
|
|
|
|
494
|
|
|
|
|
|
|
The user must have authorized this app at the url given by |
495
|
|
|
|
|
|
|
C first. |
496
|
|
|
|
|
|
|
|
497
|
|
|
|
|
|
|
Returns the access token but also sets |
498
|
|
|
|
|
|
|
them internally so that after calling this method you can |
499
|
|
|
|
|
|
|
immediately call a restricted method. |
500
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
=head2 last_api |
502
|
|
|
|
|
|
|
|
503
|
|
|
|
|
|
|
Get the last called api(uri) |
504
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
=head2 last_api_error |
506
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
Get the last api error hash ref. If the error message is not any valid error response, |
508
|
|
|
|
|
|
|
will just return the raw response content. |
509
|
|
|
|
|
|
|
|
510
|
|
|
|
|
|
|
=head2 load_tokens |
511
|
|
|
|
|
|
|
|
512
|
|
|
|
|
|
|
my %tokens = Net::SinaWeibo->load_tokens('saved.tokens'); |
513
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
A convenience method for loading tokens from a config file. |
515
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
Returns a hash with the token names suitable for passing to |
517
|
|
|
|
|
|
|
C. |
518
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
Returns an empty hash if the file doesn't exist. |
520
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
=head2 last_api_error_code |
522
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
Get last api error_code, which return by provider. If provider reponse is |
524
|
|
|
|
|
|
|
not valid JSON message, it's just the http status code. |
525
|
|
|
|
|
|
|
|
526
|
|
|
|
|
|
|
=head2 last_api_error_subcode |
527
|
|
|
|
|
|
|
|
528
|
|
|
|
|
|
|
Get detail error code about the api error (like 400 serial). |
529
|
|
|
|
|
|
|
|
530
|
|
|
|
|
|
|
=head2 save_tokens [token[s] hash] |
531
|
|
|
|
|
|
|
|
532
|
|
|
|
|
|
|
Net::SinaWeibo->save_tokens( |
533
|
|
|
|
|
|
|
consumer_token => 'xxxx', |
534
|
|
|
|
|
|
|
consumer_secret => 'xxxx', |
535
|
|
|
|
|
|
|
_request_token => 'xxxxxx', |
536
|
|
|
|
|
|
|
_request_token_secret => 'xxxxx', |
537
|
|
|
|
|
|
|
_access_token => 'xxxxx', |
538
|
|
|
|
|
|
|
_access_secret => 'xxxxx, |
539
|
|
|
|
|
|
|
) |
540
|
|
|
|
|
|
|
|
541
|
|
|
|
|
|
|
A convenience method to save a hash of tokens out to the given file. |
542
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
=head1 SinaWeibo API METHODS |
544
|
|
|
|
|
|
|
|
545
|
|
|
|
|
|
|
Follow are generated proxy method for SinaWeibo API. |
546
|
|
|
|
|
|
|
|
547
|
|
|
|
|
|
|
Recent document please visit L |
548
|
|
|
|
|
|
|
|
549
|
|
|
|
|
|
|
=head2 public_timeline |
550
|
|
|
|
|
|
|
|
551
|
|
|
|
|
|
|
返回最新更新的20条微博消息。 |
552
|
|
|
|
|
|
|
|
553
|
|
|
|
|
|
|
count: 每次返回的最大记录数,不能超过200,默认20. |
554
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
L |
556
|
|
|
|
|
|
|
|
557
|
|
|
|
|
|
|
=head2 friends_timeline |
558
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
=head2 home_timeline |
560
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
返回用户所有关注用户最新n条微博信息。和用户“我的首页”返回内容相同。 |
562
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
since_id: 微博信息ID. 只返回ID比since_id大(比since_id时间晚的)的微博信息内容。 |
564
|
|
|
|
|
|
|
|
565
|
|
|
|
|
|
|
max_id: 微博信息ID. 返回ID不大于max_id的微博信息内容。 |
566
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
count: 每次返回的最大记录数,不能超过200,默认20. |
568
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
page: 返回结果的页序号。注意:有分页限制。根据用户关注对象发表的数量,通常最多返回1,000条最新微博分页内容, 默认1 |
570
|
|
|
|
|
|
|
|
571
|
|
|
|
|
|
|
L |
572
|
|
|
|
|
|
|
|
573
|
|
|
|
|
|
|
=head2 user_timeline |
574
|
|
|
|
|
|
|
|
575
|
|
|
|
|
|
|
获取用户发布的微博信息列表 |
576
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
id: 可选参数. 根据指定用户UID或微博昵称来返回微博信息。 |
578
|
|
|
|
|
|
|
user_id: 可选参数. 用户UID,主要是用来区分用户UID跟微博昵称一样,产生歧义的时候,特别是在微博昵称为数字导致和用户Uid发生歧义。 |
579
|
|
|
|
|
|
|
screen_name:可选参数.微博昵称,主要是用来区分用户UID跟微博昵称一样,产生歧义的时候。 |
580
|
|
|
|
|
|
|
since_id:可选参数(微博信息ID). 只返回ID比since_id大(比since_id时间晚的)的微博信息内容 |
581
|
|
|
|
|
|
|
max_id: 可选参数(微博信息ID). 返回ID不大于max_id的微博信息内容。 |
582
|
|
|
|
|
|
|
count: 可选参数. 每次返回的最大记录数,最多返回200条,默认20。 |
583
|
|
|
|
|
|
|
page: 可选参数. 分页返回。注意:最多返回200条分页内容。 |
584
|
|
|
|
|
|
|
|
585
|
|
|
|
|
|
|
L |
586
|
|
|
|
|
|
|
|
587
|
|
|
|
|
|
|
=head2 mentions |
588
|
|
|
|
|
|
|
|
589
|
|
|
|
|
|
|
获取@当前用户的微博列表 |
590
|
|
|
|
|
|
|
|
591
|
|
|
|
|
|
|
since_id. 可选参数. 返回ID比数值since_id大(比since_id时间晚的)的提到。 |
592
|
|
|
|
|
|
|
max_id. 可选参数. 返回ID不大于max_id(时间不晚于max_id)的提到。 |
593
|
|
|
|
|
|
|
count. 可选参数. 每次返回的最大记录数(即页面大小),不大于200,默认为20。 |
594
|
|
|
|
|
|
|
page. 可选参数. 返回结果的页序号。注意:有分页限制。 |
595
|
|
|
|
|
|
|
|
596
|
|
|
|
|
|
|
L |
597
|
|
|
|
|
|
|
|
598
|
|
|
|
|
|
|
=head2 comments_timeline |
599
|
|
|
|
|
|
|
|
600
|
|
|
|
|
|
|
获取当前用户发送及收到的评论列表 |
601
|
|
|
|
|
|
|
|
602
|
|
|
|
|
|
|
since_id: 可选参数(评论ID). 只返回ID比since_id大(比since_id时间晚的)的评论。 |
603
|
|
|
|
|
|
|
max_id: 可选参数(评论ID). 返回ID不大于max_id的评论。 |
604
|
|
|
|
|
|
|
count: 可选参数. 每次返回的最大记录数,不大于200,默认20。 |
605
|
|
|
|
|
|
|
page: 可选参数. 返回结果的页序号。注意:有分页限制。 |
606
|
|
|
|
|
|
|
|
607
|
|
|
|
|
|
|
L |
608
|
|
|
|
|
|
|
|
609
|
|
|
|
|
|
|
=head2 comments_by_me |
610
|
|
|
|
|
|
|
|
611
|
|
|
|
|
|
|
获取当前用户发出的评论 |
612
|
|
|
|
|
|
|
|
613
|
|
|
|
|
|
|
since_id: 可选参数(评论ID). 只返回ID比since_id大(比since_id时间晚的)的评论。 |
614
|
|
|
|
|
|
|
max_id: 可选参数(评论ID). 返回ID不大于max_id的评论。 |
615
|
|
|
|
|
|
|
count: 可选参数. 每次返回的最大记录数,不大于200,默认20。 |
616
|
|
|
|
|
|
|
page: 可选参数. 返回结果的页序号。注意:有分页限制。 |
617
|
|
|
|
|
|
|
|
618
|
|
|
|
|
|
|
L |
619
|
|
|
|
|
|
|
|
620
|
|
|
|
|
|
|
=head2 comments_to_me |
621
|
|
|
|
|
|
|
|
622
|
|
|
|
|
|
|
获取当前用户收到的评论 |
623
|
|
|
|
|
|
|
|
624
|
|
|
|
|
|
|
since_id: 可选参数(评论ID). 只返回ID比since_id大(比since_id时间晚的)的评论。 |
625
|
|
|
|
|
|
|
max_id: 可选参数(评论ID). 返回ID不大于max_id的评论。 |
626
|
|
|
|
|
|
|
count: 可选参数. 每次返回的最大记录数,不大于200,默认20。 |
627
|
|
|
|
|
|
|
page: 可选参数. 返回结果的页序号。注意:有分页限制。 |
628
|
|
|
|
|
|
|
|
629
|
|
|
|
|
|
|
L |
630
|
|
|
|
|
|
|
|
631
|
|
|
|
|
|
|
=head2 comments |
632
|
|
|
|
|
|
|
|
633
|
|
|
|
|
|
|
获取指定微博的评论列表 |
634
|
|
|
|
|
|
|
|
635
|
|
|
|
|
|
|
id. 必选参数. 返回指定的微博ID |
636
|
|
|
|
|
|
|
count. 可选参数. 每次返回的最大记录数(即页面大小),不大于200,默认为20。 |
637
|
|
|
|
|
|
|
page. 可选参数. 返回结果的页序号 |
638
|
|
|
|
|
|
|
|
639
|
|
|
|
|
|
|
L |
640
|
|
|
|
|
|
|
|
641
|
|
|
|
|
|
|
=head2 status_counts |
642
|
|
|
|
|
|
|
|
643
|
|
|
|
|
|
|
批量获取一组微博的评论数及转发数,一次请求最多获取100个。 |
644
|
|
|
|
|
|
|
|
645
|
|
|
|
|
|
|
ids. 必填参数. 微博ID号列表,用逗号隔开 |
646
|
|
|
|
|
|
|
|
647
|
|
|
|
|
|
|
L |
648
|
|
|
|
|
|
|
|
649
|
|
|
|
|
|
|
=head2 status_unread |
650
|
|
|
|
|
|
|
|
651
|
|
|
|
|
|
|
获取当前用户未读消息数 |
652
|
|
|
|
|
|
|
|
653
|
|
|
|
|
|
|
with_new_status 可选参数,默认为0。1表示结果包含是否有新微博,0表示结果不包含是否有新微博。 |
654
|
|
|
|
|
|
|
since_id 可选参数 参数值为微博id,返回此条id之后,是否有新微博产生,有返回1,没有返回0 |
655
|
|
|
|
|
|
|
|
656
|
|
|
|
|
|
|
L |
657
|
|
|
|
|
|
|
|
658
|
|
|
|
|
|
|
=head2 status_reset_count |
659
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
未读消息数清零接口 |
661
|
|
|
|
|
|
|
|
662
|
|
|
|
|
|
|
type 需要清零的计数类别,值为下列四个之一:1--评论数,2--@数,3--私信数,4--关注我的数。 |
663
|
|
|
|
|
|
|
|
664
|
|
|
|
|
|
|
L |
665
|
|
|
|
|
|
|
|
666
|
|
|
|
|
|
|
=head2 emotions |
667
|
|
|
|
|
|
|
|
668
|
|
|
|
|
|
|
表情接口,获取表情列表 |
669
|
|
|
|
|
|
|
|
670
|
|
|
|
|
|
|
type:表情类别,可选参数,"face":普通表情,"ani":魔法表情,"cartoon":动漫表情;默认为"face" |
671
|
|
|
|
|
|
|
language:语言类别,可选参数,"cnname"简体,"twname"繁体;默认为"cnname" |
672
|
|
|
|
|
|
|
|
673
|
|
|
|
|
|
|
L |
674
|
|
|
|
|
|
|
|
675
|
|
|
|
|
|
|
=head2 show_status |
676
|
|
|
|
|
|
|
|
677
|
|
|
|
|
|
|
根据ID获取单条微博信息内容 |
678
|
|
|
|
|
|
|
|
679
|
|
|
|
|
|
|
id. 必须参数(微博信息ID),要获取已发表的微博ID,如ID不存在返回空 |
680
|
|
|
|
|
|
|
|
681
|
|
|
|
|
|
|
L |
682
|
|
|
|
|
|
|
|
683
|
|
|
|
|
|
|
=head2 status_url($user_id,$status_id) |
684
|
|
|
|
|
|
|
|
685
|
|
|
|
|
|
|
返回根据微博ID和用户ID生成的单条微博页面url |
686
|
|
|
|
|
|
|
|
687
|
|
|
|
|
|
|
=head2 post_status |
688
|
|
|
|
|
|
|
|
689
|
|
|
|
|
|
|
发布一条微博信息 |
690
|
|
|
|
|
|
|
|
691
|
|
|
|
|
|
|
status. 必填参数, 要更新的微博信息。必须做URLEncode,信息内容不超过140个汉字,为空返回400错误。 |
692
|
|
|
|
|
|
|
in_reply_to_status_id. 可选参数,@ 需要回复的微博信息ID, 这个参数只有在微博内容以 @username 开头才有意义。(即将推出)。 |
693
|
|
|
|
|
|
|
lat. 可选参数,纬度,发表当前微博所在的地理位置,有效范围 -90.0到+90.0, +表示北纬。只有用户设置中geo_enabled=true时候地理位置才有效。(仅对受邀请的合作开发者开放) |
694
|
|
|
|
|
|
|
long. 可选参数,经度。有效范围-180.0到+180.0, +表示东经。(仅对受邀请的合作开发者开放) |
695
|
|
|
|
|
|
|
|
696
|
|
|
|
|
|
|
如果没有登录或超过发布上限,将返回403错误. |
697
|
|
|
|
|
|
|
如果in_reply_to_status_id不存在,将返回500错误. |
698
|
|
|
|
|
|
|
系统将忽略重复发布的信息。每次发布将比较最后一条发布消息,如果一样将被忽略。因此用户不能连续提交相同信息。 |
699
|
|
|
|
|
|
|
|
700
|
|
|
|
|
|
|
L |
701
|
|
|
|
|
|
|
|
702
|
|
|
|
|
|
|
=head2 upload_status |
703
|
|
|
|
|
|
|
|
704
|
|
|
|
|
|
|
上传图片并发布一条微博信息 |
705
|
|
|
|
|
|
|
|
706
|
|
|
|
|
|
|
status. 必填参数, 要更新的微博信息。必须做URLEncode,信息内容不超过140个汉字。支持全角、半角字符。 |
707
|
|
|
|
|
|
|
pic. 必填参数。仅支持JPEG,GIF,PNG图片,为空返回400错误。目前上传图片大小限制为<1M。 |
708
|
|
|
|
|
|
|
lat. 可选参数,纬度,发表当前微博所在的地理位置,有效范围 -90.0到+90.0, +表示北纬。只有用户设置中geo_enabled=true时候地理位置才有效。(保留字段,暂不支持) |
709
|
|
|
|
|
|
|
long. 可选参数,经度。有效范围-180.0到+180.0, +表示东经。(保留字段,暂不支持) |
710
|
|
|
|
|
|
|
|
711
|
|
|
|
|
|
|
如果使用的Oauth认证,图片参数pic不参与签名。 |
712
|
|
|
|
|
|
|
|
713
|
|
|
|
|
|
|
L |
714
|
|
|
|
|
|
|
|
715
|
|
|
|
|
|
|
=head2 remove_status |
716
|
|
|
|
|
|
|
|
717
|
|
|
|
|
|
|
删除一条微博信息 |
718
|
|
|
|
|
|
|
|
719
|
|
|
|
|
|
|
id. 必须参数. 要删除的微博ID. |
720
|
|
|
|
|
|
|
|
721
|
|
|
|
|
|
|
L |
722
|
|
|
|
|
|
|
|
723
|
|
|
|
|
|
|
=head2 retweet |
724
|
|
|
|
|
|
|
=head2 repost_status |
725
|
|
|
|
|
|
|
|
726
|
|
|
|
|
|
|
转发一条微博信息(可加评论) |
727
|
|
|
|
|
|
|
|
728
|
|
|
|
|
|
|
id 必填参数, 转发的微博ID |
729
|
|
|
|
|
|
|
status. 可选参数, 添加的转发信息。必须做URLEncode,信息内容不超过140个汉字。如不填则自动生成类似“转发 @author: 原内容”文字。 |
730
|
|
|
|
|
|
|
|
731
|
|
|
|
|
|
|
如果没有登录,将返回403错误. |
732
|
|
|
|
|
|
|
转发的微博不存在,将返回500错误. |
733
|
|
|
|
|
|
|
L. |
734
|
|
|
|
|
|
|
|
735
|
|
|
|
|
|
|
=head2 post_comment |
736
|
|
|
|
|
|
|
|
737
|
|
|
|
|
|
|
对一条微博信息进行评论 |
738
|
|
|
|
|
|
|
|
739
|
|
|
|
|
|
|
id 必填参数, 要评论的微博id |
740
|
|
|
|
|
|
|
comment. 必填参数, 评论内容。必须做URLEncode,信息内容不超过140个汉字。 |
741
|
|
|
|
|
|
|
|
742
|
|
|
|
|
|
|
L |
743
|
|
|
|
|
|
|
|
744
|
|
|
|
|
|
|
=head2 remove_comment |
745
|
|
|
|
|
|
|
|
746
|
|
|
|
|
|
|
删除当前用户的微博评论信息 |
747
|
|
|
|
|
|
|
|
748
|
|
|
|
|
|
|
id. 必须参数. 要删除的评论ID. |
749
|
|
|
|
|
|
|
|
750
|
|
|
|
|
|
|
如果评论不存在,将返回403错误. |
751
|
|
|
|
|
|
|
|
752
|
|
|
|
|
|
|
L |
753
|
|
|
|
|
|
|
|
754
|
|
|
|
|
|
|
=head2 batch_remove_comments |
755
|
|
|
|
|
|
|
|
756
|
|
|
|
|
|
|
批量删除当前用户的微博评论信息 |
757
|
|
|
|
|
|
|
|
758
|
|
|
|
|
|
|
ids 必选参数,想要删除评论的id,多个id之间用半角逗号分割,支持最多20个。 |
759
|
|
|
|
|
|
|
|
760
|
|
|
|
|
|
|
L |
761
|
|
|
|
|
|
|
|
762
|
|
|
|
|
|
|
=head2 reply_comment |
763
|
|
|
|
|
|
|
|
764
|
|
|
|
|
|
|
回复微博评论信息 |
765
|
|
|
|
|
|
|
|
766
|
|
|
|
|
|
|
id 必填参数, 要评论的微博id |
767
|
|
|
|
|
|
|
cid 必填参数, 要评论的评论id 如没有或非法则为对微博的评论 |
768
|
|
|
|
|
|
|
comment. 必填参数, 评论内容。必须做URLEncode,信息内容不超过140个汉字 |
769
|
|
|
|
|
|
|
|
770
|
|
|
|
|
|
|
L |
771
|
|
|
|
|
|
|
|
772
|
|
|
|
|
|
|
=head2 hot_users |
773
|
|
|
|
|
|
|
|
774
|
|
|
|
|
|
|
获取系统推荐用户 |
775
|
|
|
|
|
|
|
|
776
|
|
|
|
|
|
|
category: 分类,可选参数,返回某一类别的推荐用户,默认为 default。如果不在一下分类中,返回空列表: |
777
|
|
|
|
|
|
|
|
778
|
|
|
|
|
|
|
default:人气关注 |
779
|
|
|
|
|
|
|
ent:影视名星 |
780
|
|
|
|
|
|
|
hk_famous:港台名人 |
781
|
|
|
|
|
|
|
model:模特 |
782
|
|
|
|
|
|
|
cooking:美食&健康 |
783
|
|
|
|
|
|
|
sport:体育名人 |
784
|
|
|
|
|
|
|
finance:商界名人 |
785
|
|
|
|
|
|
|
tech:IT互联网 |
786
|
|
|
|
|
|
|
singer:歌手 |
787
|
|
|
|
|
|
|
writer:作家 |
788
|
|
|
|
|
|
|
moderator:主持人 |
789
|
|
|
|
|
|
|
medium:媒体总编 |
790
|
|
|
|
|
|
|
stockplayer:炒股高手 |
791
|
|
|
|
|
|
|
|
792
|
|
|
|
|
|
|
L |
793
|
|
|
|
|
|
|
|
794
|
|
|
|
|
|
|
=head2 show_user |
795
|
|
|
|
|
|
|
|
796
|
|
|
|
|
|
|
根据用户ID获取用户资料(授权用户) |
797
|
|
|
|
|
|
|
|
798
|
|
|
|
|
|
|
id. 用户UID或微博昵称。 |
799
|
|
|
|
|
|
|
user_id. 指定用户UID,主要是用来区分用户UID跟微博昵称一样,产生歧义的时候,特别是在用户账号为数字导致和用户Uid发生歧义 |
800
|
|
|
|
|
|
|
screen_name. 指定微博昵称,主要是用来区分用户UID跟微博昵称一样,产生歧义的时候。 |
801
|
|
|
|
|
|
|
|
802
|
|
|
|
|
|
|
ID或者昵称不存在返回400错误. |
803
|
|
|
|
|
|
|
|
804
|
|
|
|
|
|
|
L |
805
|
|
|
|
|
|
|
|
806
|
|
|
|
|
|
|
=head2 friends |
807
|
|
|
|
|
|
|
|
808
|
|
|
|
|
|
|
获取当前用户关注对象列表及最新一条微博信息 |
809
|
|
|
|
|
|
|
|
810
|
|
|
|
|
|
|
id. 用户UID或微博昵称。 |
811
|
|
|
|
|
|
|
user_id. 指定用户UID,主要是用来区分用户UID跟微博昵称一样,产生歧义的时候,特别是在用户账号为数字导致和用户Uid发生歧义 |
812
|
|
|
|
|
|
|
screen_name. 指定微博昵称,主要是用来区分用户UID跟微博昵称一样,产生歧义的时候。 |
813
|
|
|
|
|
|
|
cursor. 选填参数. 单页只能包含100个关注列表,为了获取更多则cursor默认从-1开始,通过增加或减少cursor来获取更多, 如果没有下一页,则next_cursor返回0 |
814
|
|
|
|
|
|
|
count. 可选参数. 每次返回的最大记录数(即页面大小),不大于200,默认返回20。 |
815
|
|
|
|
|
|
|
|
816
|
|
|
|
|
|
|
如果没有提供cursor参数,将只返回最前面的100个关注列表。当以Json方式返回时,返回结构会稍有不同。 |
817
|
|
|
|
|
|
|
|
818
|
|
|
|
|
|
|
L |
819
|
|
|
|
|
|
|
|
820
|
|
|
|
|
|
|
=head2 followers |
821
|
|
|
|
|
|
|
|
822
|
|
|
|
|
|
|
获取当前用户粉丝列表及最新一条微博信息 |
823
|
|
|
|
|
|
|
|
824
|
|
|
|
|
|
|
id. 用户UID或微博昵称。 |
825
|
|
|
|
|
|
|
user_id. 指定用户UID,主要是用来区分用户UID跟微博昵称一样,产生歧义的时候,特别是在用户账号为数字导致和用户Uid发生歧义 |
826
|
|
|
|
|
|
|
screen_name. 指定微博昵称,主要是用来区分用户UID跟微博昵称一样,产生歧义的时候。 |
827
|
|
|
|
|
|
|
cursor. 选填参数. 单页只能包含100个关注列表,为了获取更多则cursor默认从-1开始,通过增加或减少cursor来获取更多, 如果没有下一页,则next_cursor返回0 |
828
|
|
|
|
|
|
|
count. 可选参数. 每次返回的最大记录数(即页面大小),不大于200,默认返回20。 |
829
|
|
|
|
|
|
|
|
830
|
|
|
|
|
|
|
如果没有提供cursor参数,将只返回最前面的100个列表. |
831
|
|
|
|
|
|
|
|
832
|
|
|
|
|
|
|
L |
833
|
|
|
|
|
|
|
|
834
|
|
|
|
|
|
|
=head2 dm |
835
|
|
|
|
|
|
|
|
836
|
|
|
|
|
|
|
获取当前用户最新私信列表 |
837
|
|
|
|
|
|
|
|
838
|
|
|
|
|
|
|
since_id. 可选参数. 返回ID比数值since_id大(比since_id时间晚的)的私信。 |
839
|
|
|
|
|
|
|
max_id. 可选参数. 返回ID不大于max_id(时间不晚于max_id)的私信。 |
840
|
|
|
|
|
|
|
count. 可选参数. 每次返回的最大记录数(即页面大小),不大于200。 |
841
|
|
|
|
|
|
|
page. 可选参数. 返回结果的页序号。注意:有分页限制。 |
842
|
|
|
|
|
|
|
|
843
|
|
|
|
|
|
|
L |
844
|
|
|
|
|
|
|
|
845
|
|
|
|
|
|
|
=head2 dm_sent |
846
|
|
|
|
|
|
|
|
847
|
|
|
|
|
|
|
获取当前用户发送的最新私信列表 |
848
|
|
|
|
|
|
|
|
849
|
|
|
|
|
|
|
since_id. 可选参数. 返回ID比数值since_id大(比since_id时间晚的)的私信。 |
850
|
|
|
|
|
|
|
max_id. 可选参数. 返回ID不大于max_id(时间不晚于max_id)的私信。 |
851
|
|
|
|
|
|
|
count. 可选参数. 每次返回的最大记录数(即页面大小),不大于200。 |
852
|
|
|
|
|
|
|
page. 可选参数. 返回结果的页序号。注意:有分页限制。 |
853
|
|
|
|
|
|
|
|
854
|
|
|
|
|
|
|
L |
855
|
|
|
|
|
|
|
|
856
|
|
|
|
|
|
|
=head2 send_dm |
857
|
|
|
|
|
|
|
|
858
|
|
|
|
|
|
|
发送一条私信 |
859
|
|
|
|
|
|
|
|
860
|
|
|
|
|
|
|
id: 必须参数. UID或微博昵称. 为了支持数字的微博昵称,需选填写下面2个参数screen_name或user_id: |
861
|
|
|
|
|
|
|
screen_name: 微博昵称 |
862
|
|
|
|
|
|
|
user_id: 新浪UID |
863
|
|
|
|
|
|
|
text: 必须参数. 要发生的消息内容,需要做URLEncode,文本大小必须小于300个汉字. |
864
|
|
|
|
|
|
|
|
865
|
|
|
|
|
|
|
L |
866
|
|
|
|
|
|
|
|
867
|
|
|
|
|
|
|
=head2 remove_dm |
868
|
|
|
|
|
|
|
|
869
|
|
|
|
|
|
|
删除一条私信 |
870
|
|
|
|
|
|
|
|
871
|
|
|
|
|
|
|
id. 必填参数,要删除的私信主键ID. |
872
|
|
|
|
|
|
|
|
873
|
|
|
|
|
|
|
L |
874
|
|
|
|
|
|
|
|
875
|
|
|
|
|
|
|
=head2 batch_remove_dm |
876
|
|
|
|
|
|
|
|
877
|
|
|
|
|
|
|
批量删除私信 |
878
|
|
|
|
|
|
|
|
879
|
|
|
|
|
|
|
ids 必选参数,想要删除私信的id,多个id之间用半角逗号分割,支持最多20个。 |
880
|
|
|
|
|
|
|
|
881
|
|
|
|
|
|
|
L |
882
|
|
|
|
|
|
|
|
883
|
|
|
|
|
|
|
=head2 follow |
884
|
|
|
|
|
|
|
|
885
|
|
|
|
|
|
|
关注某用户 |
886
|
|
|
|
|
|
|
|
887
|
|
|
|
|
|
|
id: 要关注的用户UID或微博昵称 |
888
|
|
|
|
|
|
|
user_id: 要关注的用户UID,主要是用在区分用户UID跟微博昵称一样,产生歧义的时候。 |
889
|
|
|
|
|
|
|
screen_name: 要关注的微博昵称,主要是用在区分用户UID跟微博昵称一样,产生歧义的时候。 |
890
|
|
|
|
|
|
|
|
891
|
|
|
|
|
|
|
目前的最多关注2000人,失败则返回一条字符串的说明。如果已经关注了此人,则返回http 403的状态。关注不存在的ID将返回400。 |
892
|
|
|
|
|
|
|
|
893
|
|
|
|
|
|
|
L |
894
|
|
|
|
|
|
|
|
895
|
|
|
|
|
|
|
=head2 unfollow |
896
|
|
|
|
|
|
|
|
897
|
|
|
|
|
|
|
取消关注.成功则返回被取消关注人的资料,失败则返回一条字符串的说明。 |
898
|
|
|
|
|
|
|
|
899
|
|
|
|
|
|
|
id. 必填参数. 要取消关注的用户UID或微博昵称 |
900
|
|
|
|
|
|
|
user_id. 必填参数. 要取消关注的用户UID,主要是用在区分用户UID跟微博昵称一样,产生歧义的时候。 |
901
|
|
|
|
|
|
|
screen_name. 必填参数. 要取消的微博昵称,主要是用在区分用户UID跟微博昵称一样,产生歧义的时候。 |
902
|
|
|
|
|
|
|
|
903
|
|
|
|
|
|
|
L |
904
|
|
|
|
|
|
|
|
905
|
|
|
|
|
|
|
=head2 is_followed |
906
|
|
|
|
|
|
|
|
907
|
|
|
|
|
|
|
获取两个用户关系的详细情况 |
908
|
|
|
|
|
|
|
|
909
|
|
|
|
|
|
|
以下参数可不填写,如不填,则取当前用户 |
910
|
|
|
|
|
|
|
|
911
|
|
|
|
|
|
|
source_id. 源用户UID |
912
|
|
|
|
|
|
|
source_screen_name. 源微博昵称 |
913
|
|
|
|
|
|
|
|
914
|
|
|
|
|
|
|
下面参数必须选填一个: |
915
|
|
|
|
|
|
|
|
916
|
|
|
|
|
|
|
target_id. 要判断的目的用户UID |
917
|
|
|
|
|
|
|
target_screen_name. 要判断的目的微博昵称 |
918
|
|
|
|
|
|
|
|
919
|
|
|
|
|
|
|
如果源用户或目的用户不存在,将返回http的400错误. |
920
|
|
|
|
|
|
|
返回的blocking表示source_id用户是否对target_id加黑名单,只对source_id是当前用户有效,即只能看到自己的阻止设置(blocking协议暂不支持返回) |
921
|
|
|
|
|
|
|
|
922
|
|
|
|
|
|
|
L |
923
|
|
|
|
|
|
|
|
924
|
|
|
|
|
|
|
=head2 get_friends_id_list |
925
|
|
|
|
|
|
|
|
926
|
|
|
|
|
|
|
获取用户关注对象uid列表 |
927
|
|
|
|
|
|
|
|
928
|
|
|
|
|
|
|
id. 用户UID或微博昵称。 |
929
|
|
|
|
|
|
|
user_id. 指定用户UID,主要是用来区分用户UID跟微博昵称一样,产生歧义的时候,特别是在用户账号为数字导致和用户Uid发生歧义 |
930
|
|
|
|
|
|
|
screen_name. 指定微博昵称,主要是用来区分用户UID跟微博昵称一样,产生歧义的时候。 |
931
|
|
|
|
|
|
|
cursor. 选填参数. 单页只能包含100个关注列表,为了获取更多则cursor默认从-1开始,通过增加或减少cursor来获取更多, 如果没有下一页,则next_cursor返回0 |
932
|
|
|
|
|
|
|
count. 可选参数. 每次返回的最大记录数(即页面大小),不大于200,默认返回20。 |
933
|
|
|
|
|
|
|
|
934
|
|
|
|
|
|
|
如果没有提供cursor参数,将只返回最前面的5000个关注id |
935
|
|
|
|
|
|
|
|
936
|
|
|
|
|
|
|
L |
937
|
|
|
|
|
|
|
|
938
|
|
|
|
|
|
|
=head2 get_followers_id_list |
939
|
|
|
|
|
|
|
|
940
|
|
|
|
|
|
|
获取用户粉丝对象uid列表 |
941
|
|
|
|
|
|
|
|
942
|
|
|
|
|
|
|
id. 用户UID或微博昵称。 |
943
|
|
|
|
|
|
|
user_id. 指定用户UID,主要是用来区分用户UID跟微博昵称一样,产生歧义的时候,特别是在用户账号为数字导致和用户Uid发生歧义 |
944
|
|
|
|
|
|
|
screen_name. 指定微博昵称,主要是用来区分用户UID跟微博昵称一样,产生歧义的时候。 |
945
|
|
|
|
|
|
|
cursor. 选填参数. 单页只能包含100个关注列表,为了获取更多则cursor默认从-1开始,通过增加或减少cursor来获取更多, 如果没有下一页,则next_cursor返回0 |
946
|
|
|
|
|
|
|
count. 可选参数. 每次返回的最大记录数(即页面大小),不大于200,默认返回20。 |
947
|
|
|
|
|
|
|
|
948
|
|
|
|
|
|
|
如果没有提供cursor参数,将只返回最前面的5000个粉丝id |
949
|
|
|
|
|
|
|
|
950
|
|
|
|
|
|
|
L |
951
|
|
|
|
|
|
|
|
952
|
|
|
|
|
|
|
=head2 update_privacy |
953
|
|
|
|
|
|
|
|
954
|
|
|
|
|
|
|
设置隐私信息 |
955
|
|
|
|
|
|
|
|
956
|
|
|
|
|
|
|
comment: 谁可以评论此账号的微薄。 0:所有人 1:我关注的人 默认为0 |
957
|
|
|
|
|
|
|
message:谁可以给此账号发私信。0:所有人 1:我关注的人 默认为1 |
958
|
|
|
|
|
|
|
realname 是否允许别人通过真实姓名搜索到我,值---0允许,1不允许,默认值1 |
959
|
|
|
|
|
|
|
geo 发布微博,是否允许微博保存并显示所处的地理位置信息。值—0允许,1不允许,默认值0 |
960
|
|
|
|
|
|
|
badge 勋章展现状态,值—1私密状态,0公开状态,默认值0 |
961
|
|
|
|
|
|
|
|
962
|
|
|
|
|
|
|
L |
963
|
|
|
|
|
|
|
|
964
|
|
|
|
|
|
|
=head2 get_privacy |
965
|
|
|
|
|
|
|
|
966
|
|
|
|
|
|
|
获取隐私信息 |
967
|
|
|
|
|
|
|
|
968
|
|
|
|
|
|
|
L |
969
|
|
|
|
|
|
|
|
970
|
|
|
|
|
|
|
=head2 block_user |
971
|
|
|
|
|
|
|
|
972
|
|
|
|
|
|
|
将某用户加入黑名单 |
973
|
|
|
|
|
|
|
|
974
|
|
|
|
|
|
|
必选参数(至少选一个): |
975
|
|
|
|
|
|
|
|
976
|
|
|
|
|
|
|
user_id:要加入黑名单的用户ID。 |
977
|
|
|
|
|
|
|
screen_name:要加入黑名单的用户微博昵称,可选。 |
978
|
|
|
|
|
|
|
|
979
|
|
|
|
|
|
|
user_id或screen_name若不存在返回400 |
980
|
|
|
|
|
|
|
|
981
|
|
|
|
|
|
|
L |
982
|
|
|
|
|
|
|
|
983
|
|
|
|
|
|
|
=head2 unblock_user |
984
|
|
|
|
|
|
|
|
985
|
|
|
|
|
|
|
将某用户移出黑名单 |
986
|
|
|
|
|
|
|
|
987
|
|
|
|
|
|
|
必选参数(至少选一个): |
988
|
|
|
|
|
|
|
|
989
|
|
|
|
|
|
|
user_id:要删除黑名单的用户ID |
990
|
|
|
|
|
|
|
screen_name:要删除黑名单的用户昵称 |
991
|
|
|
|
|
|
|
|
992
|
|
|
|
|
|
|
L |
993
|
|
|
|
|
|
|
|
994
|
|
|
|
|
|
|
=head2 is_blocked |
995
|
|
|
|
|
|
|
|
996
|
|
|
|
|
|
|
某用户是否是黑名单用户 |
997
|
|
|
|
|
|
|
|
998
|
|
|
|
|
|
|
必选参数(至少选一个): |
999
|
|
|
|
|
|
|
|
1000
|
|
|
|
|
|
|
user_id:要检查的用户ID |
1001
|
|
|
|
|
|
|
screen_name:要检查的用户昵称 |
1002
|
|
|
|
|
|
|
|
1003
|
|
|
|
|
|
|
L |
1004
|
|
|
|
|
|
|
|
1005
|
|
|
|
|
|
|
=head2 blocking |
1006
|
|
|
|
|
|
|
|
1007
|
|
|
|
|
|
|
列出黑名单用户(输出用户详细信息) |
1008
|
|
|
|
|
|
|
|
1009
|
|
|
|
|
|
|
page. 页码,可选。. |
1010
|
|
|
|
|
|
|
count. 一页大小,可选。. |
1011
|
|
|
|
|
|
|
|
1012
|
|
|
|
|
|
|
L |
1013
|
|
|
|
|
|
|
|
1014
|
|
|
|
|
|
|
=head2 blocking_id_list |
1015
|
|
|
|
|
|
|
|
1016
|
|
|
|
|
|
|
列出分页黑名单用户(只输出id) |
1017
|
|
|
|
|
|
|
|
1018
|
|
|
|
|
|
|
page. 页码,可选。. |
1019
|
|
|
|
|
|
|
count. 一页大小,可选。. |
1020
|
|
|
|
|
|
|
|
1021
|
|
|
|
|
|
|
L |
1022
|
|
|
|
|
|
|
|
1023
|
|
|
|
|
|
|
=head2 tags |
1024
|
|
|
|
|
|
|
|
1025
|
|
|
|
|
|
|
返回指定用户的标签列表 |
1026
|
|
|
|
|
|
|
|
1027
|
|
|
|
|
|
|
user_id: 必填参数,查询用户的ID |
1028
|
|
|
|
|
|
|
count: 可选参数. 每次返回的最大记录数(即页面大小),不大于200,默认为20。 |
1029
|
|
|
|
|
|
|
page: 可选参数. 返回结果的页序号。注意:有分页限制。 |
1030
|
|
|
|
|
|
|
|
1031
|
|
|
|
|
|
|
L |
1032
|
|
|
|
|
|
|
|
1033
|
|
|
|
|
|
|
=head2 add_tag |
1034
|
|
|
|
|
|
|
|
1035
|
|
|
|
|
|
|
添加用户标签 |
1036
|
|
|
|
|
|
|
|
1037
|
|
|
|
|
|
|
tags: 标签,必填参数,多个标签之间用逗号间隔 |
1038
|
|
|
|
|
|
|
|
1039
|
|
|
|
|
|
|
L |
1040
|
|
|
|
|
|
|
|
1041
|
|
|
|
|
|
|
=head2 tag_suggestions |
1042
|
|
|
|
|
|
|
|
1043
|
|
|
|
|
|
|
返回用户感兴趣的标签 |
1044
|
|
|
|
|
|
|
|
1045
|
|
|
|
|
|
|
page: 可选参数,页码,默认为1 |
1046
|
|
|
|
|
|
|
count: 可选参数,分页大小,默认为10 |
1047
|
|
|
|
|
|
|
|
1048
|
|
|
|
|
|
|
L |
1049
|
|
|
|
|
|
|
|
1050
|
|
|
|
|
|
|
=head2 remove_tag |
1051
|
|
|
|
|
|
|
|
1052
|
|
|
|
|
|
|
删除标签 |
1053
|
|
|
|
|
|
|
|
1054
|
|
|
|
|
|
|
tag_id:标签ID,必填参数 |
1055
|
|
|
|
|
|
|
|
1056
|
|
|
|
|
|
|
L |
1057
|
|
|
|
|
|
|
|
1058
|
|
|
|
|
|
|
=head2 batch_remove_tags |
1059
|
|
|
|
|
|
|
|
1060
|
|
|
|
|
|
|
批量删除标签 |
1061
|
|
|
|
|
|
|
|
1062
|
|
|
|
|
|
|
ids:必选参数,要删除的tag id,多个id用半角逗号分割,最多20个。 |
1063
|
|
|
|
|
|
|
|
1064
|
|
|
|
|
|
|
L |
1065
|
|
|
|
|
|
|
|
1066
|
|
|
|
|
|
|
=head2 verify_credentials |
1067
|
|
|
|
|
|
|
|
1068
|
|
|
|
|
|
|
验证当前用户身份是否合法. |
1069
|
|
|
|
|
|
|
|
1070
|
|
|
|
|
|
|
如果用户新浪通行证身份验证成功且用户已经开通微博则返回 http状态为 200;如果是不则返回401的状态和错误信息。此方法用了判断用户身份是否合法且已经开通微博。 |
1071
|
|
|
|
|
|
|
|
1072
|
|
|
|
|
|
|
L |
1073
|
|
|
|
|
|
|
|
1074
|
|
|
|
|
|
|
=head2 rate_limit_status |
1075
|
|
|
|
|
|
|
|
1076
|
|
|
|
|
|
|
获取当前用户API访问频率限制 |
1077
|
|
|
|
|
|
|
|
1078
|
|
|
|
|
|
|
L |
1079
|
|
|
|
|
|
|
|
1080
|
|
|
|
|
|
|
=head2 end_session |
1081
|
|
|
|
|
|
|
|
1082
|
|
|
|
|
|
|
当前用户退出登录.清除已验证用户的session,退出登录,并将cookie设为null。主要用于widget等web应用场合。 |
1083
|
|
|
|
|
|
|
|
1084
|
|
|
|
|
|
|
L |
1085
|
|
|
|
|
|
|
|
1086
|
|
|
|
|
|
|
=head2 update_profile |
1087
|
|
|
|
|
|
|
|
1088
|
|
|
|
|
|
|
更改资料. |
1089
|
|
|
|
|
|
|
|
1090
|
|
|
|
|
|
|
必须有一下参数中的一个或多个,参数值为字符串. 进一步的限制,请参阅下面的各个参数描述. |
1091
|
|
|
|
|
|
|
|
1092
|
|
|
|
|
|
|
name. 昵称,可选参数.不超过20个汉字 |
1093
|
|
|
|
|
|
|
gender 性别,可选参数. m,男,f,女。 |
1094
|
|
|
|
|
|
|
province 可选参数. 参考省份城市编码表 |
1095
|
|
|
|
|
|
|
city 可选参数. 参考省份城市编码表,1000为不限 |
1096
|
|
|
|
|
|
|
description. 可选参数. 不超过160个汉字. |
1097
|
|
|
|
|
|
|
|
1098
|
|
|
|
|
|
|
L |
1099
|
|
|
|
|
|
|
|
1100
|
|
|
|
|
|
|
=head2 update_profile_image |
1101
|
|
|
|
|
|
|
|
1102
|
|
|
|
|
|
|
更新用户头像 |
1103
|
|
|
|
|
|
|
|
1104
|
|
|
|
|
|
|
image.必须参数. 必须为小于700K的有效的GIF, JPG, 或 PNG 图片. 如果图片大于500像素将按比例缩放。 |
1105
|
|
|
|
|
|
|
|
1106
|
|
|
|
|
|
|
L |
1107
|
|
|
|
|
|
|
|
1108
|
|
|
|
|
|
|
=head2 favorites |
1109
|
|
|
|
|
|
|
|
1110
|
|
|
|
|
|
|
获取当前用户的收藏列表 |
1111
|
|
|
|
|
|
|
|
1112
|
|
|
|
|
|
|
page: 可选参数. 返回结果的页序号。注意:有分页限制。 |
1113
|
|
|
|
|
|
|
|
1114
|
|
|
|
|
|
|
L |
1115
|
|
|
|
|
|
|
|
1116
|
|
|
|
|
|
|
=head2 add_favorite |
1117
|
|
|
|
|
|
|
|
1118
|
|
|
|
|
|
|
添加收藏. |
1119
|
|
|
|
|
|
|
|
1120
|
|
|
|
|
|
|
id 必填参数, 要收藏的微博id |
1121
|
|
|
|
|
|
|
|
1122
|
|
|
|
|
|
|
L |
1123
|
|
|
|
|
|
|
|
1124
|
|
|
|
|
|
|
=head2 remove_favorite |
1125
|
|
|
|
|
|
|
|
1126
|
|
|
|
|
|
|
删除当前用户收藏的微博信息 |
1127
|
|
|
|
|
|
|
|
1128
|
|
|
|
|
|
|
id. 必须参数. 要删除的收藏微博信息ID. |
1129
|
|
|
|
|
|
|
|
1130
|
|
|
|
|
|
|
L |
1131
|
|
|
|
|
|
|
|
1132
|
|
|
|
|
|
|
=head2 batch_remove_favorites |
1133
|
|
|
|
|
|
|
|
1134
|
|
|
|
|
|
|
批量删除收藏的微博信息 |
1135
|
|
|
|
|
|
|
|
1136
|
|
|
|
|
|
|
ids 必选参数,想要删除收藏微博的id,多个id之间用半角逗号分割,支持最多20个。 |
1137
|
|
|
|
|
|
|
|
1138
|
|
|
|
|
|
|
L |
1139
|
|
|
|
|
|
|
|
1140
|
|
|
|
|
|
|
=head1 DEVELOPERS |
1141
|
|
|
|
|
|
|
|
1142
|
|
|
|
|
|
|
The latest code for this module can be found at |
1143
|
|
|
|
|
|
|
|
1144
|
|
|
|
|
|
|
L |
1145
|
|
|
|
|
|
|
|
1146
|
|
|
|
|
|
|
Author blog: (Chinese) |
1147
|
|
|
|
|
|
|
|
1148
|
|
|
|
|
|
|
L |
1149
|
|
|
|
|
|
|
|
1150
|
|
|
|
|
|
|
=head1 SUPPORT |
1151
|
|
|
|
|
|
|
|
1152
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
1153
|
|
|
|
|
|
|
|
1154
|
|
|
|
|
|
|
perldoc Net::SinaWeibo |
1155
|
|
|
|
|
|
|
|
1156
|
|
|
|
|
|
|
You can also look for information at: |
1157
|
|
|
|
|
|
|
|
1158
|
|
|
|
|
|
|
=over |
1159
|
|
|
|
|
|
|
|
1160
|
|
|
|
|
|
|
=item Issues tracker: |
1161
|
|
|
|
|
|
|
|
1162
|
|
|
|
|
|
|
L |
1163
|
|
|
|
|
|
|
|
1164
|
|
|
|
|
|
|
=back |
1165
|
|
|
|
|
|
|
|
1166
|
|
|
|
|
|
|
=head1 SEE ALSO |
1167
|
|
|
|
|
|
|
|
1168
|
|
|
|
|
|
|
=over |
1169
|
|
|
|
|
|
|
|
1170
|
|
|
|
|
|
|
=item SinaWeibo Developer Site |
1171
|
|
|
|
|
|
|
|
1172
|
|
|
|
|
|
|
L |
1173
|
|
|
|
|
|
|
|
1174
|
|
|
|
|
|
|
=item OAuth L |
1175
|
|
|
|
|
|
|
|
1176
|
|
|
|
|
|
|
=item L |
1177
|
|
|
|
|
|
|
|
1178
|
|
|
|
|
|
|
=item L |
1179
|
|
|
|
|
|
|
|
1180
|
|
|
|
|
|
|
=back |
1181
|
|
|
|
|
|
|
|
1182
|
|
|
|
|
|
|
=head1 AUTHOR |
1183
|
|
|
|
|
|
|
|
1184
|
|
|
|
|
|
|
Pan Fan(nightsailer) |
1185
|
|
|
|
|
|
|
|
1186
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
1187
|
|
|
|
|
|
|
|
1188
|
|
|
|
|
|
|
This software is copyright (c) 2010 by Pan Fan(nightsailer). |
1189
|
|
|
|
|
|
|
|
1190
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
1191
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
1192
|
|
|
|
|
|
|
|
1193
|
|
|
|
|
|
|
=cut |
1194
|
|
|
|
|
|
|
|
1195
|
|
|
|
|
|
|
|
1196
|
|
|
|
|
|
|
__END__ |