@rent-scraper/api 1.0.32 → 1.0.33
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.
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -129,7 +129,7 @@ fragment RentalCommunityResultFields on SearchAssistanceRentalCommunityResult {
|
|
|
129
129
|
fragment BuilderCommunityResultFields on SearchAssistanceBuilderCommunityResult {
|
|
130
130
|
plid
|
|
131
131
|
__typename
|
|
132
|
-
}`},o={accept:"*/*","accept-encoding":"gzip, deflate, br, zstd","accept-language":"en-US,en;q=0.7","client-id":"hops-homepage","content-type":"application/json",origin:"https://www.zillow.com",priority:"u=1, i",referer:"https://www.zillow.com/","sec-ch-ua":'"Brave";v="135", "Not-A.Brand";v="8", "Chromium";v="135"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"macOS"',"user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36","sec-fetch-site":"same-origin","sec-fetch-dest":"empty","sec-fetch-mode":"cors",cookie:await A()};try{const{data:a}=await c.post(t,r,{headers:o})||{},{regionId:i}=a.data.searchAssistanceResult.results.filter(s=>s?.regionId)?.[0]||{};return i||console.log("no region id found for zip"),i}catch(a){const{status:i,message:s}=O(a)??{};if(C(i,s))T(s,i);else return console.log("zip code not found"),null}},G={Accept:"*/*","Accept-Language":"en-US,en;q=0.5","Content-Type":"application/json",Origin:"https://www.zillow.com",Referer:"https://www.zillow.com/",Priority:"u=1, i","Sec-Ch-Ua":'"Brave";v="147", "Not.A/Brand";v="8", "Chromium";v="147"',"Sec-Ch-Ua-Mobile":"?0","Sec-Ch-Ua-Platform":'"macOS"',"Sec-Fetch-Dest":"empty","Sec-Fetch-Mode":"cors","Sec-Fetch-Site":"same-origin","Sec-Gpc":"1","User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36"},x=async({page:e,daysOnZillow:t,regionId:r,zipCode:o,mergePageResults:a,timeoutMs:i})=>{o&&(r=await U(o)??r),e=(a?1:e)??1;const s=await w({page:e,daysOnZillow:t,regionId:r,zipCode:o,timeoutMs:i}),n=s?.cat1?.searchList?.totalResultCount,l=s?.cat1?.searchList?.resultsPerPage,p=s?.cat1?.searchList?.totalPages;if(e&&e>p)return null;const d=a&&Array.from({length:p},(u,I)=>I+1),_=a&&p>1&&d?(await Promise.all(d?.map(async u=>await w({page:u,daysOnZillow:t,regionId:r,zipCode:o},!0)))).flat():s?.cat1?.searchResults?.listResults,m=_?.map(u=>u?.detailUrl),y=_?.length;return y?{timestamp:h(),...o&&{zipCode:o},regionId:r,numResults:y,totalResultCount:n,resultsPerPage:l,...a&&{mergePageResults:a},...d?{pagesCrawled:d?.length}:{page:e},totalPages:p,results:_,urls:m}:null},w=async({page:e,daysOnZillow:t,regionId:r,zipCode:o,timeoutMs:a},i)=>{const s="https://www.zillow.com/async-create-search-page-state",n={searchQueryState:{pagination:{currentPage:e??1},isMapVisible:!1,mapBounds:{east:-116.2057669921875,north:35.424914784130365,south:32.12915408246069,west:-120.3915580078125},regionSelection:[{regionId:r,regionType:7}],filterState:{sortSelection:{value:"days"},doz:{value:String(t??5)},isNewConstruction:{value:!1},isForSaleForeclosure:{value:!1},isForSaleByOwner:{value:!1},isForSaleByAgent:{value:!1},isForRent:{value:!0},isComingSoon:{value:!1},isAuction:{value:!1},isAllHomes:{value:!0}},isListVisible:!0,...o&&{usersSearchTerm:String(o)}},wants:{cat1:["listResults"]},requestId:6,isDebugRequest:!1},l=m=>{const y=new AbortController;return setTimeout(()=>y.abort(),m||0),y.signal},p=await A(),d={headers:{...G,cookie:p},...a&&{signal:l(a)}},{data:_}=await c.put(s,n,d)||{};return i?_?.cat1?.searchResults?.listResults:_},S=async(e,t)=>{const{timeoutMs:r}=t??{},o={headers:{Host:"www.zillow.com",accept:"*/*","content-type":"text/html; charset=utf-8","user-agent":"insomnia/10.3.0"},...r&&{signal:(i=>{const s=new AbortController;return setTimeout(()=>s.abort(),i||0),s.signal})(r)}},{data:a}=await c.options(e,o)||{};if(!a||a===""){const i=new Error("empty response");throw i.response={status:0,data:"empty response"},i}if(typeof a=="string"&&a.includes("px-captcha")){const i=new Error("captcha");throw i.response={status:403,data:"captcha"},i}return a},oe=async e=>({data:await S(e)}),ae=async e=>{const t=await S(e);return z(t)},ie=(e,t)=>{if(t==="building")return e?.initialReduxState?.gdp?.building??null;{
|
|
132
|
+
}`},o={accept:"*/*","accept-encoding":"gzip, deflate, br, zstd","accept-language":"en-US,en;q=0.7","client-id":"hops-homepage","content-type":"application/json",origin:"https://www.zillow.com",priority:"u=1, i",referer:"https://www.zillow.com/","sec-ch-ua":'"Brave";v="135", "Not-A.Brand";v="8", "Chromium";v="135"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"macOS"',"user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36","sec-fetch-site":"same-origin","sec-fetch-dest":"empty","sec-fetch-mode":"cors",cookie:await A()};try{const{data:a}=await c.post(t,r,{headers:o})||{},{regionId:i}=a.data.searchAssistanceResult.results.filter(s=>s?.regionId)?.[0]||{};return i||console.log("no region id found for zip"),i}catch(a){const{status:i,message:s}=O(a)??{};if(C(i,s))T(s,i);else return console.log("zip code not found"),null}},G={Accept:"*/*","Accept-Language":"en-US,en;q=0.5","Content-Type":"application/json",Origin:"https://www.zillow.com",Referer:"https://www.zillow.com/",Priority:"u=1, i","Sec-Ch-Ua":'"Brave";v="147", "Not.A/Brand";v="8", "Chromium";v="147"',"Sec-Ch-Ua-Mobile":"?0","Sec-Ch-Ua-Platform":'"macOS"',"Sec-Fetch-Dest":"empty","Sec-Fetch-Mode":"cors","Sec-Fetch-Site":"same-origin","Sec-Gpc":"1","User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36"},x=async({page:e,daysOnZillow:t,regionId:r,zipCode:o,mergePageResults:a,timeoutMs:i})=>{o&&(r=await U(o)??r),e=(a?1:e)??1;const s=await w({page:e,daysOnZillow:t,regionId:r,zipCode:o,timeoutMs:i}),n=s?.cat1?.searchList?.totalResultCount,l=s?.cat1?.searchList?.resultsPerPage,p=s?.cat1?.searchList?.totalPages;if(e&&e>p)return null;const d=a&&Array.from({length:p},(u,I)=>I+1),_=a&&p>1&&d?(await Promise.all(d?.map(async u=>await w({page:u,daysOnZillow:t,regionId:r,zipCode:o},!0)))).flat():s?.cat1?.searchResults?.listResults,m=_?.map(u=>u?.detailUrl),y=_?.length;return y?{timestamp:h(),...o&&{zipCode:o},regionId:r,numResults:y,totalResultCount:n,resultsPerPage:l,...a&&{mergePageResults:a},...d?{pagesCrawled:d?.length}:{page:e},totalPages:p,results:_,urls:m}:null},w=async({page:e,daysOnZillow:t,regionId:r,zipCode:o,timeoutMs:a},i)=>{const s="https://www.zillow.com/async-create-search-page-state",n={searchQueryState:{pagination:{currentPage:e??1},isMapVisible:!1,mapBounds:{east:-116.2057669921875,north:35.424914784130365,south:32.12915408246069,west:-120.3915580078125},regionSelection:[{regionId:r,regionType:7}],filterState:{sortSelection:{value:"days"},doz:{value:String(t??5)},isNewConstruction:{value:!1},isForSaleForeclosure:{value:!1},isForSaleByOwner:{value:!1},isForSaleByAgent:{value:!1},isForRent:{value:!0},isComingSoon:{value:!1},isAuction:{value:!1},isAllHomes:{value:!0}},isListVisible:!0,...o&&{usersSearchTerm:String(o)}},wants:{cat1:["listResults"]},requestId:6,isDebugRequest:!1},l=m=>{const y=new AbortController;return setTimeout(()=>y.abort(),m||0),y.signal},p=await A(),d={headers:{...G,cookie:p},...a&&{signal:l(a)}},{data:_}=await c.put(s,n,d)||{};return i?_?.cat1?.searchResults?.listResults:_},S=async(e,t)=>{const{timeoutMs:r}=t??{},o={headers:{Host:"www.zillow.com",accept:"*/*","content-type":"text/html; charset=utf-8","user-agent":"insomnia/10.3.0"},...r&&{signal:(i=>{const s=new AbortController;return setTimeout(()=>s.abort(),i||0),s.signal})(r)}},{data:a}=await c.options(e,o)||{};if(!a||a===""){const i=new Error("empty response");throw i.response={status:0,data:"empty response"},i}if(typeof a=="string"&&a.includes("px-captcha")){const i=new Error("captcha");throw i.response={status:403,data:"captcha"},i}return a},oe=async e=>({data:await S(e)}),ae=async e=>{const t=await S(e);return z(t)},ie=(e,t)=>{if(t==="building")return e?.initialReduxState?.gdp?.building??null;{const r=e&&JSON.parse(e?.gdpClientCache);return r?Object.values(r).find(o=>o?.property)?.property??null:null}},z=e=>{const t=M.load(e)("#__NEXT_DATA__").text(),r=t&&JSON.parse(t)?.props?.pageProps?.componentProps,o=r?.initialReduxState?.gdp?"building":"property",a=ie(r,o);return{timestamp:h(),...a}},E={accept:"*/*","accept-encoding":"gzip, deflate, br, zstd","accept-language":"en-US,en;q=0.9","client-id":"for-sale-sub-app-browser-client","content-type":"application/json","Cache-Control":"no-cache",Pragma:"no-cache",priority:"u=1, i","sec-ch-ua":'"Google Chrome";v="136", "Not(A:Brand";v="8", "Chromium";v="136"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"macOS"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-origin","user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36","x-z-enable-oauth-conversion":"true"},k=async(e,t)=>{const{altFetch:r,onlyRemovedListings:o=!1}=t??{},a=(r?await ne(e,t):await se(e,t))||{},{property:i,...s}=a;if(i){const{buyAbilityData:n,collections:l,nearbyCities:p,nearbyNeighborhoods:d,nearbyZipcodes:_,schools:m,nearbyHomes:y,listingMetadata:u,homeInsights:I,responsivePhotos:ue,submitFlow:ge,contactFormRenderData:he,tourEligibility:Te,onsiteMessage:Ae,ZoDsFsUpsellTop:be,streetViewMetadataUrlMapLightboxAddress:Se,responsivePhotosOriginalRatio:Pe,thirdPartyVirtualTour:Re,vrModel:fe,topNavJson:we,...b}=i||{};if(!b?.priceHistory)return null;if(o){const{homeStatus:D}=b??{};if(!D)return console.log("no home status",e),null;if(D==="FOR_RENT"){const[L]=b?.priceHistory??{};return L?.event?console.log("recent price history not removed",e,L?.event):console.log("no recent price history"),null}}return{timestamp:h(),...b,...s,...r&&{altFetch:r}}}},se=async(e,t)=>{const{timeoutMs:r}=t??{},o="https://www.zillow.com/graphql",a=`?extensions=%7B%22persistedQuery%22%3A%7B%22version%22%3A1%2C%22sha256Hash%22%3A%222a50ebbffc7b6fb6e70fad24b7738df5db7f2ed5b61c2b980542749accff1f17%22%7D%7D&variables=%7B%22zpid%22%3A${e}%2C%22platform%22%3A%22DESKTOP_WEB%22%2C%22formType%22%3A%22OPAQUE%22%2C%22contactFormRenderParameter%22%3A%7B%22zpid%22%3A${e}%2C%22platform%22%3A%22desktop%22%2C%22isDoubleScroll%22%3Atrue%7D%2C%22skipCFRD%22%3Afalse%2C%22ompPlatform%22%3A%22web%22%7D`,i=`${o}${a}`,s=d=>{const _=new AbortController;return setTimeout(()=>_.abort(),d||0),_.signal},n=await A(),l={headers:{...E,cookie:n},...r&&{signal:s(r)}},{data:p}=await c.get(i,l)||{};return p?.data},ne=async(e,{timeoutMs:t})=>{const r="https://www.zillow.com/graphql",o={operationName:"ForRentShopperPlatformFullRenderQuery",variables:{zpid:e,altId:null},query:`query ForRentShopperPlatformFullRenderQuery($zpid: ID!, $altId: ID, $skipPropertyPrice: Boolean = false, $skipPropertyAddress: Boolean = false) {
|
|
133
133
|
property(zpid: $zpid, palsId: $altId) {
|
|
134
134
|
...FrActionBarContent_property
|
|
135
135
|
...FrMediaColumnContent_property
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rent-scraper/api",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.33",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.mjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"cheerio": "^1.1.0",
|
|
32
32
|
"dayjs": "^1.11.13",
|
|
33
33
|
"puppeteer": "^24.11.2",
|
|
34
|
-
"@rent-scraper/utils": "1.0.
|
|
34
|
+
"@rent-scraper/utils": "1.0.33"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"unbuild": "^3.5.0",
|