fbcrawl-colly 0.2.2 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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,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
@@ -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