scrapio 1.3.0 → 1.5.0
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.
- checksums.yaml +4 -4
- data/lib/scrapio/client.rb +18 -1
- data/lib/scrapio/proxy_mode.rb +23 -0
- data/lib/scrapio/resources/builtin.rb +13 -0
- data/lib/scrapio/resources/crawl.rb +3 -2
- data/lib/scrapio/resources/dice.rb +13 -0
- data/lib/scrapio/resources/fetch.rb +5 -1
- data/lib/scrapio/resources/glassdoor.rb +17 -0
- data/lib/scrapio/resources/hacker_news.rb +30 -0
- data/lib/scrapio/resources/interact.rb +3 -2
- data/lib/scrapio/resources/map.rb +2 -1
- data/lib/scrapio/resources/simplyhired.rb +13 -0
- data/lib/scrapio/resources/trustpilot.rb +14 -0
- data/lib/scrapio/resources/wellfound.rb +13 -0
- data/lib/scrapio/resources/ziprecruiter.rb +13 -0
- data/lib/scrapio.rb +1 -0
- metadata +10 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a9bb182980da7baea813ef5f1763220cb8524a027215ca7165dd69fed53d0341
|
|
4
|
+
data.tar.gz: 8eafab5f4f8ae2fa05c7a7ff35911e8bf5ffc99578ef841cb580cde5061881a2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0de0b77f446621dccd8256ed12b900024d3509e19de295e4b283443b7123ac505cf3c3ca391cd05255935d65e2312b59741190c43ba2b387269e7064738709ce
|
|
7
|
+
data.tar.gz: c0ea3e7e07234cdfe05ca9eddd70cfec7c1b6bd4efa1e6c40c4bac3c36b1e36e2fdad5d1d6a12d7f9d6da5cca83ce1dba341b4d87264b1c5778802d8ca7abae3
|
data/lib/scrapio/client.rb
CHANGED
|
@@ -14,11 +14,19 @@ require_relative "resources/booking"
|
|
|
14
14
|
require_relative "resources/agoda"
|
|
15
15
|
require_relative "resources/airbnb"
|
|
16
16
|
require_relative "resources/autotrader"
|
|
17
|
+
require_relative "resources/glassdoor"
|
|
18
|
+
require_relative "resources/trustpilot"
|
|
19
|
+
require_relative "resources/ziprecruiter"
|
|
20
|
+
require_relative "resources/dice"
|
|
21
|
+
require_relative "resources/simplyhired"
|
|
22
|
+
require_relative "resources/builtin"
|
|
23
|
+
require_relative "resources/wellfound"
|
|
17
24
|
require_relative "resources/chatgpt"
|
|
18
25
|
require_relative "resources/perplexity"
|
|
19
26
|
require_relative "resources/gemini"
|
|
20
27
|
require_relative "resources/bing"
|
|
21
28
|
require_relative "resources/reddit"
|
|
29
|
+
require_relative "resources/hacker_news"
|
|
22
30
|
require_relative "resources/tiktok"
|
|
23
31
|
require_relative "resources/target"
|
|
24
32
|
require_relative "resources/apple_app_store"
|
|
@@ -27,7 +35,8 @@ module Scrapio
|
|
|
27
35
|
class Client
|
|
28
36
|
attr_reader :fetch, :google, :amazon, :walmart, :youtube, :jobs, :crawl, :interact,
|
|
29
37
|
:fast_search, :search, :map, :booking, :agoda,
|
|
30
|
-
:airbnb, :autotrader, :chatgpt, :perplexity, :gemini, :bing, :reddit, :tiktok, :target, :apple_app_store
|
|
38
|
+
:airbnb, :autotrader, :chatgpt, :perplexity, :gemini, :bing, :reddit, :tiktok, :target, :apple_app_store,
|
|
39
|
+
:hacker_news, :glassdoor, :trustpilot, :ziprecruiter, :dice, :simplyhired, :builtin, :wellfound
|
|
31
40
|
|
|
32
41
|
def initialize(api_key, base_url: HttpClient::DEFAULT_BASE_URL, timeout: HttpClient::DEFAULT_TIMEOUT)
|
|
33
42
|
http = HttpClient.new(api_key, base_url: base_url, timeout: timeout)
|
|
@@ -47,6 +56,13 @@ module Scrapio
|
|
|
47
56
|
@agoda = Resources::Agoda.new(http)
|
|
48
57
|
@airbnb = Resources::Airbnb.new(http)
|
|
49
58
|
@autotrader = Resources::Autotrader.new(http)
|
|
59
|
+
@glassdoor = Resources::Glassdoor.new(http)
|
|
60
|
+
@trustpilot = Resources::Trustpilot.new(http)
|
|
61
|
+
@ziprecruiter = Resources::Ziprecruiter.new(http)
|
|
62
|
+
@dice = Resources::Dice.new(http)
|
|
63
|
+
@simplyhired = Resources::Simplyhired.new(http)
|
|
64
|
+
@builtin = Resources::Builtin.new(http)
|
|
65
|
+
@wellfound = Resources::Wellfound.new(http)
|
|
50
66
|
@chatgpt = Resources::Chatgpt.new(http)
|
|
51
67
|
@perplexity = Resources::Perplexity.new(http)
|
|
52
68
|
@gemini = Resources::Gemini.new(http)
|
|
@@ -55,6 +71,7 @@ module Scrapio
|
|
|
55
71
|
@tiktok = Resources::TikTok.new(http)
|
|
56
72
|
@target = Resources::Target.new(http)
|
|
57
73
|
@apple_app_store = Resources::AppleAppStore.new(http)
|
|
74
|
+
@hacker_news = Resources::HackerNews.new(http)
|
|
58
75
|
end
|
|
59
76
|
end
|
|
60
77
|
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Scrapio
|
|
2
|
+
# How far a request may escalate to get past anti-bot defenses. Pass one of
|
|
3
|
+
# these as `proxy:` to Fetch#fetch, Crawl#crawl, Interact#interact, or as the
|
|
4
|
+
# "proxy" key of a Map#execute request.
|
|
5
|
+
#
|
|
6
|
+
# BASIC no proxy at all (cheapest). If the target blocks it the request
|
|
7
|
+
# fails with `proxy_required`; retry with AUTO.
|
|
8
|
+
# STEALTH straight to the strongest tier, a hardened browser behind a
|
|
9
|
+
# residential proxy (paid plans).
|
|
10
|
+
# AUTO cheap steps first, escalating to a residential proxy only when
|
|
11
|
+
# needed, billed by the step that served the request (paid plans, the
|
|
12
|
+
# default).
|
|
13
|
+
#
|
|
14
|
+
# The Free plan is always BASIC; STEALTH and AUTO return 402 there. The response's
|
|
15
|
+
# `usage` hash reports what the request cost: credits, base, surcharge and tier
|
|
16
|
+
# ("standard" +0, "proxy" +4, "proxy_browser" +10, "stealth" +65, "cloudflare" +65).
|
|
17
|
+
module ProxyMode
|
|
18
|
+
BASIC = "basic".freeze
|
|
19
|
+
STEALTH = "stealth".freeze
|
|
20
|
+
AUTO = "auto".freeze
|
|
21
|
+
ALL = [BASIC, STEALTH, AUTO].freeze
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -3,12 +3,13 @@ module Scrapio
|
|
|
3
3
|
class Crawl
|
|
4
4
|
def initialize(http) = @http = http
|
|
5
5
|
|
|
6
|
+
# proxy: "basic", "stealth" or "auto" (see Scrapio::ProxyMode); applies to every page.
|
|
6
7
|
def crawl(seeds:, max_pages: nil, max_depth: nil, same_domain_only: nil,
|
|
7
|
-
output: nil, extract: nil, timeout_ms: nil)
|
|
8
|
+
output: nil, extract: nil, timeout_ms: nil, proxy: nil)
|
|
8
9
|
@http.post("/v1/crawl", {
|
|
9
10
|
seeds: seeds, max_pages: max_pages, max_depth: max_depth,
|
|
10
11
|
same_domain_only: same_domain_only, output: output,
|
|
11
|
-
extract: extract, timeout_ms: timeout_ms,
|
|
12
|
+
extract: extract, timeout_ms: timeout_ms, proxy: proxy,
|
|
12
13
|
})
|
|
13
14
|
end
|
|
14
15
|
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Scrapio
|
|
2
|
+
module Resources
|
|
3
|
+
class Dice
|
|
4
|
+
def initialize(http) = @http = http
|
|
5
|
+
|
|
6
|
+
def jobs(query:, location: nil, limit: nil, cursor: nil)
|
|
7
|
+
@http.get("/v1/dice/jobs", {
|
|
8
|
+
query: query, location: location, limit: limit, cursor: cursor,
|
|
9
|
+
})
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -3,11 +3,15 @@ module Scrapio
|
|
|
3
3
|
class Fetch
|
|
4
4
|
def initialize(http) = @http = http
|
|
5
5
|
|
|
6
|
+
# proxy: "basic", "stealth" or "auto" (see Scrapio::ProxyMode); nil uses the plan
|
|
7
|
+
# default. timeout_ms is the per-attempt budget: 10000 by default, 20000 with
|
|
8
|
+
# proxy: "stealth".
|
|
6
9
|
def fetch(url:, render_js: nil, device: nil, session: nil, output: nil,
|
|
7
|
-
extract: nil, wait_for: nil, timeout_ms: nil)
|
|
10
|
+
extract: nil, wait_for: nil, timeout_ms: nil, proxy: nil)
|
|
8
11
|
@http.post("/v1/fetch", {
|
|
9
12
|
url: url, render_js: render_js, device: device, session: session,
|
|
10
13
|
output: output, extract: extract, wait_for: wait_for, timeout_ms: timeout_ms,
|
|
14
|
+
proxy: proxy,
|
|
11
15
|
})
|
|
12
16
|
end
|
|
13
17
|
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Scrapio
|
|
2
|
+
module Resources
|
|
3
|
+
class Glassdoor
|
|
4
|
+
def initialize(http) = @http = http
|
|
5
|
+
|
|
6
|
+
def jobs(query:, location: nil, limit: nil, cursor: nil)
|
|
7
|
+
@http.get("/v1/glassdoor/jobs", {
|
|
8
|
+
query: query, location: location, limit: limit, cursor: cursor,
|
|
9
|
+
})
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def job_detail(job_id:)
|
|
13
|
+
@http.get("/v1/glassdoor/job", { job_id: job_id })
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module Scrapio
|
|
2
|
+
module Resources
|
|
3
|
+
class HackerNews
|
|
4
|
+
def initialize(http) = @http = http
|
|
5
|
+
|
|
6
|
+
def get_item(id:, include_comments: nil)
|
|
7
|
+
@http.get("/v1/hacker-news/item", { id: id, include_comments: include_comments })
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def get_user(username:)
|
|
11
|
+
@http.get("/v1/hacker-news/user", { username: username })
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def search(query:, tags: nil, since: nil, sort: nil, page: nil, hits_per_page: nil)
|
|
15
|
+
@http.get("/v1/hacker-news/search", {
|
|
16
|
+
query: query,
|
|
17
|
+
tags: tags && tags.join(","),
|
|
18
|
+
since: since,
|
|
19
|
+
sort: sort,
|
|
20
|
+
page: page,
|
|
21
|
+
hits_per_page: hits_per_page
|
|
22
|
+
})
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def get_stories(type:, limit: nil)
|
|
26
|
+
@http.get("/v1/hacker-news/stories", { type: type, limit: limit })
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -3,11 +3,12 @@ module Scrapio
|
|
|
3
3
|
class Interact
|
|
4
4
|
def initialize(http) = @http = http
|
|
5
5
|
|
|
6
|
+
# proxy: "basic", "stealth" or "auto" (see Scrapio::ProxyMode); nil uses the plan default.
|
|
6
7
|
def interact(url:, actions:, device: nil, session: nil,
|
|
7
|
-
output: nil, extract: nil, timeout_ms: nil)
|
|
8
|
+
output: nil, extract: nil, timeout_ms: nil, proxy: nil)
|
|
8
9
|
@http.post("/v1/interact", {
|
|
9
10
|
url: url, actions: actions, device: device, session: session,
|
|
10
|
-
output: output, extract: extract, timeout_ms: timeout_ms,
|
|
11
|
+
output: output, extract: extract, timeout_ms: timeout_ms, proxy: proxy,
|
|
11
12
|
})
|
|
12
13
|
end
|
|
13
14
|
end
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
module Scrapio
|
|
2
2
|
module Resources
|
|
3
3
|
# POST /v1/map -- site-map/URL-discovery workflow. Untyped request/response,
|
|
4
|
-
# same reasoning as Search.
|
|
4
|
+
# same reasoning as Search. The request accepts "proxy" ("basic", "stealth" or
|
|
5
|
+
# "auto", see Scrapio::ProxyMode).
|
|
5
6
|
class Map
|
|
6
7
|
def initialize(http) = @http = http
|
|
7
8
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Scrapio
|
|
2
|
+
module Resources
|
|
3
|
+
class Simplyhired
|
|
4
|
+
def initialize(http) = @http = http
|
|
5
|
+
|
|
6
|
+
def jobs(query:, location: nil, limit: nil, cursor: nil)
|
|
7
|
+
@http.get("/v1/simplyhired/jobs", {
|
|
8
|
+
query: query, location: location, limit: limit, cursor: cursor,
|
|
9
|
+
})
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module Scrapio
|
|
2
|
+
module Resources
|
|
3
|
+
class Trustpilot
|
|
4
|
+
def initialize(http) = @http = http
|
|
5
|
+
|
|
6
|
+
def reviews(domain:, stars: nil, language: nil, verified: nil, limit: nil, cursor: nil)
|
|
7
|
+
@http.get("/v1/trustpilot/reviews", {
|
|
8
|
+
domain: domain, stars: stars, language: language,
|
|
9
|
+
verified: verified, limit: limit, cursor: cursor,
|
|
10
|
+
})
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Scrapio
|
|
2
|
+
module Resources
|
|
3
|
+
class Ziprecruiter
|
|
4
|
+
def initialize(http) = @http = http
|
|
5
|
+
|
|
6
|
+
def jobs(query:, location: nil, limit: nil, cursor: nil)
|
|
7
|
+
@http.get("/v1/ziprecruiter/jobs", {
|
|
8
|
+
query: query, location: location, limit: limit, cursor: cursor,
|
|
9
|
+
})
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
data/lib/scrapio.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: scrapio
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Scrapio
|
|
@@ -22,6 +22,7 @@ files:
|
|
|
22
22
|
- lib/scrapio/client.rb
|
|
23
23
|
- lib/scrapio/errors.rb
|
|
24
24
|
- lib/scrapio/http_client.rb
|
|
25
|
+
- lib/scrapio/proxy_mode.rb
|
|
25
26
|
- lib/scrapio/resources/agoda.rb
|
|
26
27
|
- lib/scrapio/resources/airbnb.rb
|
|
27
28
|
- lib/scrapio/resources/amazon.rb
|
|
@@ -29,22 +30,30 @@ files:
|
|
|
29
30
|
- lib/scrapio/resources/autotrader.rb
|
|
30
31
|
- lib/scrapio/resources/bing.rb
|
|
31
32
|
- lib/scrapio/resources/booking.rb
|
|
33
|
+
- lib/scrapio/resources/builtin.rb
|
|
32
34
|
- lib/scrapio/resources/chatgpt.rb
|
|
33
35
|
- lib/scrapio/resources/crawl.rb
|
|
36
|
+
- lib/scrapio/resources/dice.rb
|
|
34
37
|
- lib/scrapio/resources/fast_search.rb
|
|
35
38
|
- lib/scrapio/resources/fetch.rb
|
|
36
39
|
- lib/scrapio/resources/gemini.rb
|
|
40
|
+
- lib/scrapio/resources/glassdoor.rb
|
|
37
41
|
- lib/scrapio/resources/google.rb
|
|
42
|
+
- lib/scrapio/resources/hacker_news.rb
|
|
38
43
|
- lib/scrapio/resources/interact.rb
|
|
39
44
|
- lib/scrapio/resources/jobs.rb
|
|
40
45
|
- lib/scrapio/resources/map.rb
|
|
41
46
|
- lib/scrapio/resources/perplexity.rb
|
|
42
47
|
- lib/scrapio/resources/reddit.rb
|
|
43
48
|
- lib/scrapio/resources/search.rb
|
|
49
|
+
- lib/scrapio/resources/simplyhired.rb
|
|
44
50
|
- lib/scrapio/resources/target.rb
|
|
45
51
|
- lib/scrapio/resources/tiktok.rb
|
|
52
|
+
- lib/scrapio/resources/trustpilot.rb
|
|
46
53
|
- lib/scrapio/resources/walmart.rb
|
|
54
|
+
- lib/scrapio/resources/wellfound.rb
|
|
47
55
|
- lib/scrapio/resources/youtube.rb
|
|
56
|
+
- lib/scrapio/resources/ziprecruiter.rb
|
|
48
57
|
homepage: https://scrapio.dev
|
|
49
58
|
licenses:
|
|
50
59
|
- MIT
|