Class: FbcrawlColly::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/fbcrawl_colly/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(host_and_port) ⇒ Client

Returns a new instance of Client.



4
5
6
7
8
# File 'lib/fbcrawl_colly/client.rb', line 4

def initialize(host_and_port)
  @host_and_port = host_and_port
  @client = new_grpc_client
  @context = nil
end

Instance Method Details

#fetch_content_images(post_id, next_cursor = nil) ⇒ Object



40
41
42
# File 'lib/fbcrawl_colly/client.rb', line 40

def fetch_content_images(post_id, next_cursor = nil)
  s = @client.fetch_content_images(FbcrawlColly::FetchContentImagesRequest.new(context: @context, post_id: post_id, next_cursor: next_cursor))
end

#fetch_group_feed(group_id, next_cursor = nil) ⇒ Object



32
33
34
# File 'lib/fbcrawl_colly/client.rb', line 32

def fetch_group_feed(group_id, next_cursor = nil)
  s = @client.fetch_group_feed(FbcrawlColly::FetchGroupFeedRequest.new(context: @context, group_id: group_id, next_cursor: next_cursor))
end

#fetch_group_info(group_id_or_username) ⇒ Object



28
29
30
# File 'lib/fbcrawl_colly/client.rb', line 28

def fetch_group_info(group_id_or_username)
  s = @client.fetch_group_info(FbcrawlColly::FetchGroupInfoRequest.new(context: @context, group_username: group_id_or_username))
end

#fetch_image_url(image_id) ⇒ Object



44
45
46
# File 'lib/fbcrawl_colly/client.rb', line 44

def fetch_image_url(image_id)
  s = @client.fetch_image_url(FbcrawlColly::FetchImageUrlRequest.new(context: @context, image_id: image_id))
end

#fetch_my_groupsObject



24
25
26
# File 'lib/fbcrawl_colly/client.rb', line 24

def fetch_my_groups
  s = @client.fetch_my_groups(FbcrawlColly::FetchMyGroupsRequest.new(context: @context))
end

#fetch_post(group_id, post_id, comment_next_cursor = nil) ⇒ Object



36
37
38
# File 'lib/fbcrawl_colly/client.rb', line 36

def fetch_post(group_id, post_id, comment_next_cursor = nil)
  s = @client.fetch_post(FbcrawlColly::FetchPostRequest.new(context: @context, group_id: group_id, post_id: post_id, comment_next_cursor: comment_next_cursor))
end

#fetch_user_info(username) ⇒ Object



20
21
22
# File 'lib/fbcrawl_colly/client.rb', line 20

def (username)
  s = @client.(FbcrawlColly::FetchUserInfoRequest.new(context: @context, username: username))
end

#login(email, password, totp_secret = "") ⇒ Object



10
11
12
13
14
# File 'lib/fbcrawl_colly/client.rb', line 10

def (email, password, totp_secret = "")
  cookies = @client.(FbcrawlColly::LoginRequest.new(email: email, password: password, totp_secret: totp_secret)).cookies
  @context = FbcrawlColly::Context.new(cookies: cookies)
  cookies
end

#login_with_cookies(cookies) ⇒ Object



16
17
18
# File 'lib/fbcrawl_colly/client.rb', line 16

def (cookies)
  @context = FbcrawlColly::Context.new(cookies: cookies)
end