fbcrawl-colly 0.2.6 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,2 +0,0 @@
1
- *.so
2
- *.h
@@ -1,6 +0,0 @@
1
- all:
2
- cd ../../ && protoc fbcrawl.proto --go_out ./ --ruby_out ./lib/ && go build -o ./ext/fbcrawl_colly/fbcolly.so -buildmode=c-shared #-v -ldflags=-v .
3
- clean:
4
- rm -rf fbcolly.h fbcolly.so ../../lib/fbcrawl_pb.rb
5
- install:
6
- true
@@ -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
@@ -1,57 +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_info(group_id_or_username)
23
- s, ptr = FbcrawlColly::FFI.FetchGroupInfo(@colly, group_id_or_username.to_s)
24
- list = FbcrawlColly::FacebookGroup.decode(s)
25
- FbcrawlColly::FFI.free(ptr)
26
- list
27
- end
28
-
29
- def fetch_group_feed(group_id)
30
- s, ptr = FbcrawlColly::FFI.FetchGroupFeed(@colly, group_id)
31
- list = FbcrawlColly::FacebookPostList.decode(s)
32
- FbcrawlColly::FFI.free(ptr)
33
- list
34
- end
35
-
36
- def fetch_post(group_id, post_id)
37
- s, ptr = FbcrawlColly::FFI.FetchPost(@colly, group_id, post_id)
38
- post = FbcrawlColly::FacebookPost.decode(s)
39
- FbcrawlColly::FFI.free(ptr)
40
- post
41
- end
42
-
43
- def fetch_content_images(post_id)
44
- s, ptr = FbcrawlColly::FFI.FetchContentImages(@colly, post_id)
45
- imageList = FbcrawlColly::FacebookImageList.decode(s)
46
- FbcrawlColly::FFI.free(ptr)
47
- imageList
48
- end
49
-
50
- def fetch_image_url(image_id)
51
- s, ptr = FbcrawlColly::FFI.FetchImageUrl(@colly, image_id)
52
- image = FbcrawlColly::FacebookImage.decode(s)
53
- FbcrawlColly::FFI.free(ptr)
54
- image
55
- end
56
- end
57
- end
@@ -1,18 +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 :FetchGroupInfo, [:pointer, :string], :strptr
13
- attach_function :FetchGroupFeed, [:pointer, :int64], :strptr
14
- attach_function :FetchPost, [:pointer, :int64, :int64], :strptr
15
- attach_function :FetchContentImages, [:pointer, :int64], :strptr
16
- attach_function :FetchImageUrl, [:pointer, :int64], :strptr
17
- # attach_function :FetchGroup, [:pointer, :string], :pointer
18
- end