unitbytes 1.0.0__tar.gz

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.
Files changed (33) hide show
  1. unitbytes-1.0.0/CHANGELOG.md +16 -0
  2. unitbytes-1.0.0/LICENSE +21 -0
  3. unitbytes-1.0.0/MANIFEST.in +7 -0
  4. unitbytes-1.0.0/PKG-INFO +238 -0
  5. unitbytes-1.0.0/README.md +207 -0
  6. unitbytes-1.0.0/pyproject.toml +81 -0
  7. unitbytes-1.0.0/setup.cfg +4 -0
  8. unitbytes-1.0.0/src/unitbytes/__init__.py +43 -0
  9. unitbytes-1.0.0/src/unitbytes/_exceptions.py +94 -0
  10. unitbytes-1.0.0/src/unitbytes/_serialization.py +272 -0
  11. unitbytes-1.0.0/src/unitbytes/_transports.py +1529 -0
  12. unitbytes-1.0.0/src/unitbytes/ai.py +938 -0
  13. unitbytes-1.0.0/src/unitbytes/ali1688.py +538 -0
  14. unitbytes-1.0.0/src/unitbytes/alibaba.py +211 -0
  15. unitbytes-1.0.0/src/unitbytes/cli.py +454 -0
  16. unitbytes-1.0.0/src/unitbytes/client.py +124 -0
  17. unitbytes-1.0.0/src/unitbytes/gmaps.py +339 -0
  18. unitbytes-1.0.0/src/unitbytes/goofish.py +566 -0
  19. unitbytes-1.0.0/src/unitbytes/jobs.py +869 -0
  20. unitbytes-1.0.0/src/unitbytes/news.py +491 -0
  21. unitbytes-1.0.0/src/unitbytes/py.typed +1 -0
  22. unitbytes-1.0.0/src/unitbytes/reddit.py +342 -0
  23. unitbytes-1.0.0/src/unitbytes/rednote.py +286 -0
  24. unitbytes-1.0.0/src/unitbytes/request.py +7 -0
  25. unitbytes-1.0.0/src/unitbytes/shopping.py +644 -0
  26. unitbytes-1.0.0/src/unitbytes/travel.py +878 -0
  27. unitbytes-1.0.0/src/unitbytes/trends.py +1275 -0
  28. unitbytes-1.0.0/src/unitbytes.egg-info/PKG-INFO +238 -0
  29. unitbytes-1.0.0/src/unitbytes.egg-info/SOURCES.txt +31 -0
  30. unitbytes-1.0.0/src/unitbytes.egg-info/dependency_links.txt +1 -0
  31. unitbytes-1.0.0/src/unitbytes.egg-info/entry_points.txt +2 -0
  32. unitbytes-1.0.0/src/unitbytes.egg-info/requires.txt +6 -0
  33. unitbytes-1.0.0/src/unitbytes.egg-info/top_level.txt +1 -0
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+
3
+ All notable changes to the `unitbytes` Python SDK & CLI are documented in this file.
4
+
5
+ ## [1.0.0] - 2026-11-24
6
+
7
+ ### Added
8
+ - **Unified Zero-Dependency Client (`UnitBytes`)**: Pure Python 3.10+ standard-library SDK (`dependencies = []`) covering 12 domain namespaces (`trends`, `jobs`, `shopping`, `travel`, `ai`, `news`, `gmaps`, `ali1688`, `alibaba`, `goofish`, `rednote`, `reddit`) plus generic `ub.run(...)` for all 66 UnitBytes actors and `/v1` endpoints.
9
+ - **Provider-Agnostic Pluggable Transports (`unitbytes._transports`)**:
10
+ - `ApifyTransport`: Start-once `POST /v2/acts/unitbytes~{slug}/runs?waitForFinish=60` (never retried, eliminating duplicate paid runs) + idempotent `GET /v2/actor-runs/{runId}?waitForFinish=60` polling + `maxTotalChargeUsd` support + optional Goofish Standby fast-path (`prefer_standby=True`).
11
+ - `CloudGatewayTransport`: Custom/enterprise gateway transport (`GET/POST {base_url}/v1/{service}/{operation}` with `Authorization: Bearer <key>`).
12
+ - `RapidApiTransport`: RapidAPI Hub transport with built-in default `*.p.rapidapi.com` hosts across `1688`, `alibaba`, `reddit`, `gmaps`, `trends`, `meta_ads`, `goofish`, `rednote`, `craigslist`, `offerup`, and `fb_marketplace`.
13
+ - `ZylaTransport`: Zyla API Hub transport (`https://zylalabs.com/...` with `Authorization: Bearer <key>`).
14
+ - **`pytrends` Compatibility (`TrendReq`)**: 1-line drop-in replacement (`from unitbytes.trends import TrendReq` / `from unitbytes.request import TrendReq`) with optional `pandas.DataFrame` conversion.
15
+ - **Offline Domain Analytics Helpers**: Direct ATS URL classifier & B2B hiring company aggregator (`ub.jobs`), Minimum Advertised Price (MAP) violation detector (`ub.shopping`), flexible-date fare calendar & hotel OTA rate parity auditor (`ub.travel`), GEO Brand Share-of-Voice & Citation Gap analyzer (`ub.ai`), LLM/RAG citation context formatter (`ub.news`), 1688 MOQ tier resolver (`ub.ali1688`), and offline English-to-Chinese Xianyu slang translator (`ub.goofish.translate_keyword`).
16
+ - **Security Hardening & CLI (`unitbytes`)**: `_NoRedirectHandler` blocking all `3xx` credential-forwarding redirects (`ProviderError(code="REDIRECT_BLOCKED")`), strict per-provider credential isolation, HTTPS enforcement, full token redaction across `__repr__` and exceptions, atomic `0600` watchlist state persistence, and formula-sanitized CSV/JSON/JSONL CLI exports.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 UnitBytes
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,7 @@
1
+ include LICENSE
2
+ include README.md
3
+ include CHANGELOG.md
4
+ recursive-include src/unitbytes py.typed
5
+ prune tests
6
+ prune .pytest_cache
7
+ global-exclude *.py[cod] __pycache__ .pytest_cache
@@ -0,0 +1,238 @@
1
+ Metadata-Version: 2.4
2
+ Name: unitbytes
3
+ Version: 1.0.0
4
+ Summary: Unofficial unified, zero-dependency, provider-agnostic Python SDK & CLI for UnitBytes web data APIs & scrapers across Google Trends (TrendReq), Jobs, Shopping, Travel, AI Overviews/Mode, News, Maps, 1688, Alibaba, Goofish, RedNote, and Reddit.
5
+ Author-email: UnitBytes <contact@unitbytes.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://unitbytes.com/
8
+ Project-URL: Documentation, https://unitbytes.com/actors/
9
+ Project-URL: Apify Store, https://apify.com/unitbytes?fpr=939u3w&fp_sid=pypi_sdk
10
+ Keywords: unitbytes,web-scraping,pytrends,pytrends-alternative,google-trends,google-maps,google-maps-scraper,b2b-leads,google-jobs,google-shopping,google-flights,google-hotels,ai-overviews,1688,alibaba,goofish,xianyu,goofish-without-login,xiaohongshu,rednote,reddit,apify,rapidapi
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Provides-Extra: pandas
27
+ Requires-Dist: pandas>=2.0.0; extra == "pandas"
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
30
+ Dynamic: license-file
31
+
32
+ # `unitbytes` — Unified Provider-Agnostic Python SDK & CLI
33
+
34
+ Unofficial, **zero-dependency**, typed Python SDK and CLI (`pip install unitbytes`) for the **UnitBytes** web data ecosystem across **Google Trends (`TrendReq`), Google Maps B2B Leads & Contributor Forensics, Goofish (Xianyu / 闲鱼), Google Jobs, Google Shopping, Google Travel (Flights & Hotels), Google AI Overviews & AI Mode, Google News, 1688, Alibaba, RedNote (Xiaohongshu), Reddit**, and all 66 UnitBytes data actors.
35
+
36
+ > **Disclaimer:** Unofficial integration by UnitBytes. Not affiliated with, endorsed by, or sponsored by Google LLC, Alibaba Group, Reddit, Inc., Meta Platforms, Inc., Xiaohongshu, or any other third-party platform referenced herein. Google, YouTube, Google Maps, 1688, Alibaba, Xianyu/Goofish, Xiaohongshu/RedNote, and Reddit are trademarks of their respective owners.
37
+
38
+ ---
39
+
40
+ ## Key Highlights
41
+
42
+ - **1-Line `pytrends` Drop-In Replacement (`HTTP 429` Fix, from `$0.30/1K`)**: Swap archived `from pytrends.request import TrendReq` for `from unitbytes.trends import TrendReq` (or `from unitbytes.request import TrendReq`) to eliminate `TooManyRequestsError` (`HTTP 429`) on cloud/CI runners — starting at **`$0.30/1K` GOLD+ (`$0.45/1K` Free)** with optional `pandas.DataFrame` support (`pip install "unitbytes[pandas]"`).
43
+ - **Google Maps B2B Leads & Local Guide Forensics (`ub.gmaps`)**: Extract 48 flat B2B lead fields (`primary_email`, E.164 `phone_international`, `whatsapp_url`, social profiles, `is_claimed`, `website_cms`, `website_tech_stack`, `has_meta_pixel`, `has_google_ads_tag`, `lead_score`, and `review_hook_text`) via `ub.gmaps.leads` (`$1.00/1K` GOLD+ / `$2.00/1K` Free), place reviews via `ub.gmaps.reviews` (`$0.25/1K` GOLD+), and public Local Guide profiles & review histories via `ub.gmaps.contributor` (`$1.20/1K` profiles + `$0.80/1K` reviews GOLD+).
44
+ - **Cookieless Goofish / Xianyu Search & Seller Audits (`ub.goofish`)**: Solve `"Xianyu / Goofish unable to access"` errors and Alipay / `+86` SMS login walls with cookieless keyword search (`prefer_standby=True`), offline English-to-Chinese slang translation (`ub.goofish.translate_keyword`), and **Zhima Credit (`芝麻信用`)** seller verification (`ub.goofish.seller` + `assess_seller_trust`).
45
+ - **Zero External Runtime Dependencies (`dependencies = []`)**: Built 100% on Python 3.10+ standard library (`urllib.request`, `json`, `dataclasses`, `decimal`, `typing`, `csv`). Upstream third-party client updates can never break your production environment.
46
+ - **Provider-Agnostic Pluggable Transports & Duplicate-Charge Protection**: Switch seamlessly between **Apify (`APIFY_TOKEN`)**, **Cloud Gateways (`UNITBYTES_API_KEY` + `UNITBYTES_BASE_URL`)**, **RapidAPI (`RAPIDAPI_KEY`)**, and **Zyla API Hub (`ZYLA_API_KEY`)** — with start-once non-retried `POST` runs, `maxTotalChargeUsd` budget caps, `3xx` redirect blocking, and automatic secret redaction.
47
+
48
+ ---
49
+
50
+ ## Installation & Free API Token
51
+
52
+ ```bash
53
+ pip install unitbytes
54
+
55
+ # Optional: install with pandas for DataFrame outputs in TrendReq / Jobs
56
+ pip install "unitbytes[pandas]"
57
+ ```
58
+
59
+ Grab a free Apify API token (**`$5.00`/month recurring platform credit included — no credit card required**) at [**apify.com/unitbytes**](https://apify.com/unitbytes?fpr=939u3w&fp_sid=pypi_sdk) (or browse full actor schemas at [unitbytes.com/actors/](https://unitbytes.com/actors/)):
60
+
61
+ ```bash
62
+ # Option A: Apify Store Actors (Recommended — $5/mo free credit included)
63
+ export APIFY_TOKEN="apify_api_..."
64
+
65
+ # Option B: Dedicated / Custom Cloud Gateway
66
+ export UNITBYTES_API_KEY="ub_..."
67
+ export UNITBYTES_BASE_URL="https://your-gateway.example.com"
68
+
69
+ # Option C: RapidAPI Hub
70
+ export RAPIDAPI_KEY="your_rapidapi_key"
71
+
72
+ # Option D: Zyla API Hub
73
+ export ZYLA_API_KEY="your_zyla_key"
74
+ export ZYLA_BASE_URL="https://zylalabs.com/api/..."
75
+ ```
76
+
77
+ ---
78
+
79
+ ## Featured Workflows
80
+
81
+ ### 1. 1-Line `pytrends` Drop-In Replacement (`HTTP 429` Fix — `$0.30/1K` GOLD+)
82
+
83
+ Backed by [`unitbytes/google-trends-scraper`](https://apify.com/unitbytes/google-trends-scraper?fpr=939u3w&fp_sid=pypi_sdk) (`$0.45/1K` Free • **`$0.30/1K` GOLD+** + `$0.00005` start):
84
+
85
+ ```python
86
+ # Replace: from pytrends.request import TrendReq
87
+ from unitbytes.trends import TrendReq
88
+
89
+ pytrends = TrendReq(hl="en-US", tz=360)
90
+ pytrends.build_payload(["python", "rust"], timeframe="today 12-m", geo="US")
91
+ timeline = pytrends.interest_over_time()
92
+ related = pytrends.related_queries()
93
+ ```
94
+
95
+ ### 2. Google Maps B2B Leads, Website Tech Stacks & Contributor Forensics (`ub.gmaps`)
96
+
97
+ Backed by [`unitbytes/google-maps-leads-scraper`](https://apify.com/unitbytes/google-maps-leads-scraper?fpr=939u3w&fp_sid=pypi_sdk) (`$2.00/1K` Free • **`$1.00/1K` GOLD+**) and [`unitbytes/google-maps-contributor-scraper`](https://apify.com/unitbytes/google-maps-contributor-scraper?fpr=939u3w&fp_sid=pypi_sdk) (`$1.20/1K` profiles + `$0.80/1K` reviews GOLD+):
98
+
99
+ ```python
100
+ from unitbytes import UnitBytes
101
+
102
+ ub = UnitBytes() # Auto-detects APIFY_TOKEN / provider from environment
103
+
104
+ # Verified B2B emails, E.164 phones, CMS/ad pixels (Meta/Google Ads), unclaimed GBP & review hooks
105
+ leads = ub.gmaps.leads(
106
+ ["dentists in Austin TX", "medspas in Miami FL"],
107
+ max_places_per_query=25,
108
+ scrape_contacts=True,
109
+ include_review_hook=True,
110
+ )
111
+ for lead in leads[:3]:
112
+ print(
113
+ lead.get("business_name"),
114
+ lead.get("primary_email"),
115
+ lead.get("phone_international"),
116
+ lead.get("website_cms"),
117
+ lead.get("has_google_ads_tag"),
118
+ )
119
+
120
+ # Audit Local Guide contributor profiles & cross-location review histories (fake-review forensics)
121
+ contrib_reviews = ub.gmaps.contributor(
122
+ "https://www.google.com/maps/place/?q=place_id:ChIJ2_VLfRdawokRXKfA6CMf5YQ",
123
+ place_sort="negative_and_newest",
124
+ max_reviewers_per_place=20,
125
+ max_reviews=50,
126
+ )
127
+ ```
128
+
129
+ ### 3. Cookieless Goofish (Xianyu / 闲鱼) Search & Seller Zhima Credit (`ub.goofish`)
130
+
131
+ Bypasses `"Xianyu / Goofish unable to access"` walls and Alipay / `+86` login prompts via [`unitbytes/goofish-xianyu-search-scraper`](https://apify.com/unitbytes/goofish-xianyu-search-scraper?fpr=939u3w&fp_sid=pypi_sdk) and [`unitbytes/goofish-scraper`](https://apify.com/unitbytes/goofish-scraper?fpr=939u3w&fp_sid=pypi_sdk):
132
+
133
+ ```python
134
+ from unitbytes import UnitBytes
135
+ from unitbytes.goofish import assess_seller_trust
136
+
137
+ ub = UnitBytes()
138
+
139
+ # Offline English -> Chinese Xianyu slang translation ("索尼 A7M4 微单相机 箱说全") + warm Standby search
140
+ items = ub.goofish.search(
141
+ "Sony A7M4 mirrorless camera box and papers",
142
+ translate_keywords=True,
143
+ personal_only=True,
144
+ free_shipping=True,
145
+ prefer_standby=True,
146
+ only_new=True,
147
+ max_items=20,
148
+ )
149
+
150
+ # Seller Zhima Credit (芝麻信用), biometric KYC badges & storefront audit without login
151
+ seller_data = ub.goofish.seller("100000000123", include_items=True, include_reviews=True, prefer_standby=True)
152
+ trust = assess_seller_trust(seller_data)
153
+ print(f"Trust: {trust.trust_score}/100 | Zhima: {trust.zhima_tier} | Risk: {trust.risk_level}")
154
+ ```
155
+
156
+ ### 4. Multi-Domain Unified Client (`UnitBytes`)
157
+
158
+ ```python
159
+ from unitbytes import UnitBytes
160
+
161
+ ub = UnitBytes()
162
+
163
+ # Google Trends Realtime Breakouts
164
+ spikes = ub.trends.trending_now(geo="US", time_window="24h")
165
+
166
+ # Google Jobs + Direct ATS Classification + Hiring Velocity
167
+ jobs = ub.jobs.search("Senior Python Engineer", locations=["New York, NY"], remote_only=True, max_jobs=25)
168
+ companies = ub.jobs.aggregate_hiring_companies(jobs)
169
+
170
+ # Google Shopping + MAP Violation Auditing
171
+ products = ub.shopping.search("Sony WH-1000XM5", sort_by="price_asc", max_products=20)
172
+ map_report = ub.shopping.detect_map_violations(products, map_price=349.99, authorized_sellers=["bestbuy.com"])
173
+
174
+ # Google Flights & Hotels + OTA Rate Parity
175
+ flights = ub.travel.flights(from_origin="JFK", to_destination="LHR", departure_date="2026-12-10", sort_by="cheapest")
176
+ hotels = ub.travel.hotels("Tokyo", check_in_date="2026-12-10", check_out_date="2026-12-14")
177
+ parity = ub.travel.audit_hotel_ota_parity(hotels, only_undercut=True)
178
+
179
+ # Google AI Overviews ($3.00/1k flat) & AI Mode ($4.00-$5.00/1k) + GEO Share-of-Voice
180
+ sov = ub.ai.audit_brand_share_of_voice(
181
+ ["best crm for startups", "hubspot vs salesforce"],
182
+ brand_domain="hubspot.com",
183
+ competitor_domains=["salesforce.com", "pipedrive.com"],
184
+ )
185
+
186
+ # Google News + LLM/RAG Context Builder
187
+ articles = ub.news.search("semiconductor supply chain", time_range="24h", extract_article_content=True)
188
+ rag_markdown = ub.news.build_rag_context(articles)
189
+
190
+ # 1688, Alibaba, RedNote (Xiaohongshu), Reddit & Generic Actor Runner
191
+ offers_1688 = ub.ali1688.search("wireless charger", province="shenzhen", max_items=20)
192
+ suppliers = ub.alibaba.suppliers("custom packaging", verified_only=True)
193
+ notes = ub.rednote.search("skincare routine", max_items=20)
194
+ posts = ub.reddit.search("self-hosted analytics", subreddit="selfhosted", max_items=20)
195
+ custom_items = ub.run("unitbytes/offerup-scraper", {"query": "road bike", "maxItems": 10})
196
+ ```
197
+
198
+ ---
199
+
200
+ ## Command-Line Interface (`unitbytes`)
201
+
202
+ All CLI commands support `--format {json,jsonl,csv}` (with spreadsheet formula sanitization on both headers and cells) and `--output <file>`:
203
+
204
+ ```bash
205
+ unitbytes --help
206
+ unitbytes trends trending-now --geo US --window 24h --format csv -o trends.csv
207
+ unitbytes gmaps leads "dentists in Austin TX" --max-places 25 --format csv -o austin_dentists.csv
208
+ unitbytes goofish search "Sony A7M4 box and papers" --translate --prefer-standby --max-items 20
209
+ unitbytes jobs search "Machine Learning Engineer" --remote-only --direct-ats-only --max-jobs 20
210
+ unitbytes travel flights --from SFO --to NRT --departure-date 2026-12-15 --sort-by cheapest
211
+ unitbytes ai overviews "best vector database" --country US --target-domain pinecone.io
212
+ ```
213
+
214
+ ---
215
+
216
+ ## Namespace Reference
217
+
218
+ | Namespace | Methods |
219
+ | :--- | :--- |
220
+ | `ub.trends` | `trending_now`, `interest_over_time`, `interest_by_region`, `related_queries`, `related_topics`, `breakouts`, `youtube_trends`, `shopping_trends` (+ `TrendReq`) |
221
+ | `ub.gmaps` | `leads`, `reviews`, `reviews_tracker`, `photos`, `contributor` |
222
+ | `ub.goofish` | `search`, `seller`, `translate_keyword` (+ `assess_seller_trust`) |
223
+ | `ub.jobs` | `search`, `scrape_jobspy_compat`, `classify_ats_provider`, `aggregate_hiring_companies` |
224
+ | `ub.shopping` | `search`, `detect_map_violations` |
225
+ | `ub.travel` | `flights`, `hotels`, `scan_flexible_dates`, `audit_hotel_ota_parity` |
226
+ | `ub.ai` | `overviews`, `ai_mode`, `audit_brand_share_of_voice` |
227
+ | `ub.news` | `search`, `topics`, `build_rag_context` |
228
+ | `ub.ali1688` | `search`, `image_search`, `global_search` |
229
+ | `ub.alibaba` | `search`, `suppliers` |
230
+ | `ub.rednote` | `search`, `profile`, `comments`, `trends` |
231
+ | `ub.reddit` | `search`, `subreddit`, `post`, `comments`, `user` |
232
+ | `ub.run(...)` | Generic execution across any UnitBytes actor slug or `/v1/{service}/{operation}` endpoint |
233
+
234
+ ---
235
+
236
+ ## License
237
+
238
+ MIT License — see [LICENSE](./LICENSE). Documentation & actor catalog: [https://unitbytes.com/](https://unitbytes.com/), [https://unitbytes.com/actors/](https://unitbytes.com/actors/), and [Apify Store](https://apify.com/unitbytes?fpr=939u3w&fp_sid=pypi_sdk).
@@ -0,0 +1,207 @@
1
+ # `unitbytes` — Unified Provider-Agnostic Python SDK & CLI
2
+
3
+ Unofficial, **zero-dependency**, typed Python SDK and CLI (`pip install unitbytes`) for the **UnitBytes** web data ecosystem across **Google Trends (`TrendReq`), Google Maps B2B Leads & Contributor Forensics, Goofish (Xianyu / 闲鱼), Google Jobs, Google Shopping, Google Travel (Flights & Hotels), Google AI Overviews & AI Mode, Google News, 1688, Alibaba, RedNote (Xiaohongshu), Reddit**, and all 66 UnitBytes data actors.
4
+
5
+ > **Disclaimer:** Unofficial integration by UnitBytes. Not affiliated with, endorsed by, or sponsored by Google LLC, Alibaba Group, Reddit, Inc., Meta Platforms, Inc., Xiaohongshu, or any other third-party platform referenced herein. Google, YouTube, Google Maps, 1688, Alibaba, Xianyu/Goofish, Xiaohongshu/RedNote, and Reddit are trademarks of their respective owners.
6
+
7
+ ---
8
+
9
+ ## Key Highlights
10
+
11
+ - **1-Line `pytrends` Drop-In Replacement (`HTTP 429` Fix, from `$0.30/1K`)**: Swap archived `from pytrends.request import TrendReq` for `from unitbytes.trends import TrendReq` (or `from unitbytes.request import TrendReq`) to eliminate `TooManyRequestsError` (`HTTP 429`) on cloud/CI runners — starting at **`$0.30/1K` GOLD+ (`$0.45/1K` Free)** with optional `pandas.DataFrame` support (`pip install "unitbytes[pandas]"`).
12
+ - **Google Maps B2B Leads & Local Guide Forensics (`ub.gmaps`)**: Extract 48 flat B2B lead fields (`primary_email`, E.164 `phone_international`, `whatsapp_url`, social profiles, `is_claimed`, `website_cms`, `website_tech_stack`, `has_meta_pixel`, `has_google_ads_tag`, `lead_score`, and `review_hook_text`) via `ub.gmaps.leads` (`$1.00/1K` GOLD+ / `$2.00/1K` Free), place reviews via `ub.gmaps.reviews` (`$0.25/1K` GOLD+), and public Local Guide profiles & review histories via `ub.gmaps.contributor` (`$1.20/1K` profiles + `$0.80/1K` reviews GOLD+).
13
+ - **Cookieless Goofish / Xianyu Search & Seller Audits (`ub.goofish`)**: Solve `"Xianyu / Goofish unable to access"` errors and Alipay / `+86` SMS login walls with cookieless keyword search (`prefer_standby=True`), offline English-to-Chinese slang translation (`ub.goofish.translate_keyword`), and **Zhima Credit (`芝麻信用`)** seller verification (`ub.goofish.seller` + `assess_seller_trust`).
14
+ - **Zero External Runtime Dependencies (`dependencies = []`)**: Built 100% on Python 3.10+ standard library (`urllib.request`, `json`, `dataclasses`, `decimal`, `typing`, `csv`). Upstream third-party client updates can never break your production environment.
15
+ - **Provider-Agnostic Pluggable Transports & Duplicate-Charge Protection**: Switch seamlessly between **Apify (`APIFY_TOKEN`)**, **Cloud Gateways (`UNITBYTES_API_KEY` + `UNITBYTES_BASE_URL`)**, **RapidAPI (`RAPIDAPI_KEY`)**, and **Zyla API Hub (`ZYLA_API_KEY`)** — with start-once non-retried `POST` runs, `maxTotalChargeUsd` budget caps, `3xx` redirect blocking, and automatic secret redaction.
16
+
17
+ ---
18
+
19
+ ## Installation & Free API Token
20
+
21
+ ```bash
22
+ pip install unitbytes
23
+
24
+ # Optional: install with pandas for DataFrame outputs in TrendReq / Jobs
25
+ pip install "unitbytes[pandas]"
26
+ ```
27
+
28
+ Grab a free Apify API token (**`$5.00`/month recurring platform credit included — no credit card required**) at [**apify.com/unitbytes**](https://apify.com/unitbytes?fpr=939u3w&fp_sid=pypi_sdk) (or browse full actor schemas at [unitbytes.com/actors/](https://unitbytes.com/actors/)):
29
+
30
+ ```bash
31
+ # Option A: Apify Store Actors (Recommended — $5/mo free credit included)
32
+ export APIFY_TOKEN="apify_api_..."
33
+
34
+ # Option B: Dedicated / Custom Cloud Gateway
35
+ export UNITBYTES_API_KEY="ub_..."
36
+ export UNITBYTES_BASE_URL="https://your-gateway.example.com"
37
+
38
+ # Option C: RapidAPI Hub
39
+ export RAPIDAPI_KEY="your_rapidapi_key"
40
+
41
+ # Option D: Zyla API Hub
42
+ export ZYLA_API_KEY="your_zyla_key"
43
+ export ZYLA_BASE_URL="https://zylalabs.com/api/..."
44
+ ```
45
+
46
+ ---
47
+
48
+ ## Featured Workflows
49
+
50
+ ### 1. 1-Line `pytrends` Drop-In Replacement (`HTTP 429` Fix — `$0.30/1K` GOLD+)
51
+
52
+ Backed by [`unitbytes/google-trends-scraper`](https://apify.com/unitbytes/google-trends-scraper?fpr=939u3w&fp_sid=pypi_sdk) (`$0.45/1K` Free • **`$0.30/1K` GOLD+** + `$0.00005` start):
53
+
54
+ ```python
55
+ # Replace: from pytrends.request import TrendReq
56
+ from unitbytes.trends import TrendReq
57
+
58
+ pytrends = TrendReq(hl="en-US", tz=360)
59
+ pytrends.build_payload(["python", "rust"], timeframe="today 12-m", geo="US")
60
+ timeline = pytrends.interest_over_time()
61
+ related = pytrends.related_queries()
62
+ ```
63
+
64
+ ### 2. Google Maps B2B Leads, Website Tech Stacks & Contributor Forensics (`ub.gmaps`)
65
+
66
+ Backed by [`unitbytes/google-maps-leads-scraper`](https://apify.com/unitbytes/google-maps-leads-scraper?fpr=939u3w&fp_sid=pypi_sdk) (`$2.00/1K` Free • **`$1.00/1K` GOLD+**) and [`unitbytes/google-maps-contributor-scraper`](https://apify.com/unitbytes/google-maps-contributor-scraper?fpr=939u3w&fp_sid=pypi_sdk) (`$1.20/1K` profiles + `$0.80/1K` reviews GOLD+):
67
+
68
+ ```python
69
+ from unitbytes import UnitBytes
70
+
71
+ ub = UnitBytes() # Auto-detects APIFY_TOKEN / provider from environment
72
+
73
+ # Verified B2B emails, E.164 phones, CMS/ad pixels (Meta/Google Ads), unclaimed GBP & review hooks
74
+ leads = ub.gmaps.leads(
75
+ ["dentists in Austin TX", "medspas in Miami FL"],
76
+ max_places_per_query=25,
77
+ scrape_contacts=True,
78
+ include_review_hook=True,
79
+ )
80
+ for lead in leads[:3]:
81
+ print(
82
+ lead.get("business_name"),
83
+ lead.get("primary_email"),
84
+ lead.get("phone_international"),
85
+ lead.get("website_cms"),
86
+ lead.get("has_google_ads_tag"),
87
+ )
88
+
89
+ # Audit Local Guide contributor profiles & cross-location review histories (fake-review forensics)
90
+ contrib_reviews = ub.gmaps.contributor(
91
+ "https://www.google.com/maps/place/?q=place_id:ChIJ2_VLfRdawokRXKfA6CMf5YQ",
92
+ place_sort="negative_and_newest",
93
+ max_reviewers_per_place=20,
94
+ max_reviews=50,
95
+ )
96
+ ```
97
+
98
+ ### 3. Cookieless Goofish (Xianyu / 闲鱼) Search & Seller Zhima Credit (`ub.goofish`)
99
+
100
+ Bypasses `"Xianyu / Goofish unable to access"` walls and Alipay / `+86` login prompts via [`unitbytes/goofish-xianyu-search-scraper`](https://apify.com/unitbytes/goofish-xianyu-search-scraper?fpr=939u3w&fp_sid=pypi_sdk) and [`unitbytes/goofish-scraper`](https://apify.com/unitbytes/goofish-scraper?fpr=939u3w&fp_sid=pypi_sdk):
101
+
102
+ ```python
103
+ from unitbytes import UnitBytes
104
+ from unitbytes.goofish import assess_seller_trust
105
+
106
+ ub = UnitBytes()
107
+
108
+ # Offline English -> Chinese Xianyu slang translation ("索尼 A7M4 微单相机 箱说全") + warm Standby search
109
+ items = ub.goofish.search(
110
+ "Sony A7M4 mirrorless camera box and papers",
111
+ translate_keywords=True,
112
+ personal_only=True,
113
+ free_shipping=True,
114
+ prefer_standby=True,
115
+ only_new=True,
116
+ max_items=20,
117
+ )
118
+
119
+ # Seller Zhima Credit (芝麻信用), biometric KYC badges & storefront audit without login
120
+ seller_data = ub.goofish.seller("100000000123", include_items=True, include_reviews=True, prefer_standby=True)
121
+ trust = assess_seller_trust(seller_data)
122
+ print(f"Trust: {trust.trust_score}/100 | Zhima: {trust.zhima_tier} | Risk: {trust.risk_level}")
123
+ ```
124
+
125
+ ### 4. Multi-Domain Unified Client (`UnitBytes`)
126
+
127
+ ```python
128
+ from unitbytes import UnitBytes
129
+
130
+ ub = UnitBytes()
131
+
132
+ # Google Trends Realtime Breakouts
133
+ spikes = ub.trends.trending_now(geo="US", time_window="24h")
134
+
135
+ # Google Jobs + Direct ATS Classification + Hiring Velocity
136
+ jobs = ub.jobs.search("Senior Python Engineer", locations=["New York, NY"], remote_only=True, max_jobs=25)
137
+ companies = ub.jobs.aggregate_hiring_companies(jobs)
138
+
139
+ # Google Shopping + MAP Violation Auditing
140
+ products = ub.shopping.search("Sony WH-1000XM5", sort_by="price_asc", max_products=20)
141
+ map_report = ub.shopping.detect_map_violations(products, map_price=349.99, authorized_sellers=["bestbuy.com"])
142
+
143
+ # Google Flights & Hotels + OTA Rate Parity
144
+ flights = ub.travel.flights(from_origin="JFK", to_destination="LHR", departure_date="2026-12-10", sort_by="cheapest")
145
+ hotels = ub.travel.hotels("Tokyo", check_in_date="2026-12-10", check_out_date="2026-12-14")
146
+ parity = ub.travel.audit_hotel_ota_parity(hotels, only_undercut=True)
147
+
148
+ # Google AI Overviews ($3.00/1k flat) & AI Mode ($4.00-$5.00/1k) + GEO Share-of-Voice
149
+ sov = ub.ai.audit_brand_share_of_voice(
150
+ ["best crm for startups", "hubspot vs salesforce"],
151
+ brand_domain="hubspot.com",
152
+ competitor_domains=["salesforce.com", "pipedrive.com"],
153
+ )
154
+
155
+ # Google News + LLM/RAG Context Builder
156
+ articles = ub.news.search("semiconductor supply chain", time_range="24h", extract_article_content=True)
157
+ rag_markdown = ub.news.build_rag_context(articles)
158
+
159
+ # 1688, Alibaba, RedNote (Xiaohongshu), Reddit & Generic Actor Runner
160
+ offers_1688 = ub.ali1688.search("wireless charger", province="shenzhen", max_items=20)
161
+ suppliers = ub.alibaba.suppliers("custom packaging", verified_only=True)
162
+ notes = ub.rednote.search("skincare routine", max_items=20)
163
+ posts = ub.reddit.search("self-hosted analytics", subreddit="selfhosted", max_items=20)
164
+ custom_items = ub.run("unitbytes/offerup-scraper", {"query": "road bike", "maxItems": 10})
165
+ ```
166
+
167
+ ---
168
+
169
+ ## Command-Line Interface (`unitbytes`)
170
+
171
+ All CLI commands support `--format {json,jsonl,csv}` (with spreadsheet formula sanitization on both headers and cells) and `--output <file>`:
172
+
173
+ ```bash
174
+ unitbytes --help
175
+ unitbytes trends trending-now --geo US --window 24h --format csv -o trends.csv
176
+ unitbytes gmaps leads "dentists in Austin TX" --max-places 25 --format csv -o austin_dentists.csv
177
+ unitbytes goofish search "Sony A7M4 box and papers" --translate --prefer-standby --max-items 20
178
+ unitbytes jobs search "Machine Learning Engineer" --remote-only --direct-ats-only --max-jobs 20
179
+ unitbytes travel flights --from SFO --to NRT --departure-date 2026-12-15 --sort-by cheapest
180
+ unitbytes ai overviews "best vector database" --country US --target-domain pinecone.io
181
+ ```
182
+
183
+ ---
184
+
185
+ ## Namespace Reference
186
+
187
+ | Namespace | Methods |
188
+ | :--- | :--- |
189
+ | `ub.trends` | `trending_now`, `interest_over_time`, `interest_by_region`, `related_queries`, `related_topics`, `breakouts`, `youtube_trends`, `shopping_trends` (+ `TrendReq`) |
190
+ | `ub.gmaps` | `leads`, `reviews`, `reviews_tracker`, `photos`, `contributor` |
191
+ | `ub.goofish` | `search`, `seller`, `translate_keyword` (+ `assess_seller_trust`) |
192
+ | `ub.jobs` | `search`, `scrape_jobspy_compat`, `classify_ats_provider`, `aggregate_hiring_companies` |
193
+ | `ub.shopping` | `search`, `detect_map_violations` |
194
+ | `ub.travel` | `flights`, `hotels`, `scan_flexible_dates`, `audit_hotel_ota_parity` |
195
+ | `ub.ai` | `overviews`, `ai_mode`, `audit_brand_share_of_voice` |
196
+ | `ub.news` | `search`, `topics`, `build_rag_context` |
197
+ | `ub.ali1688` | `search`, `image_search`, `global_search` |
198
+ | `ub.alibaba` | `search`, `suppliers` |
199
+ | `ub.rednote` | `search`, `profile`, `comments`, `trends` |
200
+ | `ub.reddit` | `search`, `subreddit`, `post`, `comments`, `user` |
201
+ | `ub.run(...)` | Generic execution across any UnitBytes actor slug or `/v1/{service}/{operation}` endpoint |
202
+
203
+ ---
204
+
205
+ ## License
206
+
207
+ MIT License — see [LICENSE](./LICENSE). Documentation & actor catalog: [https://unitbytes.com/](https://unitbytes.com/), [https://unitbytes.com/actors/](https://unitbytes.com/actors/), and [Apify Store](https://apify.com/unitbytes?fpr=939u3w&fp_sid=pypi_sdk).
@@ -0,0 +1,81 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "unitbytes"
7
+ version = "1.0.0"
8
+ description = "Unofficial unified, zero-dependency, provider-agnostic Python SDK & CLI for UnitBytes web data APIs & scrapers across Google Trends (TrendReq), Jobs, Shopping, Travel, AI Overviews/Mode, News, Maps, 1688, Alibaba, Goofish, RedNote, and Reddit."
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ requires-python = ">=3.10"
12
+ authors = [
13
+ { name = "UnitBytes", email = "contact@unitbytes.com" }
14
+ ]
15
+ keywords = [
16
+ "unitbytes",
17
+ "web-scraping",
18
+ "pytrends",
19
+ "pytrends-alternative",
20
+ "google-trends",
21
+ "google-maps",
22
+ "google-maps-scraper",
23
+ "b2b-leads",
24
+ "google-jobs",
25
+ "google-shopping",
26
+ "google-flights",
27
+ "google-hotels",
28
+ "ai-overviews",
29
+ "1688",
30
+ "alibaba",
31
+ "goofish",
32
+ "xianyu",
33
+ "goofish-without-login",
34
+ "xiaohongshu",
35
+ "rednote",
36
+ "reddit",
37
+ "apify",
38
+ "rapidapi"
39
+ ]
40
+ classifiers = [
41
+ "Development Status :: 4 - Beta",
42
+ "Intended Audience :: Developers",
43
+ "License :: OSI Approved :: MIT License",
44
+ "Operating System :: OS Independent",
45
+ "Programming Language :: Python :: 3",
46
+ "Programming Language :: Python :: 3.10",
47
+ "Programming Language :: Python :: 3.11",
48
+ "Programming Language :: Python :: 3.12",
49
+ "Programming Language :: Python :: 3.13",
50
+ "Topic :: Internet :: WWW/HTTP :: Indexing/Search",
51
+ "Topic :: Software Development :: Libraries :: Python Modules",
52
+ "Typing :: Typed"
53
+ ]
54
+ dependencies = []
55
+
56
+ [project.optional-dependencies]
57
+ pandas = [
58
+ "pandas>=2.0.0"
59
+ ]
60
+ dev = [
61
+ "pytest>=8.0.0"
62
+ ]
63
+
64
+ [project.scripts]
65
+ unitbytes = "unitbytes.cli:main"
66
+
67
+ [project.urls]
68
+ Homepage = "https://unitbytes.com/"
69
+ Documentation = "https://unitbytes.com/actors/"
70
+ "Apify Store" = "https://apify.com/unitbytes?fpr=939u3w&fp_sid=pypi_sdk"
71
+
72
+ [tool.setuptools.packages.find]
73
+ where = ["src"]
74
+ include = ["unitbytes*"]
75
+
76
+ [tool.setuptools.package-data]
77
+ unitbytes = ["py.typed"]
78
+
79
+ [tool.pytest.ini_options]
80
+ pythonpath = ["src"]
81
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,43 @@
1
+ """`unitbytes` — Unified, zero-dependency, provider-agnostic Python SDK & CLI for UnitBytes web data APIs."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from ._exceptions import (
6
+ AuthenticationError,
7
+ ConfigurationError,
8
+ ProviderError,
9
+ RateLimitError,
10
+ UnitBytesError,
11
+ )
12
+ from ._serialization import format_records, sanitize_csv_cell
13
+ from ._transports import (
14
+ DEFAULT_RAPIDAPI_HOSTS,
15
+ ApifyTransport,
16
+ CloudGatewayTransport,
17
+ RapidApiTransport,
18
+ Transport,
19
+ ZylaTransport,
20
+ )
21
+ from .client import UnitBytes
22
+ from .trends import TrendReq
23
+
24
+ __version__ = "1.0.0"
25
+
26
+ __all__ = [
27
+ "__version__",
28
+ "UnitBytes",
29
+ "TrendReq",
30
+ "Transport",
31
+ "ApifyTransport",
32
+ "CloudGatewayTransport",
33
+ "RapidApiTransport",
34
+ "ZylaTransport",
35
+ "DEFAULT_RAPIDAPI_HOSTS",
36
+ "UnitBytesError",
37
+ "AuthenticationError",
38
+ "ConfigurationError",
39
+ "RateLimitError",
40
+ "ProviderError",
41
+ "format_records",
42
+ "sanitize_csv_cell",
43
+ ]