@rent-scraper/create-config 1.0.25 → 1.0.27
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 +1 @@
|
|
|
1
|
-
import r from"minimist";import{r as o}from"../shared/create-config.
|
|
1
|
+
import r from"minimist";import{r as o}from"../shared/create-config.D18m8RlE.mjs";import"axios";import"@rent-scraper/api";import"@rent-scraper/utils";import"@rent-scraper/utils/config";import"@clack/prompts";import"node:timers/promises";const t=r(process.argv.slice(2)),i=t.source??"zillow";o(i).then(()=>{process.exit(0)}).catch(()=>{process.exit(1)});
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{r as runCreateConfig}from"./shared/create-config.Cv5GB98J.mjs";export{r as runInitConfig}from"./shared/create-config.BVVrX66f.mjs";export{a as generateRedfinRegionIds,g as generateZillowRegionIds,r as runGenerateRegionIds}from"./shared/create-config.
|
|
1
|
+
export{r as runCreateConfig}from"./shared/create-config.Cv5GB98J.mjs";export{r as runInitConfig}from"./shared/create-config.BVVrX66f.mjs";export{a as generateRedfinRegionIds,g as generateZillowRegionIds,r as runGenerateRegionIds}from"./shared/create-config.D18m8RlE.mjs";export{r as runCheckConfig}from"./shared/create-config.Khzo3bcG.mjs";import"@rent-scraper/utils/config";import"@clack/prompts";import"node:timers/promises";import"node:fs/promises";import"@rent-scraper/utils";import"@pnpm/find-workspace-dir";import"minimist";import"node:path";import"picocolors";import"axios";import"@rent-scraper/api";import"@rent-scraper/browser-server";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import h,{isCancel as I}from"axios";import{checkForZillowBotFiltering as g,waitForSolvedZillowCaptcha as R,getRedfinRegionIdByZipCode as Z,getZillowRegionIdByZipCode as F}from"@rent-scraper/api";import{parseError as l,throwError as w}from"@rent-scraper/utils";import{checkForAndReadConfigFile as m,getZipCodesFromConfig as f,stringifyZipCodes as p,updateConfigFile as u}from"@rent-scraper/utils/config";import{log as s,spinner as b,confirm as v,cancel as z,outro as P}from"@clack/prompts";import{setTimeout as d}from"node:timers/promises";const B=async()=>{await h.post("http://localhost:8082/browser/close")},E=async e=>{try{const o=await m(e),t=await f(e),i=o?.regionIds;if(t?.every(n=>i?.[String(n)]!=null)){s.success("Region Ids have been found in config...");return}s.step("Region Ids were not found in your Config file");const r=b();if(e==="redfin")await C();else{try{await g()}catch(n){const{message:a}=l(n);s.error(a);const c=await v({message:"You need to complete a captcha in your browser. Press Return to launch your browser and continue.",active:"OK",inactive:"Cancel"});if(I(c)||!c)return z("Create config canceled. Please try again."),process.exit(1);await d(1e3),P("Browser Launching..."),await d(1e3),await R()}await B(),r.start("Generating Region Ids"),await y(),await d(1e3),r.stop("Region Ids Generated and added to Config file"),await d(1e3)}}catch(o){const{message:t}=l(o);s.error(t)}};async function y(){try{const e=await f("zillow");e||w("Zip codes must be added to config file."),await g();const o=(await m("zillow"))?.regionIds??{},t=e.filter(a=>o[String(a)]==null),i=Object.fromEntries((await Promise.all(t.map(async a=>{const c=await F(a,{fromFile:!1});return[a,c]}))).filter(a=>a)),r={...o,...i},n={zipCodes:p(e),regionIds:r};await u("zillow",n)}catch(e){const{status:o,message:t}=l(e);s.error(`${o}, ${t}`)}}async function C(){try{const e=await f("redfin");e||w("Zip codes must be added to config file.");const o=Object.fromEntries((await Promise.all(e.map(async i=>{const r=await Z(i,{fromFile:!1});return[i,r]}))).filter(i=>i)),t={zipCodes:p(e),regionIds:o};await u("redfin",t)}catch(e){const{status:o,message:t}=l(e);console.error(o,t)}}export{C as a,y as g,E as r};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rent-scraper/create-config",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.27",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"minimist": "^1.2.8",
|
|
47
47
|
"picocolors": "^1.1.1",
|
|
48
48
|
"puppeteer": "^24.11.2",
|
|
49
|
-
"@rent-scraper/
|
|
50
|
-
"@rent-scraper/utils": "1.0.
|
|
51
|
-
"@rent-scraper/
|
|
49
|
+
"@rent-scraper/browser-server": "1.0.27",
|
|
50
|
+
"@rent-scraper/utils": "1.0.27",
|
|
51
|
+
"@rent-scraper/api": "1.0.27"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/minimist": "^1.2.5",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import p,{isCancel as u}from"axios";import{checkForZillowBotFiltering as c,waitForSolvedZillowCaptcha as y,getRedfinRegionIdByZipCode as C,getZillowRegionIdByZipCode as h}from"@rent-scraper/api";import{parseError as n,throwError as d}from"@rent-scraper/utils";import{checkForAndReadConfigFile as R,getZipCodesFromConfig as l,stringifyZipCodes as f,updateConfigFile as g}from"@rent-scraper/utils/config";import{log as r,spinner as I,confirm as F,cancel as Z,outro as b}from"@clack/prompts";import{setTimeout as s}from"node:timers/promises";const v=async()=>{await p.post("http://localhost:8082/browser/close")},z=async e=>{try{if((await R(e))?.regionIds){r.success("Region Ids have been found in config...");return}r.step("Region Ids were not found in your Config file");const o=I();if(e==="redfin")await m();else{try{await c()}catch(t){const{message:i}=n(t);r.error(i);const a=await F({message:"You need to complete a captcha in your browser. Press Return to launch your browser and continue.",active:"OK",inactive:"Cancel"});if(u(a)||!a)return Z("Create config canceled. Please try again."),process.exit(1);await s(1e3),b("Browser Launching..."),await s(1e3),await y()}await v(),o.start("Generating Region Ids"),await w(),await s(1e3),o.stop("Region Ids Generated and added to Config file"),await s(1e3)}}catch(o){const{message:t}=n(o);r.error(t)}};async function w(){try{const e=await l("zillow");e||d("Zip codes must be added to config file."),await c();const o=Object.fromEntries((await Promise.all(e.map(async i=>{const a=await h(i,{fromFile:!1});return[i,a]}))).filter(i=>i)),t={zipCodes:f(e),regionIds:o};await g("zillow",t)}catch(e){const{status:o,message:t}=n(e);r.error(`${o}, ${t}`)}}async function m(){try{const e=await l("redfin");e||d("Zip codes must be added to config file.");const o=Object.fromEntries((await Promise.all(e.map(async i=>{const a=await C(i,{fromFile:!1});return[i,a]}))).filter(i=>i)),t={zipCodes:f(e),regionIds:o};await g("redfin",t)}catch(e){const{status:o,message:t}=n(e);console.error(o,t)}}export{m as a,w as g,z as r};
|