fbcrawl-colly 0.2.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -2
- data/Dockerfile +14 -0
- data/Gemfile.lock +8 -7
- data/README.md +1 -1
- data/fbcrawl-colly.gemspec +2 -6
- data/fbcrawl.proto +80 -3
- data/{fbcolly → fbcrawl}/fbcolly.go +154 -90
- data/fbcrawl/pb/fbcrawl.pb.go +1706 -0
- data/fbcrawl/pb/fbcrawl_grpc.pb.go +308 -0
- data/go.mod +4 -11
- data/go.sum +18 -10
- data/lib/fbcrawl-colly.rb +1 -4
- data/lib/fbcrawl_colly.rb +5 -0
- data/lib/fbcrawl_colly/client.rb +50 -0
- data/lib/fbcrawl_colly/version.rb +1 -1
- data/lib/pb/fbcrawl_pb.rb +122 -0
- data/lib/pb/fbcrawl_services_pb.rb +29 -0
- data/main.go +66 -74
- metadata +14 -26
- data/ext/fbcrawl_colly/.gitignore +0 -2
- data/ext/fbcrawl_colly/Makefile +0 -6
- data/ext/fbcrawl_colly/extconf.rb +0 -6
- data/lib/fbcrawl_colly/colly.rb +0 -50
- data/lib/fbcrawl_colly/ffi.rb +0 -17
data/ext/fbcrawl_colly/Makefile
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
require 'mkmf'
|
2
|
-
requirement_passed = true
|
3
|
-
requirement_passed &&= MakeMakefile::find_executable 'go'
|
4
|
-
requirement_passed &&= MakeMakefile::find_executable 'protoc'
|
5
|
-
requirement_passed &&= MakeMakefile::find_executable 'protoc-gen-go'
|
6
|
-
$makefile_created = requirement_passed
|
data/lib/fbcrawl_colly/colly.rb
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
require 'ffi'
|
2
|
-
require_relative '../fbcrawl_pb'
|
3
|
-
require_relative './ffi'
|
4
|
-
|
5
|
-
module FbcrawlColly
|
6
|
-
class Colly
|
7
|
-
def initialize
|
8
|
-
super
|
9
|
-
@colly = ::FFI::AutoPointer.new(FbcrawlColly::FFI::Init(), FbcrawlColly::FFI.method(:FreeColly))
|
10
|
-
end
|
11
|
-
|
12
|
-
def login(email, password)
|
13
|
-
s, ptr = FbcrawlColly::FFI.Login(@colly, email, password)
|
14
|
-
FbcrawlColly::FFI.free(ptr)
|
15
|
-
s
|
16
|
-
end
|
17
|
-
|
18
|
-
def login_with_cookies(cookies)
|
19
|
-
FbcrawlColly::FFI.LoginWithCookies(@colly, cookies)
|
20
|
-
end
|
21
|
-
|
22
|
-
def fetch_group_feed(group_id)
|
23
|
-
s, ptr = FbcrawlColly::FFI.FetchGroupFeed(@colly, group_id)
|
24
|
-
list = FbcrawlColly::FacebookPostList.decode(s)
|
25
|
-
FbcrawlColly::FFI.free(ptr)
|
26
|
-
list
|
27
|
-
end
|
28
|
-
|
29
|
-
def fetch_post(group_id, post_id)
|
30
|
-
s, ptr = FbcrawlColly::FFI.FetchPost(@colly, group_id, post_id)
|
31
|
-
post = FbcrawlColly::FacebookPost.decode(s)
|
32
|
-
FbcrawlColly::FFI.free(ptr)
|
33
|
-
post
|
34
|
-
end
|
35
|
-
|
36
|
-
def fetch_content_images(post_id)
|
37
|
-
s, ptr = FbcrawlColly::FFI.FetchContentImages(@colly, post_id)
|
38
|
-
imageList = FbcrawlColly::FacebookImageList.decode(s)
|
39
|
-
FbcrawlColly::FFI.free(ptr)
|
40
|
-
imageList
|
41
|
-
end
|
42
|
-
|
43
|
-
def fetch_image_url(image_id)
|
44
|
-
s, ptr = FbcrawlColly::FFI.FetchImageUrl(@colly, image_id)
|
45
|
-
image = FbcrawlColly::FacebookImage.decode(s)
|
46
|
-
FbcrawlColly::FFI.free(ptr)
|
47
|
-
image
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
data/lib/fbcrawl_colly/ffi.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'ffi'
|
2
|
-
module FbcrawlColly::FFI
|
3
|
-
extend FFI::Library
|
4
|
-
|
5
|
-
ffi_lib File.expand_path("../../ext/fbcrawl_colly/fbcolly.so", File.dirname(__FILE__))
|
6
|
-
attach_function :free, [ :pointer ], :void
|
7
|
-
|
8
|
-
attach_function :Init, [], :pointer
|
9
|
-
attach_function :FreeColly, [:pointer], :pointer
|
10
|
-
attach_function :Login, [:pointer, :string, :string], :strptr
|
11
|
-
attach_function :LoginWithCookies, [:pointer, :string], :void
|
12
|
-
attach_function :FetchGroupFeed, [:pointer, :int64], :strptr
|
13
|
-
attach_function :FetchPost, [:pointer, :int64, :int64], :strptr
|
14
|
-
attach_function :FetchContentImages, [:pointer, :int64], :strptr
|
15
|
-
attach_function :FetchImageUrl, [:pointer, :int64], :strptr
|
16
|
-
# attach_function :FetchGroup, [:pointer, :string], :pointer
|
17
|
-
end
|