fbcrawl-colly 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,6 +23,7 @@ type GrpcClient interface {
23
23
  Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginResponse, error)
24
24
  LoginWithCookies(ctx context.Context, in *LoginWithCookiesRequest, opts ...grpc.CallOption) (*Empty, error)
25
25
  FetchGroupInfo(ctx context.Context, in *FetchGroupInfoRequest, opts ...grpc.CallOption) (*FacebookGroup, error)
26
+ FetchUserInfo(ctx context.Context, in *FetchUserInfoRequest, opts ...grpc.CallOption) (*FacebookUser, error)
26
27
  FetchGroupFeed(ctx context.Context, in *FetchGroupFeedRequest, opts ...grpc.CallOption) (*FacebookPostList, error)
27
28
  FetchPost(ctx context.Context, in *FetchPostRequest, opts ...grpc.CallOption) (*FacebookPost, error)
28
29
  FetchContentImages(ctx context.Context, in *FetchContentImagesRequest, opts ...grpc.CallOption) (*FacebookImageList, error)
@@ -82,6 +83,15 @@ func (c *grpcClient) FetchGroupInfo(ctx context.Context, in *FetchGroupInfoReque
82
83
  return out, nil
83
84
  }
84
85
 
86
+ func (c *grpcClient) FetchUserInfo(ctx context.Context, in *FetchUserInfoRequest, opts ...grpc.CallOption) (*FacebookUser, error) {
87
+ out := new(FacebookUser)
88
+ err := c.cc.Invoke(ctx, "/fbcrawl_colly.Grpc/FetchUserInfo", in, out, opts...)
89
+ if err != nil {
90
+ return nil, err
91
+ }
92
+ return out, nil
93
+ }
94
+
85
95
  func (c *grpcClient) FetchGroupFeed(ctx context.Context, in *FetchGroupFeedRequest, opts ...grpc.CallOption) (*FacebookPostList, error) {
86
96
  out := new(FacebookPostList)
87
97
  err := c.cc.Invoke(ctx, "/fbcrawl_colly.Grpc/FetchGroupFeed", in, out, opts...)
@@ -128,6 +138,7 @@ type GrpcServer interface {
128
138
  Login(context.Context, *LoginRequest) (*LoginResponse, error)
129
139
  LoginWithCookies(context.Context, *LoginWithCookiesRequest) (*Empty, error)
130
140
  FetchGroupInfo(context.Context, *FetchGroupInfoRequest) (*FacebookGroup, error)
141
+ FetchUserInfo(context.Context, *FetchUserInfoRequest) (*FacebookUser, error)
131
142
  FetchGroupFeed(context.Context, *FetchGroupFeedRequest) (*FacebookPostList, error)
132
143
  FetchPost(context.Context, *FetchPostRequest) (*FacebookPost, error)
133
144
  FetchContentImages(context.Context, *FetchContentImagesRequest) (*FacebookImageList, error)
@@ -154,6 +165,9 @@ func (*UnimplementedGrpcServer) LoginWithCookies(context.Context, *LoginWithCook
154
165
  func (*UnimplementedGrpcServer) FetchGroupInfo(context.Context, *FetchGroupInfoRequest) (*FacebookGroup, error) {
155
166
  return nil, status.Errorf(codes.Unimplemented, "method FetchGroupInfo not implemented")
156
167
  }
168
+ func (*UnimplementedGrpcServer) FetchUserInfo(context.Context, *FetchUserInfoRequest) (*FacebookUser, error) {
169
+ return nil, status.Errorf(codes.Unimplemented, "method FetchUserInfo not implemented")
170
+ }
157
171
  func (*UnimplementedGrpcServer) FetchGroupFeed(context.Context, *FetchGroupFeedRequest) (*FacebookPostList, error) {
158
172
  return nil, status.Errorf(codes.Unimplemented, "method FetchGroupFeed not implemented")
159
173
  }
@@ -262,6 +276,24 @@ func _Grpc_FetchGroupInfo_Handler(srv interface{}, ctx context.Context, dec func
262
276
  return interceptor(ctx, in, info, handler)
263
277
  }
264
278
 
279
+ func _Grpc_FetchUserInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
280
+ in := new(FetchUserInfoRequest)
281
+ if err := dec(in); err != nil {
282
+ return nil, err
283
+ }
284
+ if interceptor == nil {
285
+ return srv.(GrpcServer).FetchUserInfo(ctx, in)
286
+ }
287
+ info := &grpc.UnaryServerInfo{
288
+ Server: srv,
289
+ FullMethod: "/fbcrawl_colly.Grpc/FetchUserInfo",
290
+ }
291
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
292
+ return srv.(GrpcServer).FetchUserInfo(ctx, req.(*FetchUserInfoRequest))
293
+ }
294
+ return interceptor(ctx, in, info, handler)
295
+ }
296
+
265
297
  func _Grpc_FetchGroupFeed_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
266
298
  in := new(FetchGroupFeedRequest)
267
299
  if err := dec(in); err != nil {
@@ -358,6 +390,10 @@ var _Grpc_serviceDesc = grpc.ServiceDesc{
358
390
  MethodName: "FetchGroupInfo",
359
391
  Handler: _Grpc_FetchGroupInfo_Handler,
360
392
  },
393
+ {
394
+ MethodName: "FetchUserInfo",
395
+ Handler: _Grpc_FetchUserInfo_Handler,
396
+ },
361
397
  {
362
398
  MethodName: "FetchGroupFeed",
363
399
  Handler: _Grpc_FetchGroupFeed_Handler,
@@ -19,6 +19,10 @@ module FbcrawlColly
19
19
  s = @client.login_with_cookies(FbcrawlColly::LoginWithCookiesRequest.new(pointer: @colly, cookies: cookies))
20
20
  end
21
21
 
22
+ def fetch_user_info(username)
23
+ s = @client.fetch_user_info(FbcrawlColly::FetchUserInfoRequest.new(pointer: @colly, username: username))
24
+ end
25
+
22
26
  def fetch_group_info(group_id_or_username)
23
27
  s = @client.fetch_group_info(FbcrawlColly::FetchGroupInfoRequest.new(pointer: @colly, group_username: group_id_or_username))
24
28
  end
@@ -1,3 +1,3 @@
1
1
  module FbcrawlColly
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -27,6 +27,10 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
27
27
  optional :pointer, :message, 1, "fbcrawl_colly.Pointer"
28
28
  optional :group_username, :string, 2
29
29
  end
30
+ add_message "fbcrawl_colly.FetchUserInfoRequest" do
31
+ optional :pointer, :message, 1, "fbcrawl_colly.Pointer"
32
+ optional :username, :string, 2
33
+ end
30
34
  add_message "fbcrawl_colly.FetchGroupFeedRequest" do
31
35
  optional :pointer, :message, 1, "fbcrawl_colly.Pointer"
32
36
  optional :group_id, :int64, 2
@@ -55,6 +59,8 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
55
59
  add_message "fbcrawl_colly.FacebookUser" do
56
60
  optional :id, :int64, 1
57
61
  optional :name, :string, 2
62
+ optional :username, :string, 3
63
+ optional :friend_count, :int64, 4
58
64
  end
59
65
  add_message "fbcrawl_colly.FacebookPost" do
60
66
  optional :id, :int64, 1
@@ -102,6 +108,7 @@ module FbcrawlColly
102
108
  LoginResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("fbcrawl_colly.LoginResponse").msgclass
103
109
  LoginWithCookiesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("fbcrawl_colly.LoginWithCookiesRequest").msgclass
104
110
  FetchGroupInfoRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("fbcrawl_colly.FetchGroupInfoRequest").msgclass
111
+ FetchUserInfoRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("fbcrawl_colly.FetchUserInfoRequest").msgclass
105
112
  FetchGroupFeedRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("fbcrawl_colly.FetchGroupFeedRequest").msgclass
106
113
  FetchPostRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("fbcrawl_colly.FetchPostRequest").msgclass
107
114
  FetchContentImagesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("fbcrawl_colly.FetchContentImagesRequest").msgclass
@@ -20,6 +20,7 @@ module FbcrawlColly
20
20
  rpc :Login, FbcrawlColly::LoginRequest, FbcrawlColly::LoginResponse
21
21
  rpc :LoginWithCookies, FbcrawlColly::LoginWithCookiesRequest, FbcrawlColly::Empty
22
22
  rpc :FetchGroupInfo, FbcrawlColly::FetchGroupInfoRequest, FbcrawlColly::FacebookGroup
23
+ rpc :FetchUserInfo, FbcrawlColly::FetchUserInfoRequest, FbcrawlColly::FacebookUser
23
24
  rpc :FetchGroupFeed, FbcrawlColly::FetchGroupFeedRequest, FbcrawlColly::FacebookPostList
24
25
  rpc :FetchPost, FbcrawlColly::FetchPostRequest, FbcrawlColly::FacebookPost
25
26
  rpc :FetchContentImages, FbcrawlColly::FetchContentImagesRequest, FbcrawlColly::FacebookImageList
data/main.go CHANGED
@@ -73,6 +73,12 @@ func (s server) FetchGroupInfo(ctx context.Context, request *pb.FetchGroupInfoRe
73
73
  return groupInfo, err
74
74
  }
75
75
 
76
+ func (s server) FetchUserInfo(ctx context.Context, request *pb.FetchUserInfoRequest) (*pb.FacebookUser, error) {
77
+ p := getColly(request.Pointer)
78
+ err, userInfo := p.FetchUserInfo(request.Username)
79
+ return userInfo, err
80
+ }
81
+
76
82
  func (s server) FetchGroupFeed(ctx context.Context, request *pb.FetchGroupFeedRequest) (*pb.FacebookPostList, error) {
77
83
  p := getColly(request.Pointer)
78
84
  err, postsList := p.FetchGroupFeed(request.GroupId, request.NextCursor)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fbcrawl-colly
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Duy Le