scrapio 1.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31b0030dedce45ac96d108f4869e218f6b40ea6db264f981319a252610366961
4
- data.tar.gz: 79d78805bb3ec04fe89dacdc179b775397f02bcef4c0eb58c724905fa0f1117c
3
+ metadata.gz: a9bb182980da7baea813ef5f1763220cb8524a027215ca7165dd69fed53d0341
4
+ data.tar.gz: 8eafab5f4f8ae2fa05c7a7ff35911e8bf5ffc99578ef841cb580cde5061881a2
5
5
  SHA512:
6
- metadata.gz: d43cf4d5884ce7e8d26ec17e047bc1b60f472f212eb1dacd592ccef58b30ecb3a0adc08b5bb33fe0272942bad6f19ec523d1217312b2995375c9f3eaa37bd940
7
- data.tar.gz: 5c0c8c7425d7a27629fe9c3db0ef473de69f64dd7267a98d193a31614f350cf45c81fa26a961972b7e2daae14d70b0328a58e6828657b348b434523b3d133cd0
6
+ metadata.gz: 0de0b77f446621dccd8256ed12b900024d3509e19de295e4b283443b7123ac505cf3c3ca391cd05255935d65e2312b59741190c43ba2b387269e7064738709ce
7
+ data.tar.gz: c0ea3e7e07234cdfe05ca9eddd70cfec7c1b6bd4efa1e6c40c4bac3c36b1e36e2fdad5d1d6a12d7f9d6da5cca83ce1dba341b4d87264b1c5778802d8ca7abae3
@@ -13,11 +13,20 @@ require_relative "resources/map"
13
13
  require_relative "resources/booking"
14
14
  require_relative "resources/agoda"
15
15
  require_relative "resources/airbnb"
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"
16
24
  require_relative "resources/chatgpt"
17
25
  require_relative "resources/perplexity"
18
26
  require_relative "resources/gemini"
19
27
  require_relative "resources/bing"
20
28
  require_relative "resources/reddit"
29
+ require_relative "resources/hacker_news"
21
30
  require_relative "resources/tiktok"
22
31
  require_relative "resources/target"
23
32
  require_relative "resources/apple_app_store"
@@ -26,7 +35,8 @@ module Scrapio
26
35
  class Client
27
36
  attr_reader :fetch, :google, :amazon, :walmart, :youtube, :jobs, :crawl, :interact,
28
37
  :fast_search, :search, :map, :booking, :agoda,
29
- :airbnb, :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
30
40
 
31
41
  def initialize(api_key, base_url: HttpClient::DEFAULT_BASE_URL, timeout: HttpClient::DEFAULT_TIMEOUT)
32
42
  http = HttpClient.new(api_key, base_url: base_url, timeout: timeout)
@@ -45,6 +55,14 @@ module Scrapio
45
55
  @booking = Resources::Booking.new(http)
46
56
  @agoda = Resources::Agoda.new(http)
47
57
  @airbnb = Resources::Airbnb.new(http)
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)
48
66
  @chatgpt = Resources::Chatgpt.new(http)
49
67
  @perplexity = Resources::Perplexity.new(http)
50
68
  @gemini = Resources::Gemini.new(http)
@@ -53,6 +71,7 @@ module Scrapio
53
71
  @tiktok = Resources::TikTok.new(http)
54
72
  @target = Resources::Target.new(http)
55
73
  @apple_app_store = Resources::AppleAppStore.new(http)
74
+ @hacker_news = Resources::HackerNews.new(http)
56
75
  end
57
76
  end
58
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
@@ -0,0 +1,21 @@
1
+ module Scrapio
2
+ module Resources
3
+ class Autotrader
4
+ def initialize(http) = @http = http
5
+
6
+ def search(postcode:, radius: nil, make: nil, model: nil, year_from: nil, year_to: nil, exclude_writeoffs: nil, page: nil, geo: nil)
7
+ @http.get("/v1/autotrader/search", {
8
+ postcode: postcode, radius: radius, make: make, model: model,
9
+ year_from: year_from, year_to: year_to,
10
+ exclude_writeoffs: exclude_writeoffs, page: page, geo: geo,
11
+ })
12
+ end
13
+
14
+ def get_listing(listing_id, geo: nil)
15
+ @http.get("/v1/autotrader/listing", {
16
+ listing_id: listing_id, geo: geo,
17
+ })
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,13 @@
1
+ module Scrapio
2
+ module Resources
3
+ class Builtin
4
+ def initialize(http) = @http = http
5
+
6
+ def jobs(query:, limit: nil, cursor: nil)
7
+ @http.get("/v1/builtin/jobs", {
8
+ query: query, limit: limit, cursor: cursor,
9
+ })
10
+ end
11
+ end
12
+ end
13
+ 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 Wellfound
4
+ def initialize(http) = @http = http
5
+
6
+ def jobs(role:, limit: nil, cursor: nil)
7
+ @http.get("/v1/wellfound/jobs", {
8
+ role: role, limit: limit, cursor: cursor,
9
+ })
10
+ end
11
+ end
12
+ end
13
+ 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
@@ -1,4 +1,5 @@
1
1
  require_relative "scrapio/errors"
2
+ require_relative "scrapio/proxy_mode"
2
3
  require_relative "scrapio/client"
3
4
 
4
5
  module Scrapio
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.2.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scrapio
@@ -22,28 +22,38 @@ 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
28
29
  - lib/scrapio/resources/apple_app_store.rb
30
+ - lib/scrapio/resources/autotrader.rb
29
31
  - lib/scrapio/resources/bing.rb
30
32
  - lib/scrapio/resources/booking.rb
33
+ - lib/scrapio/resources/builtin.rb
31
34
  - lib/scrapio/resources/chatgpt.rb
32
35
  - lib/scrapio/resources/crawl.rb
36
+ - lib/scrapio/resources/dice.rb
33
37
  - lib/scrapio/resources/fast_search.rb
34
38
  - lib/scrapio/resources/fetch.rb
35
39
  - lib/scrapio/resources/gemini.rb
40
+ - lib/scrapio/resources/glassdoor.rb
36
41
  - lib/scrapio/resources/google.rb
42
+ - lib/scrapio/resources/hacker_news.rb
37
43
  - lib/scrapio/resources/interact.rb
38
44
  - lib/scrapio/resources/jobs.rb
39
45
  - lib/scrapio/resources/map.rb
40
46
  - lib/scrapio/resources/perplexity.rb
41
47
  - lib/scrapio/resources/reddit.rb
42
48
  - lib/scrapio/resources/search.rb
49
+ - lib/scrapio/resources/simplyhired.rb
43
50
  - lib/scrapio/resources/target.rb
44
51
  - lib/scrapio/resources/tiktok.rb
52
+ - lib/scrapio/resources/trustpilot.rb
45
53
  - lib/scrapio/resources/walmart.rb
54
+ - lib/scrapio/resources/wellfound.rb
46
55
  - lib/scrapio/resources/youtube.rb
56
+ - lib/scrapio/resources/ziprecruiter.rb
47
57
  homepage: https://scrapio.dev
48
58
  licenses:
49
59
  - MIT