o
    g                    @   s  d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlm	Z	 d dl
Z
d dlmZ d dlmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z- d dl.m/Z/ d dl0m1Z1m2Z2m3Z3m4Z4 d dl5m6Z6 d dl7m8Z8m9Z9m:Z:m;Z; d dl<Z<d d	l=m>Z> d d
l?m@Z@ d dlAZBd dlCmDZD d dlEmFZF d dlGmHZH d dlIZId dlJmKZK eIL ZMeIjLN  d dlOmPZP eMQdZReMQdZSeMQdZTdZUdeUdfddZVdd ZWdZXdeXdfddZYdd ZZdd  Z[d!d" Z\d#d$ Z]d%d& Z^d'd( Z_d)d* Z`d+d, Zad-d. Zbd/d0 Zcd1d2 Zdd3d4d5d6d7d8d9d:d;d7d<d=d>d?d7d@dAdBdCd7dDdEdFdGd7dHdIdJdKd7dLdMdNdOd7dPdQdRdSd7dTdUdVdWd7dXdYdZd[d7d\d]d^d_d7d`dadbdcd7dddedfdgd7dhdidjdkd7dlZedmdn Zfdodp Zgdqdr Zhdsdt Zidudv Zjdwdx Zkdydz Zld{d| Zmd}d~ Zndd Zodd Zpdd Zqdd Zrdd Zsdd ZtdddZudd ZvdddZwdd Zxdd ZydddZzdd Z{dZUdeUdfddZ|dZ}e}dfddZ~dd Zdd Zdd Zdd ZdS )    N)settings)translate_text_by_google) 
AttachmentBuildingTypeBuildingTypeTranslate
ChangeRateCurrencyDevelopmentDevelopmentDetailDevelopmentOfferDevelopmentOfferTranslateDevelopmentTranslateFaqFaqCategoryFaqCategoryTranslateFaqTranslateFeatureFeatureTranslateFilterSeoTextFilterSeoTextTranslateFlatFlatTranslate
KeyFeatureONHAreaONHDistrictONHPostcode
ONHStationONHZonePaymentOptionPaymentOptionTranslatePaymentPlanPaymentPlanTranslateRankElementRankElementTranslateflat_bedroom_type)CityCountryPublicFacility
StreetView)Language)QCountMaxMin)	ImageFile)Image)BeautifulSoup)slugify)OpenAI)log_func)geodesic
openai_keyopenai_pr_idopenai_org_idaz  paraphrase the following text, which describes an apartment or building project on a real estate consulting website, into {language} language. Use HTML tags and headings h3-h6 if applicable. Maintain the tone of a professional real estate agent, keeping in mind that the property is located in {address} and has access to {stations} stations.
    Original Description: `{text}`
englishgpt-4o-minic           
   
   C   s   z-t td}|j| ||||d}|jjj|dddd|dgdd}d	|jd
 jjd dW S  t	yX }	 zt
dtj d d| d|	 dd |	 dW  Y d }	~	S d }	~	ww )Napi_key)textnameaddressstationslanguagesystemIYou are an experienced real estate consultant with deep market knowledge.rolecontentuserffffff?modelmessagestemperatureFr   errorrF   	error_txt	error on %Y/%m/%d %H:%M:%Sz( : in developer description paraphrase [
] error : Tr3   r6   formatchatcompletionscreatechoicesmessagerF   	Exceptionprintdatetimenowstrftime)
r=   r>   r?   r@   rA   promptrJ   clientrU   e rb   1/var/www/Entralon-Web-Backend/development/cron.pyparaphrase_description&   s$   $rd   c                  C   s  t jjdddd d } | D ]}z|j}d|j jddd}z|jjdd		 j
}W n   d }Y |rt||j|j||jj}|d
 rmd|_|d |_|  tdtj d d|j d|j d|d   n;|d r|d dddd|_
d|_t |_|  nd|_|  tdtj d d|j d|j d W q ty } z(d|_| |_|  tdtj d d|j d|j d| W Y d }~qd }~ww d S )NF)is_paraphraseparaphrase_error
   , r>   Tflatenlanguage__coderN   rO   rP   rQ   * : in development description paraphrase [:rR   rF   html ```)] error : development description is None)r   objectsfilterdevelopmentjoinonh_stationallvalues_list
translatesfirstdescriptionrd   titler?   rA   r>   rf   rN   saver[   r\   r]   r^   idreplacere   timelast_paraphraserZ   )developmentsdevelopment_trv   r@   desr}   ra   rb   rb   rc   development_description8   s>   
6

,:r   aM  Summarize the following real estate description in a concise and engaging manner in {language} language, only 500 character, while maintaining all factual information, without HTML tags, ensuring it captivates the user and encourages further reading. The summary should be concise and clear.
            Original Description : {text}c              
   C   s   z/t td}|j| |d}|jjj|dddd|dgdd}t|j d	|jd
 jj	d dW S  t
yZ } ztdtj d d| d| dd | dW  Y d }~S d }~ww )Nr;   r=   rA   rB   rC   rD   rG   rH   rI   Fr   rM   rP   rQ   z) : in development description summarize [rR   T)r3   r6   rT   rU   rV   rW   r[   rX   rY   rF   rZ   r\   r]   r^   )r=   r   rA   r_   rJ   r`   rU   ra   rb   rb   rc   summarize_description[   s&   
$r   c                  C   sl  t jjddddd d } | D ]}zn|j}|r~t||j|jj}|d rKd|_|d |_	|
  tdtj d d	|j d
|j d|d   n3|d ra|d |_d|_t |_|
  nd|_|
  tdtj d d	|j d
|j d W q ty } z(d|_| |_|
  tdtj d d	|j d
|j d| W Y d }~qd }~ww d S )NTF)re   is_summarizesummarize_has_errorrg   rN   rO   rP   rQ   rn   ro   rR   rF   rs   )r   rt   ru   r}   r   r   rA   r>   r   summarize_errorr   r[   r\   r]   r^   r~   summaryr   r   r   rZ   rN   )r   r   r   r}   ra   rb   rb   rc   development_summarizem   s8   
6


,:r   c            
      C   s   d} t jjtjjddddgdd }|D ]^}tj| |j dd	}| }|d
 }|	 D ]E\}}z't jj|d}t
jj|||d |jdkrL||_n|jdkrT||_|  W q. tys }	 ztd| d W Y d }	~	q.d }	~	ww qd S )NzChttps://v6.exchangerate-api.com/v6/3194c7590734b504e82d1dfa/latest/TF      )	is_active
is_deletedcountry_id__in)developments__inrg   timeoutconversion_ratescode)from_currencyto_currencyrateGBPAEDzError: z not found in the database.)r   rt   ru   r	   distinctrequestsgetr   jsonitemsr   rW   gbp_rateaed_rater   rZ   r[   )
base_urlbase_currenciesbase_currencyresponsedatar   currencyr   c_tra   rb   rb   rc   add_currencies_rate   s&   $r   c            
      C   :  t jjdd} t jjdd}tjjddd d D ]}z
tjj||d}W n   tjj|||j|j	d}Y d}| D ]V}z0t
|j|jd}|j	}ztjj||d}||_||_	|  W n   tjj||||d Y W q: ty }	 zd	}td
tj d d|	  W Y d }	~	q:d }	~	ww |sd	|_|  qd S )Nrk   r   F
translatedrg   )rA   payment_option)rA   r   r>   slugto_languageTrP   rQ    : )r*   rt   excluder   r   ru   r   rW   r>   r   r   r   r   rZ   r[   r\   r]   r^   r   )
	languagesbase_languagepolrN   rA   r>   r   potra   rb   rb   rc   translate_payment_option   8    ,r   c            
      C   r   )Nrk   r   Fr   rg   )rA   feature)rA   r   r>   r   r   TrP   rQ   r   )r*   rt   r   r   r   ru   r   rW   r>   r   r   r   r   rZ   r[   r\   r]   r^   r   
r   r   kfr   rN   rA   r>   r   kftra   rb   rb   rc   translate_features   r   r   c            
      C   r   )Nrk   r   Fr   rg   )rA   building_type)rA   r   r>   r   r   TrP   rQ   r   )r*   rt   r   r   r   ru   r   rW   r>   r   r   r   r   rZ   r[   r\   r]   r^   r   r   rb   rb   rc   translate_building_type   r   r   c            
      C   r   )Nrk   r   Fr   rg   )rA   rank_element)rA   r   r>   r   r   TrP   rQ   r   )r*   rt   r   r   r"   ru   r#   rW   r>   r   r   r   r   rZ   r[   r\   r]   r^   r   r   rb   rb   rc   translate_rank_element   r   r   c            	      C   s(  t jjdd} t jjdd}tjjddd d D ]x}z
tjj||d}W n   tjj|||jd}Y d}| D ]O}z)t	|j|j
d}ztjj||d}||_|  W n   tjj|||d Y W q8 ty } zd	}td
tj d d|  W Y d }~q8d }~ww |sd	|_|  qd S )Nrk   r   Fr   rg   )rA   development_offer)rA   r   r=   r   TrP   rQ   r   )r*   rt   r   r   r   ru   r   rW   r=   r   r   r   rZ   r[   r\   r]   r^   r   )	r   r   r   r   rN   rA   r=   r   ra   rb   rb   rc   translate_development_offer  s4   ,r   c            
      C   r   )Nrk   r   Fr   rg   )rA   payment_plan)rA   r   r~   r   r   TrP   rQ   r   )r*   rt   r   r   r    ru   r!   rW   r~   r   r   r   r   rZ   r[   r\   r]   r^   r   )
r   r   r   r   rN   rA   r~   r   r   ra   rb   rb   rc   translate_payment_plan  r   r   c                  C   sD  t jjdd} t jjdd}tjjtddtddt| 	 d dB d d	 D ]t}z	|j
j|d
}W n   tjj||j||j|jd}Y |d urz8|jd urX|jn|j}|j}|j}|j}| D ]}d }	d }
d }d }d }d }|j}	|j}
|d urt||jd}|d ur|dkrg }z
tj|ddd}W n ty } ztd| W Y d }~nd }~ww g }|D ]}|d ur|t||jd qd|}|d ur|dkrg }z
tj|ddd}W n ty } ztd| W Y d }~nd }~ww g }|D ]}|d ur|t||jd qd|}|r:z	t||jd}W n ty9 } ztd| W Y d }~nd }~ww z-z
tjj||d}W n
   t||d}Y |	|_|
|_||_||_||_||_|  W qf ty~ } z
t| W Y d }~qfd }~ww d|_|  W q* ty } z
t| W Y d }~q*d }~ww q*d S )Nrk   r   r{   tr_numFr      
tr_num__ltrg   rA   )rv   r?   rA   r~   r   r   rq   i,  )break_long_wordsr}    features_descriptionneighborhood)rA   rv   T)r*   rt   r   r   r	   annotater,   ru   r+   countr{   r   rW   r?   r~   r   r}   r   r   r   r   textwrapwraprZ   r[   appendrw   r   r   )r   r   rv   r   r?   r}   r   r   rA   t_titlet_slugt_descriptiont_features_descriptiont_neighborhood	t_addresslinesra   r   linefdesr   rb   rb   rc   translate_development5  s   >$

$ 
$ 
& $ $ r   c                  C   s   dd l } tjjdddd d D ]e}zM|j}| j|jj|jjd}|D ]3}|j	d urVt
jj|||j	d\}}|j|_|j|_|j|_|j|_|j|_|j|_|j|_|  q#d|_|  W q tyu } z
t| W Y d }~qd }~ww d S )Nr   F)panorama_checklocation__isnullr   )latlon)locationrv   panorama_idT)
streetviewr	   rt   ru   r   search_panoramascoordinatesyxpano_idr)   get_or_creater   r   headingpitchrolldate	elevationr   r   rZ   r[   )r   rv   r   pspsv_ra   rb   rb   rc   get_panorama_detailq  s.   
" r   c                  C   s  t jjdd } tdd}| j}tj}d}zt	
dd}d}tdd| D ]H}d}tdd|d  D ]6}	d	| d
| j d| d| d|	 
}
| d| |	 d}tj|
| t	|}||||f |d7 }q4|d7 }q'd|j }d| d| j }t }|j|dd |d t|| dd}ztjj||dd W n*   ztjj||||||dd W n ty } z
t| W Y d }~nd }~ww Y d| _|   W d S  ty } zt| W Y d }~d S d }~ww )NF)image_downloadedr   r   r   RGB)i   i   r   zhttps://cbkz#.google.com/cbk?output=tile&panoid=z&zoom=z&x=z&y=z/downloads/z.jpgi   zpanorama image from zpanorama-zoom-JPEG)rT   r>      )	file_namerv   category)r  rv   r~   altfileimager  T)r)   rt   ru   r|   randomrandintrv   r   BASE_DIRr0   newranger   urllibrequesturlretrieveopenpaster~   ioBytesIOr   seekr/   r   r   rW   rZ   r[   r   )r   numdevbdzoomnew_imx_offsetr   y_offsetr   urlimg_nameimgr~   r  image_bytesr  ra   rb   rb   rc   get_street_view_images  sH   $



 " $ r  u   آپارتمان استودیوu   شقة استوديوu   Квартира-студияStudio Apartment)faarrurk   u   1 خوابهu   بغرفة نوم 1u   1 комнатнаяz	1 bedroomu    آپارتمان دو خوابهu   شقة بغرفتين نومu+   Двухкомнатная квартираTwo-bedroom Apartmentu   پنت‌هاوسu   بنتهاوسu   Пентхаус	Penthouseu   آپارتمان لافتu   شقة لوفتu   ЛофтLoftu   دوبلکسu   دوبلكسu   ДуплексDuplexu   آپارتمان تریپلکسu   شقة تريبلكسu   ТриплексTriplexu   آپارتمان باغu   شقة مع حديقةu   Квартира с садомGarden Apartmentu   آپارتمان زیرزمینu   شقة تحت الأرضu"   Квартира в подвалеBasement Apartmentu    آپارتمان برج بلندu   شقة في ناطحة سحابu!   Высотная квартираHigh-rise Apartmentu"   آپارتمان برج کوتاهu   شقة في مبنى منخفضu)   Низкоэтажная квартираLow-rise Apartmentu   آپارتمان کاندوu   شقة تملكيةu   КондоминиумCondominium (Condo)u   آپارتمان خدماتیu    شقة مفروشة بخدماتu+   Обслуживаемая квартираServiced Apartmentu   آپارتمان مشارکتیu   شقة تعاونيةu+   Кооперативная квартираCo-op Apartment)r  zOne-bedroom Apartmentr#  r$  r%  r&  r'  r(  r)  r*  r+  r,  r-  r.  c                  C   s   t j } |  }tjjtddj|dd d D ]T}| D ]O}z$z	|jj	|d}W n   t
jj||d}Y t|j|j|_|  W q tym } ztdtj d d	|j d
|j d| W Y d }~qd }~ww qd S )Nr{   r   r   <   r   )rj   rA   rP   rQ   z flat  translate to z create:)r*   rt   ry   r   r   r   r,   ru   r{   r   r   rW   r%   bedrooms_numr   r>   r   rZ   r[   r\   r]   r^   r   )r   lcrj   rA   r   ra   rb   rb   rc   translate_flats  s   
&:r3  c                  C   sd  t   d } tjjdd}tjjdd}tjtddt| dB D ]}zt|j	 
dd	d
ddd}g }|j	 D ]}||j q<|  ddd |D }z|jjd|jj |jj |jjd}W n   i }Y z|jj|jj|jjd}	W n"   |jdkr||_|j|j|jd}	n||_|j|j|jd}	Y d|ji d|jd|jdd|j d|jd|jd|jd|jd|jd|jd|jd|j d |j!d!|j"d
|j#d"|j d#|d	|||	d$d%|j$j%|j$j&gd&d'}
|
|_'t   |_(|)  W q" t*y/ } zt+d(t,j,- .d) d*|j d+| W Y d }~q"d }~ww d S ),N  r   r   r   Tgeo_json__isnulllast_create__ltebathrooms_numr1  is_sold_outareaprice_per_meter
base_price,c                 S   s.   g | ]}|d kr|dk r|nt |dd qS )r   '  rk   langr$   .0itemrb   rb   rc   
<listcomp>4  s   . z,set_development_geo_json.<locals>.<listcomp>
developer-r>   r   r  r   r>   r   symbolr   r   r   r~   r   	property-r?   min_areamax_areafloorrj   is_featuredcompleted_dateis_ready_to_mover  flats	developerr   Pointtyper   rV  r   
propertiesgeometryrP   rQ    development 
 geo json:)/r   r   rt   r   r	   ru   r+   listrQ  ry   valuesr   r1  sortrw   rS  r>   r   r  r   default_currencyr   rI  
country_idr~   r=  r?   r;  rK  rL  rM  rj   rN  rO  rP  r:  r   r   r   geo_jsonlast_creater   rZ   r[   r\   r]   r^   )r2  
currency_1
currency_2drQ  r  rj   r1  rS  r   ra  ra   rb   rb   rc   set_development_geo_json)  s   ",
	
!
2rf  c                     s|  t   d } tjjdd}tjjdd}tjtddt| dB D ]}|j}|j zt	|j
 dd	d
ddd}g }|j
 D ]}||j qB|  d fdd|D }z|jjd|jj |jj |jjd}	W n   i }	Y z|jj|jj|jjd}
W n&   |jdkr||_|j|j|jd}
n||_|j|j|jd}
|  Y d|ji d|jd|jdd|j d|jd|jd|jd|jd|j d|j!d|j"d|j#d |j$d!|j%d
|j&d"|j d#|d	||	|
d$d%|j'j(|j'j)gd&d'}||_*t   |_+|  W q" t,y; } zt-d(t.j./ 0d) d*|j d+| W Y d }~q"d }~ww d S ),Nr4  r   r   r   Tr5  r7  r9  r1  r:  r;  r<  r=  r>  c                    s0   g | ]}|d kr|dk r|nt | jd qS )r   r?  r@  )r%   r   rB  r   rb   rc   rE  s  s   0 z6set_development_translate_geo_json.<locals>.<listcomp>rF  rG  rH  r   r   r   r~   r   rJ  r?   rK  rL  rM  rj   rN  rO  rP  r  rQ  rR  rT  rU  rW  rP   rQ   rZ  r[  )1r   r   rt   r   r   ru   r+   rv   rA   r\  rQ  ry   r]  r   r1  r^  rw   rS  r>   r   r  r   r_  r   rI  r`  r   r~   r=  r?   r;  rK  rL  rM  rj   rN  rO  rP  r:  r   r   r   ra  rb  rZ   r[   r\   r]   r^   )r2  rc  rd  dtre  rQ  r  rj   r1  rS  r   ra  ra   rb   r   rc   "set_development_translate_geo_jsonf  s   ",

	
!
2rh  c                  C   sd  t j  } | t jdd }tjj| jdjddd tjjddjddd g d}tjj|d	jd
dd tjjdddjdd tjj	t
ddjddjdd tjj	t
ddjddjdd tjjd|djdd tjjddjd
d
d tj D ]}|jd urtjj|dj|jdjd
d
d qtjjddD ]}tj|jjs|  qd S )Nr   )days)completed_at__year__ltT)rP  completed_statusReady to move)completed_date__icontains)finishedready_to_modezready-to-modezready to movezReady To MoveReadyToMoverl  )completed_date__inFr   )r=  r<  )r:  flats__base_price)f_base_priceflats__area)f_area)flats__isnullcreated_at__lt)attachments__isnull)r   is_publishedcountry)coordinates__intersects)rV  )r\   r]   	timedeltar	   rt   ru   yearupdater   r   r-   r'   ry   r   r   r   ospathexistsr  delete)r]   	yesterdaycomplete_arrayr{  arb   rb   rc   set_ready_to_move  s(   
""
"r  c               
   C     t jjdd } | r| j}| j}| j}|jdkrd}d}nd}d}ztj|dd	}|j	d
kr|j
}|d }|j}	t|	d}
|
jddd d}|jdddddddddd}td|tj}d}|ry|d}t|}|d}d| d| }|jdkrdd| d d!}n	dd"| d#d!}tjd$|||d%d&}| }|d'r|d(}|d)}|| _|   W d S W d S W d S  ty } ztd*tj d+ d,| d-| W Y d }~d S d }~ww t d. }t jj|d/jd d0 d S )1NTjson__isnullDubaihttps://1newhomes.ae/new-homes/Ahttps://1newhomes.ae/assets/components/msearch2/action-search.php https://1newhomes.com/new-homes/Bhttps://1newhomes.com/assets/components/msearch2/action-search.phprg   r      	PHPSESSIDhtml.parserscriptc                 S      | od| v S N
mse2Configrb   trb   rb   rc   <lambda>      z&get_onh_station_json.<locals>.<lambda>r=   ,
rh   ,	rq     r   mse2Config\s*=\s*({.*})(30e35bbdbc0d5a572a05f1b709551ada3d2b5e7br   keyzstation=&action=filter&pageId=2923&key=0application/x-www-form-urlencoded; charset=UTF-8u  linkchain=/ ### /news/a-15-quarter-climb-in-dubai-real-estate-prices ### /developers ### /emaar-properties-dubai/ ### / ### / ### / ### /new-homes/ ### /the-address-jumeirah-resort-and-spa-dubai ### /emaar-properties-dubai/ ### /the-address-jumeirah-resort-and-spa-dubai ### / ### /new-homes/ ### /prescott-real-estate-dubai/ ### /developers ### /new-homes/ ### /berton-dubai ### /berton-dubai/gallery ### /berton-dubai ### /berton-dubai/gallery ### /new-homes/page-2 ### /berton-dubai ### /berton-dubai ### /riviera-dubai ### /riviera-dubai/gallery ### /berton-dubai ### /berton-dubai/gallery ### /berton-dubai/floorplans ### / ### /the-mansions-dubai ### / ### /w1nner-tower-winner-tower-dubai ### /new-homes/ ### /new-homes/ ### /new-homes/page-100 ### /samana-lake-views-dubai ### / ### /golf-grand1-dubai ### /new-homes/ ### /new-homes/page-100 ### /the-legends-villas-dubai ### / ### /claydon-house-dubai ### /new-homes/ ### /new-homes/ ### /new-homes/ ### /golf-grand1-dubai ### /emaar-properties-dubai/ ### /new-homes/ ### /golf-grand1-dubai ### /peninsula-dubai ### /new-homes/property-studio/page-20 ### /new-homes/property-studio/page-30 ### /damac-properties-dubai/ ### /new-homes/property-studio/page-30 ### /merano-tower-dubai ### /sky-hills-residences-2-dubai ### /golf-grand1-dubai ### /peninsula-dubai ### /new-homes/property-studio/page-30 ### /golf-grand1-dubai ### /camelia-villas-dubai ### /new-homes/property-studio/page-30 ### /liv-waterside-dubai ### /new-homes/ ### /elvira-dhe-dubai ### /new-homes/ ### /the-vybe-dubai ### /the-vybe-dubai ### /sky-hills-residences-2-dubai ### /new-homes/ ### /j-one-dubai ### /new-homes/ ### /imperial-avenue-dubai ### /j-one-dubai ### /j-one-dubai/floorplans ### /j-one-dubai ### /imperial-avenue-dubai ### /new-homes/ ### /damac-hills-utopia-dubai ### /new-homes/apartments/property-studio/ ### /j-one-dubai ### /damac-hills-utopia-dubai ### /al-jawhara-tower-dubai ### /al-jawhara-tower-dubai/gallery ### /new-homes/apartments/property-studio/ ### /new-homes/apartments/property-studio/ ### /moonsa-residences-2-dubai ### /new-homes/apartments/property-studio/ ### /linden-residences-dubai ### /j-one-dubai/floorplans ### /j-one-dubai ### /j-one-dubai/gallery ### /' ### / ### /new-homes/ ### /mariane-tower-dubai ### /developers ### /samana-developers-dubai/ ### / ### /imperial-avenue-dubai ### / ### /peninsula-dubai ### / ### /damac-lagoons-morocco-2-dubai ### / ### /damac-casa-dubai ### /new-homes/ ### /park-avenue-dubai ### /new-homes/ ### /new-homes/ ### /park-avenue-dubai ### /new-homes/ ### /parkway-dubai ### /new-homes/ ### /parkway-dubai ### /parkway-dubai/gallery ### /parkway-dubai ### /new-homes/apartments/ ### /new-homes/ ### /riviera-dubai ### / ### /parkway-dubai ### / ### / ### / ### /new-homes/ ### /new-homes/station-jumeirah-beach-residence/ ### /alta-real-estate-developments-dubai/ ### /mr-c-residences-jumeirah-dubai ### / ### / ### /city-walk-northline-dubai ### /parkside-hills-dubai ### /new-homes/ ### /peninsula-dubai ### /parkside-hills-dubai ### / ### /new-homes/ ### /new-homes/ ### /new-homes/ ### /new-homes/ ### /new-homes/ ### /beverly-hills-drive-dubai ### /new-homes/ ### /ag-square-dubai ### /new-homes/ ### / ### /new-homes/ ### /mina-dubai ### /new-homes/ready-to-move/ ### /new-homes/ready-to-move/ ### /new-homes/ready-to-move/ ### /new-homes/ready-to-move/ ### / ### /zada-tower-dubai ### /new-homes/ ### /new-homes/ ### /linden-residences-dubai ### /linden-residences-dubai ### /new-homes/ ### /beach-walk-3-dubai ### / ### /harbour-gate-dubai ### /new-homes/ ### /park-gate-residences-dubai ### /new-homes/ ### /merano-tower-dubai ### / ### /vanguard-by-franÑk-muller-dubai ### /new-homes/ ### /bayview-dubai ### /new-homes/ ### /bayview-by-address-dubai ### /new-homes/ ### /bayview-by-address-resorts-dubai ### /new-homes/ ### /bayview-by-address-dubai ### /new-homes/ ### /bayview-dubai ### /new-homes/ ### /imperial-avenue-dubai ### /new-homes/ ### /davinci-tower-dubai ### /new-homes/ ### /mudon-al-ranim-1-dubai ### /new-homes/ ### /kaya-dubai ### /kaya-dubai ### /new-homes/; _ga_SVS4S7PFEJ=GS1.1.1730685094.108.1.1730685108.0.0.0; _ga=GA1.1.415606180.1724083972; _ym_uid=1719929312736223957; _ym_d=1724083975; cookie_agree=1; PHPSESSID= ; utm=; _ym_isad=1; _ym_visorc=wzContent-TypeCookieu  _ga_JCEVRN83E0=GS1.1.1730680201.285.1.1730681307.44.0.0; _ga=GA1.1.65359444.1719929309; _ym_uid=1719929310452810339; _ym_d=1719929310; _fbp=fb.1.1722030370979.323930974364926; _ga_JCEVRN83E0=deleted; _gcl_au=1.1.962196760.1727727415; linkchain=/ ### /hendon-waterside-london ### / ### /eastman-village-london ### /new-homes/ ### /almax-group-london/ ### /new-homes/year-finished/ ### /1a-st-johns-wood-park-london ### /1a-st-johns-wood-park-london ### /new-homes/?property=1-bedroom&year=Finished ### / ### /new-homes/ ### / ### /new-homes/ ### / ### /developers ### / ### /new-homes/ ### / ### /new-homes/ ### /"https:////1newhomes.com//almax-group-london///" ### /new-homes/ ### / ### /invest ### /first-time-buyers ### /first-time-buyers ### /first-time-buyers ### /the-waterline-london ### /new-homes/options-concierge-service/ ### / ### / ### /luxury-properties ### / ### / ### /developers ### /new-homes/ ### / ### /new-homes/ ### /kingsbury-stone-london/ ### /399-london ### /new-homes/ ### /hadston-london/ ### /new-homes/ ### /the-whiteley-london ### /ae ### / ### /new-homes/ ### /the-chocolate-quarter-london ### / ### / ### /the-silk-district-london ### / ### /new-homes/ ### /battersea-power-station-london ### /the-claves-london ### / ### /new-homes/ ### /whitelocke-house-london ### /new-homes/ ### /shoreditch-parkside-london ### /new-homes/ ### /cassia-london ### /new-homes/ ### /purley-development-london ### /new-homes/ ### /developers ### /rer-london/ ### /developers ### /battersea-power-station-london ### / ### /new-homes/ ### /battersea-power-station-london ### /battersea-power-station-london/floorplans ### /battersea-power-station-london ### /developers ### /new-homes/year-finished/ ### /developers ### /new-homes/ ### /battersea-power-station-london ### /battersea-power-station-london ### /new-homes/ ### /the-platform-london ### /nine-elms-park-e-f-gÑ ### /nine-elms-park-e-f-gÑ-london ### /the-platform-london ### /new-homes/ ### / ### /wardian-london ### / ### /eastman-village-london ### /hayes-village-london ### / ### /battersea-power-station-london ### /battersea-power-station-london/gallery ### / ### /new-homes/ ### /cambridge-house-london ### /new-homes/station-east-croydon/ ### /cambridge-house-london ### /cambridge-house-london ### /new-homes/station-west-croydon/ ### /cambridge-house-london ### /cambridge-house-london ### /cambridge-house-london ### /cambrige-house-hotel-and-residences-london ### /new-homes/ ### /140-northolt-road-london ### / ### / ### / ### / ### /goodluck-hope-london ### /new-homes/ ### /new-homes/ ### / ### /new-homes/ ### /new-homes/ ### / ### / ### /new-homes/barking/ ### /new-homes/harlesden/ ### /new-homes/barking/ ### /new-homes/marylebone/ ### /new-homes/hackney/ ### /high-street-quarter-london ### / ### /high-street-quarter-london ### /new-homes/ ### /wardian-london ### /battersea-power-station-london ### /new-homes/ ### /verdo-kew-bridge-london ### /new-homes/tw8/ ### /new-homes/ ### /the-lucan-autograph-collection-residences-london ### /the-lucan-autograph-collection-residences-london/gallery ### /new-homes/ ### /new-homes/page-20 ### / ### /goodluck-hope-london ### / ### /new-homes/canary-wharf/ ### /goodluck-hope-london/floorplans ### /goodluck-hope-london ### /goodluck-hope-london/floorplans ### / ### /new-homes/ ### /the-lucan-autograph-collection-residences-london ### /the-lucan-autograph-collection-residences-london/gallery ### / ### /goodluck-hope-london ### / ### /new-homes/ ### /bermondsey-heights-london ### /new-homes/ ### /dylon-riverside-london ### /new-homes/ ### /bermondsey-heights-london ### /new-homes/ ### / ### /battersea-power-station-london ### /park-modern-london ### /new-homes/ ### / ### /new-homes/ ### /new-homes/ ### /southmere-london ### / ### /new-homes/ ### /new-homes/central-london-area/ ### / ### /park-modern-london ### /neighbourhood/west-london ### /neighbourhood/ ### /new-homes/ ### /new-homes/property-1-bedroom/ ### /new-homes/canary-wharf/ ### /new-homes/canary-wharf/page-2 ### / ### /eastman-village-london ### /hayes-village-london ### / ### /the-silk-district-london ### /1a-st-johns-wood-park-london ### /goodluck-hope-london ### /brigade-court-london ### /wardian-london ### /hendon-waterside-london ### /new-homes/ ### /10-park-drive-london ### /new-homes/options-health-club/; PHPSESSID="; utm=; cookie_agree=1; _ym_isad=1POST   headersr   r   successr   resultsJSONrP   rQ   z	 station  get data error:Q last_check__ltr   )r   rt   ru   r|   r>   cityr   r   r   status_codecookiesr=   r1   findstringr   researchDOTALLgroupr   loadsr  r   rZ   r[   r\   r]   r^   r   r  )stationr>   r  r   r   r  req_cocor  html_contentsoup
script_tagscript_contentmse2Config_matchr  r  mse2Config_jsonpayloadr  r   res_jsonres	json_datara   r2  rb   rb   rc   get_onh_station_json  `   


.








2r  c               
   C     t jjdd } | r| j}| j}| j}|jdkrd}d}nd}d}ztj|dd	}|j	d
kr|j
}|d }|j}	t|	d}
|
jddd d}|jdddddddddd}td|tj}d}|ry|d}t|}|d}d| d| }|jdkrdd| d d!}n	dd"| d#d!}tjd$|||dd%}| }|d&r|d'}|d(}|| _|   W d S W d S W d S  ty } ztd)tj d* d+| d,| W Y d }~d S d }~ww t d- }t jj|d.jd d/ d S )0NTr  r  r  r  r  r  r  r   r  r  r  r  c                 S   r  r  rb   r  rb   rb   rc   r     r  z'get_onh_district_json.<locals>.<lambda>r  r  rh   r  r  rq   r  r   r  r  r   r  z	district=r  r    linkchain=/ ### /news/a-15-quarter-climb-in-dubai-real-estate-prices ### /developers ### /emaar-properties-dubai/ ### / ### / ### / ### /new-homes/ ### /the-address-jumeirah-resort-and-spa-dubai ### /emaar-properties-dubai/ ### /the-address-jumeirah-resort-and-spa-dubai ### / ### /new-homes/ ### /prescott-real-estate-dubai/ ### /developers ### /new-homes/ ### /berton-dubai ### /berton-dubai/gallery ### /berton-dubai ### /berton-dubai/gallery ### /new-homes/page-2 ### /berton-dubai ### /berton-dubai ### /riviera-dubai ### /riviera-dubai/gallery ### /berton-dubai ### /berton-dubai/gallery ### /berton-dubai/floorplans ### / ### /the-mansions-dubai ### / ### /w1nner-tower-winner-tower-dubai ### /new-homes/ ### /new-homes/ ### /new-homes/page-100 ### /samana-lake-views-dubai ### / ### /golf-grand1-dubai ### /new-homes/ ### /new-homes/page-100 ### /the-legends-villas-dubai ### / ### /claydon-house-dubai ### /new-homes/ ### /new-homes/ ### /new-homes/ ### /golf-grand1-dubai ### /emaar-properties-dubai/ ### /new-homes/ ### /golf-grand1-dubai ### /peninsula-dubai ### /new-homes/property-studio/page-20 ### /new-homes/property-studio/page-30 ### /damac-properties-dubai/ ### /new-homes/property-studio/page-30 ### /merano-tower-dubai ### /sky-hills-residences-2-dubai ### /golf-grand1-dubai ### /peninsula-dubai ### /new-homes/property-studio/page-30 ### /golf-grand1-dubai ### /camelia-villas-dubai ### /new-homes/property-studio/page-30 ### /liv-waterside-dubai ### /new-homes/ ### /elvira-dhe-dubai ### /new-homes/ ### /the-vybe-dubai ### /the-vybe-dubai ### /sky-hills-residences-2-dubai ### /new-homes/ ### /j-one-dubai ### /new-homes/ ### /imperial-avenue-dubai ### /j-one-dubai ### /j-one-dubai/floorplans ### /j-one-dubai ### /imperial-avenue-dubai ### /new-homes/ ### /damac-hills-utopia-dubai ### /new-homes/apartments/property-studio/ ### /j-one-dubai ### /damac-hills-utopia-dubai ### /al-jawhara-tower-dubai ### /al-jawhara-tower-dubai/gallery ### /new-homes/apartments/property-studio/ ### /new-homes/apartments/property-studio/ ### /moonsa-residences-2-dubai ### /new-homes/apartments/property-studio/ ### /linden-residences-dubai ### /j-one-dubai/floorplans ### /j-one-dubai ### /j-one-dubai/gallery ### /' ### / ### /new-homes/ ### /mariane-tower-dubai ### /developers ### /samana-developers-dubai/ ### / ### /imperial-avenue-dubai ### / ### /peninsula-dubai ### / ### /damac-lagoons-morocco-2-dubai ### / ### /damac-casa-dubai ### /new-homes/ ### /park-avenue-dubai ### /new-homes/ ### /new-homes/ ### /park-avenue-dubai ### /new-homes/ ### /parkway-dubai ### /new-homes/ ### /parkway-dubai ### /parkway-dubai/gallery ### /parkway-dubai ### /new-homes/apartments/ ### /new-homes/ ### /riviera-dubai ### / ### /parkway-dubai ### / ### / ### / ### /new-homes/ ### /new-homes/station-jumeirah-beach-residence/ ### /alta-real-estate-developments-dubai/ ### /mr-c-residences-jumeirah-dubai ### / ### / ### /city-walk-northline-dubai ### /parkside-hills-dubai ### /new-homes/ ### /peninsula-dubai ### /parkside-hills-dubai ### / ### /new-homes/ ### /new-homes/ ### /new-homes/ ### /new-homes/ ### /new-homes/ ### /beverly-hills-drive-dubai ### /new-homes/ ### /ag-square-dubai ### /new-homes/ ### / ### /new-homes/ ### /mina-dubai ### /new-homes/ready-to-move/ ### /new-homes/ready-to-move/ ### /new-homes/ready-to-move/ ### /new-homes/ready-to-move/ ### / ### /zada-tower-dubai ### /new-homes/ ### /new-homes/ ### /linden-residences-dubai ### /linden-residences-dubai ### /new-homes/ ### /beach-walk-3-dubai ### / ### /harbour-gate-dubai ### /new-homes/ ### /park-gate-residences-dubai ### /new-homes/ ### /merano-tower-dubai ### / ### /vanguard-by-franÑk-muller-dubai ### /new-homes/ ### /bayview-dubai ### /new-homes/ ### /bayview-by-address-dubai ### /new-homes/ ### /bayview-by-address-resorts-dubai ### /new-homes/ ### /bayview-by-address-dubai ### /new-homes/ ### /bayview-dubai ### /new-homes/ ### /imperial-avenue-dubai ### /new-homes/ ### /davinci-tower-dubai ### /new-homes/ ### /mudon-al-ranim-1-dubai ### /new-homes/ ### /kaya-dubai ### /kaya-dubai ### /new-homes/; _ga_SVS4S7PFEJ=GS1.1.1730685094.108.1.1730686116.0.0.0; _ga=GA1.1.415606180.1724083972; _ym_uid=1719929312736223957; _ym_d=1724083975; cookie_agree=1; PHPSESSID=r  r  u  _ga_JCEVRN83E0=GS1.1.1730685999.287.1.1730686001.58.0.0; _ga=GA1.1.65359444.1719929309; _ym_uid=1719929310452810339; _ym_d=1719929310; _fbp=fb.1.1722030370979.323930974364926; _ga_JCEVRN83E0=deleted; _gcl_au=1.1.962196760.1727727415; linkchain=/ ### /hendon-waterside-london ### / ### /eastman-village-london ### /new-homes/ ### /almax-group-london/ ### /new-homes/year-finished/ ### /1a-st-johns-wood-park-london ### /1a-st-johns-wood-park-london ### /new-homes/?property=1-bedroom&year=Finished ### / ### /new-homes/ ### / ### /new-homes/ ### / ### /developers ### / ### /new-homes/ ### / ### /new-homes/ ### /"https:////1newhomes.com//almax-group-london///" ### /new-homes/ ### / ### /invest ### /first-time-buyers ### /first-time-buyers ### /first-time-buyers ### /the-waterline-london ### /new-homes/options-concierge-service/ ### / ### / ### /luxury-properties ### / ### / ### /developers ### /new-homes/ ### / ### /new-homes/ ### /kingsbury-stone-london/ ### /399-london ### /new-homes/ ### /hadston-london/ ### /new-homes/ ### /the-whiteley-london ### /ae ### / ### /new-homes/ ### /the-chocolate-quarter-london ### / ### / ### /the-silk-district-london ### / ### /new-homes/ ### /battersea-power-station-london ### /the-claves-london ### / ### /new-homes/ ### /whitelocke-house-london ### /new-homes/ ### /shoreditch-parkside-london ### /new-homes/ ### /cassia-london ### /new-homes/ ### /purley-development-london ### /new-homes/ ### /developers ### /rer-london/ ### /developers ### /battersea-power-station-london ### / ### /new-homes/ ### /battersea-power-station-london ### /battersea-power-station-london/floorplans ### /battersea-power-station-london ### /developers ### /new-homes/year-finished/ ### /developers ### /new-homes/ ### /battersea-power-station-london ### /battersea-power-station-london ### /new-homes/ ### /the-platform-london ### /nine-elms-park-e-f-gÑ ### /nine-elms-park-e-f-gÑ-london ### /the-platform-london ### /new-homes/ ### / ### /wardian-london ### / ### /eastman-village-london ### /hayes-village-london ### / ### /battersea-power-station-london ### /battersea-power-station-london/gallery ### / ### /new-homes/ ### /cambridge-house-london ### /new-homes/station-east-croydon/ ### /cambridge-house-london ### /cambridge-house-london ### /new-homes/station-west-croydon/ ### /cambridge-house-london ### /cambridge-house-london ### /cambridge-house-london ### /cambrige-house-hotel-and-residences-london ### /new-homes/ ### /140-northolt-road-london ### / ### / ### / ### / ### /goodluck-hope-london ### /new-homes/ ### /new-homes/ ### / ### /new-homes/ ### /new-homes/ ### / ### / ### /new-homes/barking/ ### /new-homes/harlesden/ ### /new-homes/barking/ ### /new-homes/marylebone/ ### /new-homes/hackney/ ### /high-street-quarter-london ### / ### /high-street-quarter-london ### /new-homes/ ### /wardian-london ### /battersea-power-station-london ### /new-homes/ ### /verdo-kew-bridge-london ### /new-homes/tw8/ ### /new-homes/ ### /the-lucan-autograph-collection-residences-london ### /the-lucan-autograph-collection-residences-london/gallery ### /new-homes/ ### /new-homes/page-20 ### / ### /goodluck-hope-london ### / ### /new-homes/canary-wharf/ ### /goodluck-hope-london/floorplans ### /goodluck-hope-london ### /goodluck-hope-london/floorplans ### / ### /new-homes/ ### /the-lucan-autograph-collection-residences-london ### /the-lucan-autograph-collection-residences-london/gallery ### / ### /goodluck-hope-london ### / ### /new-homes/ ### /bermondsey-heights-london ### /new-homes/ ### /dylon-riverside-london ### /new-homes/ ### /bermondsey-heights-london ### /new-homes/ ### / ### /battersea-power-station-london ### /park-modern-london ### /new-homes/ ### / ### /new-homes/ ### /new-homes/ ### /southmere-london ### / ### /new-homes/ ### /new-homes/central-london-area/ ### / ### /park-modern-london ### /neighbourhood/west-london ### /neighbourhood/ ### /new-homes/ ### /new-homes/property-1-bedroom/ ### /new-homes/canary-wharf/ ### /new-homes/canary-wharf/page-2 ### / ### /eastman-village-london ### /hayes-village-london ### / ### /the-silk-district-london ### /1a-st-johns-wood-park-london ### /goodluck-hope-london ### /brigade-court-london ### /wardian-london ### /hendon-waterside-london ### /new-homes/ ### /10-park-drive-london ### /new-homes/options-health-club/; PHPSESSID=; utm=; cookie_agree=1r  r  r  r   r  rP   rQ   
 district r  r  r  r  )r   rt   ru   r|   r>   r  r   r   r   r  r  r=   r1   r  r  r   r  r  r  r  r   r  r  r   rZ   r[   r\   r]   r^   r   r  )districtr>   r  r   r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r  ra   r2  rb   rb   rc   get_onh_district_json  r  r  c               
   C   r  )1NTr  r  r  r  r  r  rg   r   r  r  r  r  c                 S   r  r  rb   r  rb   rb   rc   r  4  r  z'get_onh_postcode_json.<locals>.<lambda>r  r  rh   r  r  rq   r  r   r  r  r   r  z	postcode=r  r  r  r  r  u  _ga_JCEVRN83E0=GS1.1.1730685999.287.1.1730686775.42.0.0; _ga=GA1.1.65359444.1719929309; _ym_uid=1719929310452810339; _ym_d=1719929310; _fbp=fb.1.1722030370979.323930974364926; _ga_JCEVRN83E0=deleted; _gcl_au=1.1.962196760.1727727415; linkchain=/ ### /hendon-waterside-london ### / ### /eastman-village-london ### /new-homes/ ### /almax-group-london/ ### /new-homes/year-finished/ ### /1a-st-johns-wood-park-london ### /1a-st-johns-wood-park-london ### /new-homes/?property=1-bedroom&year=Finished ### / ### /new-homes/ ### / ### /new-homes/ ### / ### /developers ### / ### /new-homes/ ### / ### /new-homes/ ### /"https:////1newhomes.com//almax-group-london///" ### /new-homes/ ### / ### /invest ### /first-time-buyers ### /first-time-buyers ### /first-time-buyers ### /the-waterline-london ### /new-homes/options-concierge-service/ ### / ### / ### /luxury-properties ### / ### / ### /developers ### /new-homes/ ### / ### /new-homes/ ### /kingsbury-stone-london/ ### /399-london ### /new-homes/ ### /hadston-london/ ### /new-homes/ ### /the-whiteley-london ### /ae ### / ### /new-homes/ ### /the-chocolate-quarter-london ### / ### / ### /the-silk-district-london ### / ### /new-homes/ ### /battersea-power-station-london ### /the-claves-london ### / ### /new-homes/ ### /whitelocke-house-london ### /new-homes/ ### /shoreditch-parkside-london ### /new-homes/ ### /cassia-london ### /new-homes/ ### /purley-development-london ### /new-homes/ ### /developers ### /rer-london/ ### /developers ### /battersea-power-station-london ### / ### /new-homes/ ### /battersea-power-station-london ### /battersea-power-station-london/floorplans ### /battersea-power-station-london ### /developers ### /new-homes/year-finished/ ### /developers ### /new-homes/ ### /battersea-power-station-london ### /battersea-power-station-london ### /new-homes/ ### /the-platform-london ### /nine-elms-park-e-f-gÑ ### /nine-elms-park-e-f-gÑ-london ### /the-platform-london ### /new-homes/ ### / ### /wardian-london ### / ### /eastman-village-london ### /hayes-village-london ### / ### /battersea-power-station-london ### /battersea-power-station-london/gallery ### / ### /new-homes/ ### /cambridge-house-london ### /new-homes/station-east-croydon/ ### /cambridge-house-london ### /cambridge-house-london ### /new-homes/station-west-croydon/ ### /cambridge-house-london ### /cambridge-house-london ### /cambridge-house-london ### /cambrige-house-hotel-and-residences-london ### /new-homes/ ### /140-northolt-road-london ### / ### / ### / ### / ### /goodluck-hope-london ### /new-homes/ ### /new-homes/ ### / ### /new-homes/ ### /new-homes/ ### / ### / ### /new-homes/barking/ ### /new-homes/harlesden/ ### /new-homes/barking/ ### /new-homes/marylebone/ ### /new-homes/hackney/ ### /high-street-quarter-london ### / ### /high-street-quarter-london ### /new-homes/ ### /wardian-london ### /battersea-power-station-london ### /new-homes/ ### /verdo-kew-bridge-london ### /new-homes/tw8/ ### /new-homes/ ### /the-lucan-autograph-collection-residences-london ### /the-lucan-autograph-collection-residences-london/gallery ### /new-homes/ ### /new-homes/page-20 ### / ### /goodluck-hope-london ### / ### /new-homes/canary-wharf/ ### /goodluck-hope-london/floorplans ### /goodluck-hope-london ### /goodluck-hope-london/floorplans ### / ### /new-homes/ ### /the-lucan-autograph-collection-residences-london ### /the-lucan-autograph-collection-residences-london/gallery ### / ### /goodluck-hope-london ### / ### /new-homes/ ### /bermondsey-heights-london ### /new-homes/ ### /dylon-riverside-london ### /new-homes/ ### /bermondsey-heights-london ### /new-homes/ ### / ### /battersea-power-station-london ### /park-modern-london ### /new-homes/ ### / ### /new-homes/ ### /new-homes/ ### /southmere-london ### / ### /new-homes/ ### /new-homes/central-london-area/ ### / ### /park-modern-london ### /neighbourhood/west-london ### /neighbourhood/ ### /new-homes/ ### /new-homes/property-1-bedroom/ ### /new-homes/canary-wharf/ ### /new-homes/canary-wharf/page-2 ### / ### /eastman-village-london ### /hayes-village-london ### / ### /the-silk-district-london ### /1a-st-johns-wood-park-london ### /goodluck-hope-london ### /brigade-court-london ### /wardian-london ### /hendon-waterside-london ### /new-homes/ ### /10-park-drive-london ### /new-homes/options-health-club/; PHPSESSID=r  r  r  r  r  r   r  rP   rQ   r  r  r  r  r  )r   rt   ru   r|   r>   r  r   r   r   r  r  r=   r1   r  r  r   r  r  r  r  r   r  r  r   rZ   r[   r\   r]   r^   r   r  )postcoder>   r  r   r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r  ra   r2  rb   rb   rc   get_onh_postcode_json!  r  r  c               
   C   s  t jjdd } | r| j}| j}| j}|jdkrd}d}nd}d}ztj|dd	}|j	d
kr|j
}|d }|j}	t|	d}
|
jddd d}|jdddddddddd}td|tj}d}|ry|d}t|}|d}d| d| }|jdkrdd| d d!}n	dd"| d#d!}tjd$|||dd%}| }t| |d&r|d'}|d(}|| _|   W d S W d S W d S  ty } ztd)tj d* d+| d,| W Y d }~d S d }~ww t d- }t jj|d.jd d/ d S )0NTr  r  r  r  r  r  r  r   r  r  r  r  c                 S   r  r  rb   r  rb   rb   rc   r  h  r  z#get_onh_area_json.<locals>.<lambda>r  r  rh   r  r  rq   r  r   r  r  r   r  zarea=r  r  u  linkchain=/ ### /news/a-15-quarter-climb-in-dubai-real-estate-prices ### /developers ### /emaar-properties-dubai/ ### / ### / ### / ### /new-homes/ ### /the-address-jumeirah-resort-and-spa-dubai ### /emaar-properties-dubai/ ### /the-address-jumeirah-resort-and-spa-dubai ### / ### /new-homes/ ### /prescott-real-estate-dubai/ ### /developers ### /new-homes/ ### /berton-dubai ### /berton-dubai/gallery ### /berton-dubai ### /berton-dubai/gallery ### /new-homes/page-2 ### /berton-dubai ### /berton-dubai ### /riviera-dubai ### /riviera-dubai/gallery ### /berton-dubai ### /berton-dubai/gallery ### /berton-dubai/floorplans ### / ### /the-mansions-dubai ### / ### /w1nner-tower-winner-tower-dubai ### /new-homes/ ### /new-homes/ ### /new-homes/page-100 ### /samana-lake-views-dubai ### / ### /golf-grand1-dubai ### /new-homes/ ### /new-homes/page-100 ### /the-legends-villas-dubai ### / ### /claydon-house-dubai ### /new-homes/ ### /new-homes/ ### /new-homes/ ### /golf-grand1-dubai ### /emaar-properties-dubai/ ### /new-homes/ ### /golf-grand1-dubai ### /peninsula-dubai ### /new-homes/property-studio/page-20 ### /new-homes/property-studio/page-30 ### /damac-properties-dubai/ ### /new-homes/property-studio/page-30 ### /merano-tower-dubai ### /sky-hills-residences-2-dubai ### /golf-grand1-dubai ### /peninsula-dubai ### /new-homes/property-studio/page-30 ### /golf-grand1-dubai ### /camelia-villas-dubai ### /new-homes/property-studio/page-30 ### /liv-waterside-dubai ### /new-homes/ ### /elvira-dhe-dubai ### /new-homes/ ### /the-vybe-dubai ### /the-vybe-dubai ### /sky-hills-residences-2-dubai ### /new-homes/ ### /j-one-dubai ### /new-homes/ ### /imperial-avenue-dubai ### /j-one-dubai ### /j-one-dubai/floorplans ### /j-one-dubai ### /imperial-avenue-dubai ### /new-homes/ ### /damac-hills-utopia-dubai ### /new-homes/apartments/property-studio/ ### /j-one-dubai ### /damac-hills-utopia-dubai ### /al-jawhara-tower-dubai ### /al-jawhara-tower-dubai/gallery ### /new-homes/apartments/property-studio/ ### /new-homes/apartments/property-studio/ ### /moonsa-residences-2-dubai ### /new-homes/apartments/property-studio/ ### /linden-residences-dubai ### /j-one-dubai/floorplans ### /j-one-dubai ### /j-one-dubai/gallery ### /' ### / ### /new-homes/ ### /mariane-tower-dubai ### /developers ### /samana-developers-dubai/ ### / ### /imperial-avenue-dubai ### / ### /peninsula-dubai ### / ### /damac-lagoons-morocco-2-dubai ### / ### /damac-casa-dubai ### /new-homes/ ### /park-avenue-dubai ### /new-homes/ ### /new-homes/ ### /park-avenue-dubai ### /new-homes/ ### /parkway-dubai ### /new-homes/ ### /parkway-dubai ### /parkway-dubai/gallery ### /parkway-dubai ### /new-homes/apartments/ ### /new-homes/ ### /riviera-dubai ### / ### /parkway-dubai ### / ### / ### / ### /new-homes/ ### /new-homes/area-jumeirah-beach-residence/ ### /alta-real-estate-developments-dubai/ ### /mr-c-residences-jumeirah-dubai ### / ### / ### /city-walk-northline-dubai ### /parkside-hills-dubai ### /new-homes/ ### /peninsula-dubai ### /parkside-hills-dubai ### / ### /new-homes/ ### /new-homes/ ### /new-homes/ ### /new-homes/ ### /new-homes/ ### /beverly-hills-drive-dubai ### /new-homes/ ### /ag-square-dubai ### /new-homes/ ### / ### /new-homes/ ### /mina-dubai ### /new-homes/ready-to-move/ ### /new-homes/ready-to-move/ ### /new-homes/ready-to-move/ ### /new-homes/ready-to-move/ ### / ### /zada-tower-dubai ### /new-homes/ ### /new-homes/ ### /linden-residences-dubai ### /linden-residences-dubai ### /new-homes/ ### /beach-walk-3-dubai ### / ### /harbour-gate-dubai ### /new-homes/ ### /park-gate-residences-dubai ### /new-homes/ ### /merano-tower-dubai ### / ### /vanguard-by-franÑk-muller-dubai ### /new-homes/ ### /bayview-dubai ### /new-homes/ ### /bayview-by-address-dubai ### /new-homes/ ### /bayview-by-address-resorts-dubai ### /new-homes/ ### /bayview-by-address-dubai ### /new-homes/ ### /bayview-dubai ### /new-homes/ ### /imperial-avenue-dubai ### /new-homes/ ### /davinci-tower-dubai ### /new-homes/ ### /mudon-al-ranim-1-dubai ### /new-homes/ ### /kaya-dubai ### /kaya-dubai ### /new-homes/; _ga_SVS4S7PFEJ=GS1.1.1730685094.108.1.1730685108.0.0.0; _ga=GA1.1.415606180.1724083972; _ym_uid=1719929312736223957; _ym_d=1724083975; cookie_agree=1; PHPSESSID=r  r  u  _ga_JCEVRN83E0=GS1.1.1730680201.285.1.1730681307.44.0.0; _ga=GA1.1.65359444.1719929309; _ym_uid=1719929310452810339; _ym_d=1719929310; _fbp=fb.1.1722030370979.323930974364926; _ga_JCEVRN83E0=deleted; _gcl_au=1.1.962196760.1727727415; linkchain=/ ### /hendon-waterside-london ### / ### /eastman-village-london ### /new-homes/ ### /almax-group-london/ ### /new-homes/year-finished/ ### /1a-st-johns-wood-park-london ### /1a-st-johns-wood-park-london ### /new-homes/?property=1-bedroom&year=Finished ### / ### /new-homes/ ### / ### /new-homes/ ### / ### /developers ### / ### /new-homes/ ### / ### /new-homes/ ### /"https:////1newhomes.com//almax-group-london///" ### /new-homes/ ### / ### /invest ### /first-time-buyers ### /first-time-buyers ### /first-time-buyers ### /the-waterline-london ### /new-homes/options-concierge-service/ ### / ### / ### /luxury-properties ### / ### / ### /developers ### /new-homes/ ### / ### /new-homes/ ### /kingsbury-stone-london/ ### /399-london ### /new-homes/ ### /hadston-london/ ### /new-homes/ ### /the-whiteley-london ### /ae ### / ### /new-homes/ ### /the-chocolate-quarter-london ### / ### / ### /the-silk-district-london ### / ### /new-homes/ ### /battersea-power-area-london ### /the-claves-london ### / ### /new-homes/ ### /whitelocke-house-london ### /new-homes/ ### /shoreditch-parkside-london ### /new-homes/ ### /cassia-london ### /new-homes/ ### /purley-development-london ### /new-homes/ ### /developers ### /rer-london/ ### /developers ### /battersea-power-area-london ### / ### /new-homes/ ### /battersea-power-area-london ### /battersea-power-area-london/floorplans ### /battersea-power-area-london ### /developers ### /new-homes/year-finished/ ### /developers ### /new-homes/ ### /battersea-power-area-london ### /battersea-power-area-london ### /new-homes/ ### /the-platform-london ### /nine-elms-park-e-f-gÑ ### /nine-elms-park-e-f-gÑ-london ### /the-platform-london ### /new-homes/ ### / ### /wardian-london ### / ### /eastman-village-london ### /hayes-village-london ### / ### /battersea-power-area-london ### /battersea-power-area-london/gallery ### / ### /new-homes/ ### /cambridge-house-london ### /new-homes/area-east-croydon/ ### /cambridge-house-london ### /cambridge-house-london ### /new-homes/area-west-croydon/ ### /cambridge-house-london ### /cambridge-house-london ### /cambridge-house-london ### /cambrige-house-hotel-and-residences-london ### /new-homes/ ### /140-northolt-road-london ### / ### / ### / ### / ### /goodluck-hope-london ### /new-homes/ ### /new-homes/ ### / ### /new-homes/ ### /new-homes/ ### / ### / ### /new-homes/barking/ ### /new-homes/harlesden/ ### /new-homes/barking/ ### /new-homes/marylebone/ ### /new-homes/hackney/ ### /high-street-quarter-london ### / ### /high-street-quarter-london ### /new-homes/ ### /wardian-london ### /battersea-power-area-london ### /new-homes/ ### /verdo-kew-bridge-london ### /new-homes/tw8/ ### /new-homes/ ### /the-lucan-autograph-collection-residences-london ### /the-lucan-autograph-collection-residences-london/gallery ### /new-homes/ ### /new-homes/page-20 ### / ### /goodluck-hope-london ### / ### /new-homes/canary-wharf/ ### /goodluck-hope-london/floorplans ### /goodluck-hope-london ### /goodluck-hope-london/floorplans ### / ### /new-homes/ ### /the-lucan-autograph-collection-residences-london ### /the-lucan-autograph-collection-residences-london/gallery ### / ### /goodluck-hope-london ### / ### /new-homes/ ### /bermondsey-heights-london ### /new-homes/ ### /dylon-riverside-london ### /new-homes/ ### /bermondsey-heights-london ### /new-homes/ ### / ### /battersea-power-area-london ### /park-modern-london ### /new-homes/ ### / ### /new-homes/ ### /new-homes/ ### /southmere-london ### / ### /new-homes/ ### /new-homes/central-london-area/ ### / ### /park-modern-london ### /neighbourhood/west-london ### /neighbourhood/ ### /new-homes/ ### /new-homes/property-1-bedroom/ ### /new-homes/canary-wharf/ ### /new-homes/canary-wharf/page-2 ### / ### /eastman-village-london ### /hayes-village-london ### / ### /the-silk-district-london ### /1a-st-johns-wood-park-london ### /goodluck-hope-london ### /brigade-court-london ### /wardian-london ### /hendon-waterside-london ### /new-homes/ ### /10-park-drive-london ### /new-homes/options-health-club/; PHPSESSID=r  r  r  r  r   r  rP   rQ   z area r  r  r  r  )r   rt   ru   r|   r>   r  r   r   r   r  r  r=   r1   r  r  r   r  r  r  r  r   r  r  r[   r   rZ   r\   r]   r^   r   r  )r;  r>   r  r   r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r  ra   r2  rb   rb   rc   get_onh_area_jsonU  sb   


.








2r  c               
   C   r  )0NTr  r  r  r  r  r  r  r   r  r  r  r  c                 S   r  r  rb   r  rb   rb   rc   r    r  z#get_onh_zone_json.<locals>.<lambda>r  r  rh   r  r  rq   r  r   r  r  r   r  zzone=r  r  u  linkchain=/ ### /news/a-15-quarter-climb-in-dubai-real-estate-prices ### /developers ### /emaar-properties-dubai/ ### / ### / ### / ### /new-homes/ ### /the-address-jumeirah-resort-and-spa-dubai ### /emaar-properties-dubai/ ### /the-address-jumeirah-resort-and-spa-dubai ### / ### /new-homes/ ### /prescott-real-estate-dubai/ ### /developers ### /new-homes/ ### /berton-dubai ### /berton-dubai/gallery ### /berton-dubai ### /berton-dubai/gallery ### /new-homes/page-2 ### /berton-dubai ### /berton-dubai ### /riviera-dubai ### /riviera-dubai/gallery ### /berton-dubai ### /berton-dubai/gallery ### /berton-dubai/floorplans ### / ### /the-mansions-dubai ### / ### /w1nner-tower-winner-tower-dubai ### /new-homes/ ### /new-homes/ ### /new-homes/page-100 ### /samana-lake-views-dubai ### / ### /golf-grand1-dubai ### /new-homes/ ### /new-homes/page-100 ### /the-legends-villas-dubai ### / ### /claydon-house-dubai ### /new-homes/ ### /new-homes/ ### /new-homes/ ### /golf-grand1-dubai ### /emaar-properties-dubai/ ### /new-homes/ ### /golf-grand1-dubai ### /peninsula-dubai ### /new-homes/property-studio/page-20 ### /new-homes/property-studio/page-30 ### /damac-properties-dubai/ ### /new-homes/property-studio/page-30 ### /merano-tower-dubai ### /sky-hills-residences-2-dubai ### /golf-grand1-dubai ### /peninsula-dubai ### /new-homes/property-studio/page-30 ### /golf-grand1-dubai ### /camelia-villas-dubai ### /new-homes/property-studio/page-30 ### /liv-waterside-dubai ### /new-homes/ ### /elvira-dhe-dubai ### /new-homes/ ### /the-vybe-dubai ### /the-vybe-dubai ### /sky-hills-residences-2-dubai ### /new-homes/ ### /j-one-dubai ### /new-homes/ ### /imperial-avenue-dubai ### /j-one-dubai ### /j-one-dubai/floorplans ### /j-one-dubai ### /imperial-avenue-dubai ### /new-homes/ ### /damac-hills-utopia-dubai ### /new-homes/apartments/property-studio/ ### /j-one-dubai ### /damac-hills-utopia-dubai ### /al-jawhara-tower-dubai ### /al-jawhara-tower-dubai/gallery ### /new-homes/apartments/property-studio/ ### /new-homes/apartments/property-studio/ ### /moonsa-residences-2-dubai ### /new-homes/apartments/property-studio/ ### /linden-residences-dubai ### /j-one-dubai/floorplans ### /j-one-dubai ### /j-one-dubai/gallery ### /' ### / ### /new-homes/ ### /mariane-tower-dubai ### /developers ### /samana-developers-dubai/ ### / ### /imperial-avenue-dubai ### / ### /peninsula-dubai ### / ### /damac-lagoons-morocco-2-dubai ### / ### /damac-casa-dubai ### /new-homes/ ### /park-avenue-dubai ### /new-homes/ ### /new-homes/ ### /park-avenue-dubai ### /new-homes/ ### /parkway-dubai ### /new-homes/ ### /parkway-dubai ### /parkway-dubai/gallery ### /parkway-dubai ### /new-homes/apartments/ ### /new-homes/ ### /riviera-dubai ### / ### /parkway-dubai ### / ### / ### / ### /new-homes/ ### /new-homes/zone-jumeirah-beach-residence/ ### /alta-real-estate-developments-dubai/ ### /mr-c-residences-jumeirah-dubai ### / ### / ### /city-walk-northline-dubai ### /parkside-hills-dubai ### /new-homes/ ### /peninsula-dubai ### /parkside-hills-dubai ### / ### /new-homes/ ### /new-homes/ ### /new-homes/ ### /new-homes/ ### /new-homes/ ### /beverly-hills-drive-dubai ### /new-homes/ ### /ag-square-dubai ### /new-homes/ ### / ### /new-homes/ ### /mina-dubai ### /new-homes/ready-to-move/ ### /new-homes/ready-to-move/ ### /new-homes/ready-to-move/ ### /new-homes/ready-to-move/ ### / ### /zada-tower-dubai ### /new-homes/ ### /new-homes/ ### /linden-residences-dubai ### /linden-residences-dubai ### /new-homes/ ### /beach-walk-3-dubai ### / ### /harbour-gate-dubai ### /new-homes/ ### /park-gate-residences-dubai ### /new-homes/ ### /merano-tower-dubai ### / ### /vanguard-by-franÑk-muller-dubai ### /new-homes/ ### /bayview-dubai ### /new-homes/ ### /bayview-by-address-dubai ### /new-homes/ ### /bayview-by-address-resorts-dubai ### /new-homes/ ### /bayview-by-address-dubai ### /new-homes/ ### /bayview-dubai ### /new-homes/ ### /imperial-avenue-dubai ### /new-homes/ ### /davinci-tower-dubai ### /new-homes/ ### /mudon-al-ranim-1-dubai ### /new-homes/ ### /kaya-dubai ### /kaya-dubai ### /new-homes/; _ga_SVS4S7PFEJ=GS1.1.1730685094.108.1.1730685108.0.0.0; _ga=GA1.1.415606180.1724083972; _ym_uid=1719929312736223957; _ym_d=1724083975; cookie_agree=1; PHPSESSID=r  r  u  _ga_JCEVRN83E0=GS1.1.1730680201.285.1.1730681307.44.0.0; _ga=GA1.1.65359444.1719929309; _ym_uid=1719929310452810339; _ym_d=1719929310; _fbp=fb.1.1722030370979.323930974364926; _ga_JCEVRN83E0=deleted; _gcl_au=1.1.962196760.1727727415; linkchain=/ ### /hendon-waterside-london ### / ### /eastman-village-london ### /new-homes/ ### /almax-group-london/ ### /new-homes/year-finished/ ### /1a-st-johns-wood-park-london ### /1a-st-johns-wood-park-london ### /new-homes/?property=1-bedroom&year=Finished ### / ### /new-homes/ ### / ### /new-homes/ ### / ### /developers ### / ### /new-homes/ ### / ### /new-homes/ ### /"https:////1newhomes.com//almax-group-london///" ### /new-homes/ ### / ### /invest ### /first-time-buyers ### /first-time-buyers ### /first-time-buyers ### /the-waterline-london ### /new-homes/options-concierge-service/ ### / ### / ### /luxury-properties ### / ### / ### /developers ### /new-homes/ ### / ### /new-homes/ ### /kingsbury-stone-london/ ### /399-london ### /new-homes/ ### /hadston-london/ ### /new-homes/ ### /the-whiteley-london ### /ae ### / ### /new-homes/ ### /the-chocolate-quarter-london ### / ### / ### /the-silk-district-london ### / ### /new-homes/ ### /battersea-power-zone-london ### /the-claves-london ### / ### /new-homes/ ### /whitelocke-house-london ### /new-homes/ ### /shoreditch-parkside-london ### /new-homes/ ### /cassia-london ### /new-homes/ ### /purley-development-london ### /new-homes/ ### /developers ### /rer-london/ ### /developers ### /battersea-power-zone-london ### / ### /new-homes/ ### /battersea-power-zone-london ### /battersea-power-zone-london/floorplans ### /battersea-power-zone-london ### /developers ### /new-homes/year-finished/ ### /developers ### /new-homes/ ### /battersea-power-zone-london ### /battersea-power-zone-london ### /new-homes/ ### /the-platform-london ### /nine-elms-park-e-f-gÑ ### /nine-elms-park-e-f-gÑ-london ### /the-platform-london ### /new-homes/ ### / ### /wardian-london ### / ### /eastman-village-london ### /hayes-village-london ### / ### /battersea-power-zone-london ### /battersea-power-zone-london/gallery ### / ### /new-homes/ ### /cambridge-house-london ### /new-homes/zone-east-croydon/ ### /cambridge-house-london ### /cambridge-house-london ### /new-homes/zone-west-croydon/ ### /cambridge-house-london ### /cambridge-house-london ### /cambridge-house-london ### /cambrige-house-hotel-and-residences-london ### /new-homes/ ### /140-northolt-road-london ### / ### / ### / ### / ### /goodluck-hope-london ### /new-homes/ ### /new-homes/ ### / ### /new-homes/ ### /new-homes/ ### / ### / ### /new-homes/barking/ ### /new-homes/harlesden/ ### /new-homes/barking/ ### /new-homes/marylebone/ ### /new-homes/hackney/ ### /high-street-quarter-london ### / ### /high-street-quarter-london ### /new-homes/ ### /wardian-london ### /battersea-power-zone-london ### /new-homes/ ### /verdo-kew-bridge-london ### /new-homes/tw8/ ### /new-homes/ ### /the-lucan-autograph-collection-residences-london ### /the-lucan-autograph-collection-residences-london/gallery ### /new-homes/ ### /new-homes/page-20 ### / ### /goodluck-hope-london ### / ### /new-homes/canary-wharf/ ### /goodluck-hope-london/floorplans ### /goodluck-hope-london ### /goodluck-hope-london/floorplans ### / ### /new-homes/ ### /the-lucan-autograph-collection-residences-london ### /the-lucan-autograph-collection-residences-london/gallery ### / ### /goodluck-hope-london ### / ### /new-homes/ ### /bermondsey-heights-london ### /new-homes/ ### /dylon-riverside-london ### /new-homes/ ### /bermondsey-heights-london ### /new-homes/ ### / ### /battersea-power-zone-london ### /park-modern-london ### /new-homes/ ### / ### /new-homes/ ### /new-homes/ ### /southmere-london ### / ### /new-homes/ ### /new-homes/central-london-zone/ ### / ### /park-modern-london ### /neighbourhood/west-london ### /neighbourhood/ ### /new-homes/ ### /new-homes/property-1-bedroom/ ### /new-homes/canary-wharf/ ### /new-homes/canary-wharf/page-2 ### / ### /eastman-village-london ### /hayes-village-london ### / ### /the-silk-district-london ### /1a-st-johns-wood-park-london ### /goodluck-hope-london ### /brigade-court-london ### /wardian-london ### /hendon-waterside-london ### /new-homes/ ### /10-park-drive-london ### /new-homes/options-health-club/; PHPSESSID=r  r  r  r  r   r  rP   rQ   z zone r  r  r  r  )r   rt   ru   r|   r>   r  r   r   r   r  r  r=   r1   r  r  r   r  r  r  r  r   r  r  r   rZ   r[   r\   r]   r^   r   r  )zoner>   r  r   r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r  ra   r2  rb   rb   rc   get_onh_zone_json  r  r  c            	   
   C   s   t   d } tjjtddt| dB dd }|rn|j}|j}|d}|D ]8}|d}t	
|}t|dd	}ztjj||d
}|j| W q'   tdtj d d| d Y q'd|_t   |_|  d S d S Nr  F)is_checkr  r  	locations	pagetitleTallow_unicode)r   r{  rP   rQ   rZ  z
 not found)r   r   rt   ru   r+   r|   r   r{  r   rp   unescaper2   r	   rx   addr[   r\   r]   r^   r  
last_checkr   )	r2  r  r   r{  r   r  r~   r   rv   rb   rb   rc   set_development_station  s&   $


&
r  c            	   
   C      t   d } tjjtddt| dB dd }|rn|j}|d}|j}|D ]8}|d}t	
|}t|dd	}ztjj||d
}|j| W q'   tdtj d d| d Y q'd|_t   |_|  d S d S r  )r   r   rt   ru   r+   r|   r   r   r{  rp   r  r2   r	   onh_districtr  r[   r\   r]   r^   r  r  r   )	r2  r  r   r   r{  r  r~   r   rv   rb   rb   rc   set_development_district  &   $


&
r  c            	   
   C   r  r  )r   r   rt   ru   r+   r|   r   r   r{  rp   r  r2   r	   onh_postcoder  r[   r\   r]   r^   r  r  r   )	r2  r  r   r   r{  r  r~   r   rv   rb   rb   rc   set_development_postcode  r  r  c            	   
   C   r  r  )r   r   rt   ru   r+   r|   r   r   r{  rp   r  r2   r	   onh_arear  r[   r\   r]   r^   r  r  r   )	r2  r;  r   r   r{  r  r~   r   rv   rb   rb   rc   set_development_area  r  r  c            	   
   C   r  r  )r   r   rt   ru   r+   r|   r   r   r{  rp   r  r2   r	   onh_zoner  r[   r\   r]   r^   r  r  r   )	r2  r  r   r   r{  r  r~   r   rv   rb   rb   rc   set_development_zone  r  r  c                  C   s  g } g }g }g }g }g }g }g }t j D ]M}tjj|j|d d d tjj|djddd	 }	|	D ]}
tjj|j|d d|
 d q2t
jj|djd	dd	 }|D ]}tjj|j|d d
| d qRqtj D ]Y}tjj|j|j|jddd d tjj|djddd	 }	|	D ]}
tjj|j|j|jddd|
 d qt
jj|djd	dd	 }|D ]}tjj|j|j|jddd
| d qqhtj D ]Z}tjj|j|j|jddd d tjj|djddd	 }	|	D ]}
tjj|j|j|jddd|
 d qt
jj|djd	dd	 }|D ]}tjj|j|j|jddd
| d qqtj D ]\}tjj|j|j|jddd d tjj|djddd	 }	|	D ]}
tjj|j|j|jddd|
 d qHt
jj|djd	dd	 }|D ]}tjj|j|j|jddd
| d qmq'tj D ]\}tjj|j|j|jddd d tjj|djddd	 }	|	D ]}
tjj|j|j|jddd|
 d qt
jj|djd	dd	 }|D ]}tjj|j|j|jddd
| d qϐqtj D ]\}tjj|j|j|jddd d tjj|djddd	 }	|	D ]}
tjj|j|j|jddd|
 d qt
jj|djd	dd	 }|D ]}tjj|j|j|jddd
| d q1qd S )N)r{  r  first_filtersecond_filter)development__cityr1  Tri   bedroom)r{  r  r  second_filter_typer  )'development_features__development__cityr>   r   r  around)r{  r  r  first_filter_typefirst_filter_prefixr  )development__onh_station)r{  r  r  r  r  r  r  ).development_features__development__onh_stationr  in)development__onh_district)/development_features__development__onh_districtr  )development__onh_postcode)/development_features__development__onh_postcoder;  )development__onh_area)+development_features__development__onh_arear  )development__onh_zone)+development_features__development__onh_zone)r&   rt   ry   r   r   r{  r   ru   rz   r   r   r   r  r>   r   r   r   r   )london_payment_optionsdubai_payment_optionslondon_bedroomsdubai_bedroomslondon_featuresdubai_featureslondon_complitationdubai_complitationr  bedroomsr  featuresr   r  r  r  r;  r  rb   rb   rc   create_filter_seo_objects(  s~   $$$&&&&&&&r
    c                 C   s  d|  d| d|  d| d| d| d}|r|d| d	7 }|	r)|d
|	 d7 }|
r3|d|
 d7 }|d| d| d|  d7 }z.t td}|jjj|dddd|dgd|dd d}|jd jj}|dddd}|W S  t	y } zt
d|  W Y d }~d S d }~ww )Nz
        You are a professional copywriter creating a detailed and engaging text about new build properties and apartments for sale in a0  .
        This text is intended for a property website targeting potential buyers, including families, first-time homeowners, and investors.
        The tone should be friendly, informative, and persuasive, with clear headings and bullet points for lists where appropriate.
        The text should be in aj  .
        The text should be in HTML format, without <html>, <head>, and <body> tags, and for heading tags, use <h3>-<h6> tags.

        Requirements
        Tone and Style:

        Conversational, engaging, and persuasive, designed to inspire action while providing useful information.
        Include rhetorical questions and relatable scenarios to make the text human-like and engaging.
        Use phrases that emphasize the uniqueness of the properties and apartments and create a sense of urgency.
        Structure:

        Captivating Introduction: Why buying a property or apartment in a new development in z is the best decision for families, professionals, or investors looking for long-term value and comfort.

        Neighborhoods: Highlight key areas (z) with details about excellent transport links, local schools, parks, and amenities that make these areas desirable.

        Benefits of New Builds: Discuss the advantages of buying new builds, including features like z such as modern architecture, energy efficiency, and smart home capabilities.

        Modern Amenities: Showcase the benefits of apartments in new developments, emphasizing features like zG, offering modern, comfortable living with safety and convenience.
    zIAvailability: Mention property and apartment availability status such as ut   , emphasizing that the best options are selling fast. Use phrases like “Limited Availability” to create urgency.z=Completion Date: Provide expected or actual completion dates z7, helping buyers plan their next steps with confidence.z4Ready to Move: Highlight "Ready to Move" properties z` for buyers eager to settle in quickly and enjoy the convenience of moving into a finished home.z0
        Pricing Overview: Include price ranges z, emphasizing flexibility for different budgets and how these properties offer long-term value and growth potential.

        Featured Developments: Introduce standout projects such as z, detailing their unique features and explaining why they represent a solid investment.

        A Future-Proof Investment: Discuss the potential returns of owning a property in a	  , including price trends and the advantages of investing in high-demand neighborhoods.

        Dynamic Call to Action: End with an engaging call to action, encouraging readers to explore listings, schedule a visit, or secure their dream property today.

        Key Guidelines:
        Text length: 600-800 words.
        Maintain a natural, engaging tone that feels human-written, while creating urgency to prompt action.
        Ensure the text is fluent, easily understandable, and highlights key insights for potential clients.
        Sales-focused: Every section should address customer needs and highlight solutions, making the text both informative and persuasive.
        Avoid repetitive or generic phrasing, and keep the content fresh, dynamic, and actionable.
    r;   rB   a  You are an experienced real estate consultant and content optimization specialist. Your role is to analyze, refine, and enhance user prompts to maximize their effectiveness. You focus on creating SEO-friendly, engaging, and persuasive text for real estate listings. Always ensure the tone aligns with the target audience (families, first-time buyers, investors) and the structure is clear and sales-oriented. Provide actionable feedback and suggest improvements to meet the user's goals.rD   rG   rH   r   )rJ   rK   rL   
max_tokensnstopr   ```htmlrq   rr   zError generating content: )r3   r6   rU   rV   rW   rX   rY   rF   r   rZ   r[   )r;  r   r	  pricer   rA   r  rJ   	availablecompletion_dateready_to_movebase_promptr`   r   generated_textra   rb   rb   rc   generate_seo_texti  sd   
r  c                  C   s  t jjdddd d } tjjdd}| D ]}|j}d|j }|j}|d u r<|jdkr5t	jjd	d}nt	jjd
d}|jdkrCdnd}|j
}|j}|j}	|j}
|j}|j}|j}t|d}|rddd |j dd d D }d|j d}|t|dM }|r|
 d| d|j d}|	dkr|t|dM }n|	dkrddd |j dd d D }|t|dM }n`|	dkrddd |j dd d D }|t|dM }n@|	dkrdd d |j dd d D }|t|d!M }n |	d"krdd#d |j dd d D }|t|d$M }|rP|d%kr:| dt| d&| }|t|d'M }n|d(krP| d| d)| }|t|d*M }tj| }d+d,d tjj|d- d d. D }zttjj|d/d0jt d1d2j!d3dd4}W n   d/}Y zt"tjj|d/d0jt#d1d2j!d3dd4}W n   d5}Y | d6| d|j }dd7d |d d D }t$|||||}|r|j%j&||d8 qd S )9NTF)translates__isnullcity__isnullrg   rk   r   zin GBr   r   Londonr  rz  rh   c                 S      g | ]}|j qS rb   r   rC  re  rb   rb   rc   rE        z(add_english_seo_text.<locals>.<listcomp>?r   z city)r  r   z in r  )onh_station__namer  c                 S   r  rb   r   r  rb   rb   rc   rE    r  )onh_district__namer  c                 S   r  rb   r   r  rb   rb   rc   rE    r  )onh_postcode__namer;  c                 S   r  rb   r   r  rb   rb   rc   rE    r  )onh_area__namer  c                 S   r  rb   r   r  rb   rb   rc   rE    r  )onh_zone__namer  z flats )flats__bedrooms_numr   r  )key_features__feature__namez,  c                 S   r  rb   r   rC  frb   rb   rc   rE    r  )%development_features__development__inr   r   )development__inbase_price__gtr=  )ck_pricer+  ri   50000000 - c                 S   r  rb   r~   r  rb   rb   rc   rE    r  rA   r=   )'r   rt   ru   r*   r   r{  r>   r_  r   r   r  r  r  r  r  r  second_filter_prefixr+   rw   onh_districtsry   order_byr  r  rx   r%   r	   r   r   minr   r   r.   rz   maxr-   r  r{   rW   )fstlanguger'  r{  r;  r   r   r  r  r  r  r  r  r0  dfr   r	  
min_prices
max_pricesr  r=   rb   rb   rc   add_english_seo_text  sv   


((((
(

*00r:  c              
   C   s   d| d|  d}z/t td}|jjj|dddd|dgd	d
}|jd jj}|dddd}d|d dW S  t	y` } zt
dtj d d| dd | dW  Y d }~S d }~ww )Nz%
    translate the following text to zk language without changing the meaning of the text in html format and without html,body and head tags:
    z
    r;   rB   rC   rD   rG   rH   rI   r   r  rq   rr   FrM   rP   rQ    : in text translate error : T)r3   r6   rU   rV   rW   rX   rY   rF   r   rZ   r[   r\   r]   r^   )r=   rA   rJ   r_   r`   rU   r  ra   rb   rb   rc   text_translate  s0   r<  c                  C   s   t jjdd} t jjdd}tjjtddj|  d d	 }|rgz=|j
j|d	 j}| D ]-}|j
j|d s]t||j}|d rStd	|j d
|j d q0|j
j||d d q0W d S    Y d S d S )Nrk   r   r{   r   r   r   r   rN   rP   r0  z	 languagerF   r/  )r*   rt   r   r   r   r   r,   ru   r   r|   r{   r=   r  r<  r>   r[   r   r   rW   )r   r   r5  r=   r   r  rb   rb   rc   translate_seo_text  s    &r=  c            .         s$  t jjddt jjddt jjddt jjdd tjjdd\} }tjj| dd	\}}tjj| dd	\}}tjj| d
d	\}}tjj | dd	\}}tjjdd\}}tjj|dd	\}}tjj|dd	\}}tjj|dd	\}}tjj |dd	\}}tjjdd\}}tjj|dd	\}}tjj|dd	\}}tjj|dd	\}}tjj |dd	\}}tjjdd\}}tjj|dd	\}}tjj|dd	\}}tjj|dd	\}}tjj |dd	\}}tjjdd\}	}tjj|	dd	\}}tjj|	dd	\}}tjj|	dd	\}}tjj |	dd	\}}tjjdd\}
}tjj|
dd	\}}tjj|
dd	\}}tjj|
dd	\}}tjj |
dd	\}}tjjtd d!j	d"d#}|
 d$krt d% }tj	td&d'td&d(B t|d)B  }|d d* D ]}|jj	d+ }|jj	d+ p|}|jj	d+ p|}|jj	 d+ p|}|jjj	d+ }|jjj	d+ p|}|jjj	d+ p|}|jjj	 d+ p|}|jj}zd,|j d-}tjj|| |d.\}}tjj|d/\}}||_d0|j d1|jj d2|_t |_|  tjj|d/\}}d3|j d4|_d3|j d5|jj d6|_t |_|  tjj|d/\}}d7|j d-|_d8|j d9|jj d2|_t |_|  tjj| d/\}}d:|j d;|_d<|j d=|jj d2|_t |_|  W n ty } z
t| W Y d }~nd }~ww zd>|j d-}tjj|| |d.\}}tjj|d/\}}||_d?|j d1|j d@|j d2|_t |_|  tjj|d/\}}dA|j dB|_dA|j d5|j dC|j d6|_t |_|  tjj|d/\}}dD|j d-|_dE|j dF|j d@|j d2|_t |_|  tjj| d/\}}dG|j d;|_dH|j d=|j dC|j d2|_t |_|  W n ty } z
t| W Y d }~nd }~ww zdI|j d-}tjj	|dJdK }|rEtjj|| |d.\}}tjj|d/\}}||_dL|j d1|j  d2|_t |_|  tjj|d/\}}dM|j dN|_dO|j d5|j  dP|_t |_|  tjj|d/\}}dQ|j d-|_dR|j dS|j  d2|_t |_|  tjj| d/\}}dT|j d;|_dU|j d=|j  d2|_t |_|  W n ty] } z
t| W Y d }~nd }~ww zdV|j dW}tjj	|dXdK }|rtjj|| |d.\}}tjj|d/\}}||_dY|j d1|j  d2|_t |_|  tjj|d/\}}|j dZ|_d[|j d5|j  d\|_t |_|  tjj|d/\}}d]|j d-|_d^|j dS|j  d2|_t |_|  tjj| d/\}}d_|j d;|_d`|j d=|j  d2|_t |_|  W n ty, } z
t| W Y d }~nd }~ww zda|j d-}fdbdc|j!" D }fdddc|j!" D }fdedc|j!" D } fdfdc|j!" D } d@#dgdc |D }d@#dhdc |D p||}d@#didc |D p|}d@#djdc | D p|} |r3tjj|| |d.\}}tjj|d/\}}||_|j d1| dk|_t |_|  tjj|d/\}}|j dl|_|j dm| d6|_t |_|  tjj|d/\}}dn|j d-|_|j do| d2|_t |_|  tjj| d/\}}dp|j d;|_|j dq|  d2|_t |_|  W n tyK } z
t| W Y d }~nd }~ww zdr|j d-}|j$}!|!rtjj|| |d.\}}tjj|d/\}}||_|j ds|!j d2|_t |_|  tjj|d/\}}dt|j du|_|j dv|!j dw|_t |_|  tjj|d/\}}dx|j d-|_|j dy|!j d2|_t |_|  tjj| d/\}}dz|j d;|_d{|j d||!j d2|_t |_|  W n ty } z
t| W Y d }~nd }~ww zd}|j d-}|j%j&}"|"rtjj|| |d.\}}tjj|d/\}}||_d~|j d1|" d2|_t |_|  tjj|d/\}}d|j du|_d|j d5|" d6|_t |_|  tjj|d/\}}d|j d-|_d|j dF|" d2|_t |_|  tjj| d/\}}d|j d;|_d|j d=|" d2|_t |_|  W n ty } z
t| W Y d }~nd }~ww zd|j d}|j'}#|#rtjj|| |d.\}}|j(r|j d}$|j d}%|j d}&|j d}'n'|j d|# d2}$d|j d|# d}%d|j d|# d2}&d|j d|# d2}'tjj|d/\}}||_|$|_t |_|  tjj|d/\}}d|j d|_|%|_t |_|  tjj|d/\}}d|j d-|_|&|_t |_|  tjj| d/\}}d|j d-|_|'|_t |_|  W n ty } z
t| W Y d }~nd }~ww zqd|j d-}|j)r|j d}$|j d}%|j d}&|j d}'n|j*" j+d$d,t-dd }(|(d u rd$}(|j*" j+d$d,t.dd })|)d u 	rd$})|(d$k	r|)}(|(d$k	r:|j d}$|j d}%|j d}&|j d}'nz|(|)k	rpd|j d1| |( d2}$d|j d5| |( d6}%d|j dS| |( d2}&d|j d| |( d2}'nDd|j d| |( d| |) d2	}$d|j d| |( d| |) d6	}%d|j d| |( d| |) d2	}&d|j d| |( d| |) d2	}'tjj|||d.\}}tjj|d/\}}||_|$|_t |_|  tjj|d/\}}d|j d|_|%|_t |_|  tjj|d/\}}d|j d-|_|&|_t |_|  tjj| d/\}}d|j d;|_|'|_t |_|  W n t
yJ } z
t| W Y d }~nd }~ww zd|j d-}tjj|||d.\}}tjj|d/\}}||_d|_t |_|  tjj|d/\}}d|j d|_d|_t |_|  tjj|d/\}}d|j d-|_d|_t |_|  tjj| d/\}}d|j d;|_d|_t |_|  W n t
y } z
t| W Y d }~nd }~ww zd|j d-}t/jj	g d|d}*d@#ddc |*d d D }+|+rtjj|||d.\}}tjj|d/\}}||_d|+ d2|_t |_|  tjj|d/\}}d|j d|_d|+ d|_t |_|  tjj|d/\}}d|j d-|_d|+ d2|_t |_|  tjj| d/\}}d|j d;|_d|+ d2|_t |_|  W n ty } z
t| W Y d }~nd }~ww zd|j d-}tjj|||d.\}}tjj|d/\}}||_d|_t |_|  tjj|d/\}}d|j d|_d|_t |_|  tjj|d/\}}d|j d-|_d|_t |_|  tjj| d/\}}d|j d;|_d|_t |_|  W n tyR } z
t| W Y d }~nd }~ww zd|j d|jj d-}t0|j1|jj1j2j3},tjj|||d.\}}tjj|d/\}}||_|j d|,dЛd|jj d2|_t |_|  tjj|d/\}}|j d|jj dӝ|_|j d|,dЛd|jj d֝|_t |_|  tjj|d/\}}d|j d|jj d-|_|j d|,dЛd|jj d2|_t |_|  tjj| d/\}}d|j d|jj d-|_d|j d|,dЛd|jj d2|_t |_|  W n tyC } z
t| W Y d }~nd }~ww zd|j d-}t/jj	g d|d}*d@#ddc |*d d" D }+|+rtjj|||d.\}}tjj|d/\}}||_d|+ d2|_t |_|  tjj|d/\}}d|j du|_d|+ d|_t |_|  tjj|d/\}}d|j d-|_d|+ d2|_t |_|  tjj| d/\}}d|j d;|_d|+ d2|_t |_|  W n ty } z
t| W Y d }~nd }~ww zd|j d-}t/jj	dg|d}*d@#ddc |*d d D }+|+rtjj|||d.\}}tjj|d/\}}||_d|+ d2|_t |_|  tjj|d/\}}d|j d|_d|+ d|_t |_|  tjj|d/\}}d|j d-|_d|+ d2|_t |_|  tjj| d/\}}d|j d;|_d|+ d2|_t |_|  W n ty } z
t| W Y d }~nd }~ww zd|j d-}t/jj	dg|d}*d@#ddc |*d d D }+|+rtjj||	|d.\}}tjj|d/\}}||_d|+ d2|_t |_|  tjj|d/\}}d|j d|_d|+ d|_t |_|  tjj|d/\}}d|j d-|_d|+ d2|_t |_|  tjj| d/\}}d |j d;|_d|+ d2|_t |_|  W n ty } z
t| W Y d }~nd }~ww zd|j d-}t/jj	g d|d}*d@#ddc |*d d D }+t/jj	dg|d}*d@#ddc |*d d D }-|+rtjj||	|d.\}}tjj|d/\}}||_d|+ d|- d2|_t |_|  tjj|d/\}}d	|j d|_d
|+ d|- d|_t |_|  tjj|d/\}}d|j d-|_d|+ d|- d2|_t |_|  tjj| d/\}}d|j d;|_d|+ d|- d2|_t |_|  W n ty } z
t| W Y d }~nd }~ww zd|j d-}t/jj	dg|d}*d@#ddc |*d d D }+|+rYtjj||	|d.\}}tjj|d/\}}||_d|+ d2|_t |_|  tjj|d/\}}d|j d|_d|+ d|_t |_|  tjj|d/\}}d|j d-|_d|+ d2|_t |_|  tjj| d/\}}d|j d;|_d|+ d2|_t |_|  W n tyq } z
t| W Y d }~nd }~ww zd|j d-}t/jj	ddg|d}*d@#ddc |*d d D }+|+r2tjj||	|d.\}}tjj|d/\}}||_d|+ d |_t |_|  tjj|d/\}}d!|j d|_d"|+ d#|_t |_|  tjj|d/\}}d$|j d-|_d%|+ d&|_t |_|  tjj| d/\}}d'|j d;|_d(|+ d)|_t |_|  W q tyL } zt| W Y d }~qd }~ww d S (*  Nr   r   rk   r"  r!  zProperty Detailsr.  u   اطلاعات ملک)rA   r  r~   u   Общая информацияu   تفاصيل الخاصيةPricesu   قیمتu   Ценыu   الأسعارzAmenities and Featuresu#   تسهیلات و ویژگی‌هاu*   Удобства и особенностиu(   وسائل الراحة والميزاتzLocation and Accessibilityu'   موقعیت مکانی و دسترسیu2   Расположение и доступностьu&   الموقع وسهولة الوصولzNearby Servicesu   خدمات اطرافu#   Близлежащие услугиu   الخدمات القريبةSustainabilityu   پایداریu   Экологичностьu   الاستدامةfaqsr      r   r   r  T)faqs__isnull)faqs__translates__isnull)"faqs__translates__created_time__ltd   r   zWho is the developer of r  )rv   r  question)faqrA   zThe developer of z is .u   توسعه‌دهنده u    کیست؟r   u    است.u1   Кто является застройщиком u   Застройщиком u    является u   من هو المطور لـ u   ؟u   المطور لـ u    هو zWhat is the address of zThe address of rh   u	   آدرس u    کجاست؟u   ، u   Какой адрес u   Адрес r-  u   ما هو عنوان u   عنوان zHow many flats are there in rQ  )rv   feature__slugzThe total number of flats in u   تعداد واحدهای u    چند عدد است؟u"   تعداد کل واحدها در u    عدد است.u!   Сколько квартир в u2   Общее количество квартир в u    составляет u-   كم عدد الشقق الموجودة في u$   إجمالي عدد للشقق في zHow many floors does z have?floorszThe total number of floors in u    چند طبقه دارد؟u    تعداد کل طبقات در u    طبقه است.u   Сколько этажей в u0   Общее количество этажей в u    كم عدد الطوابق في u(   إجمالي عدد للطوابق في zWhat type of property is c                       g | ]}|j j d  qS r   r{   ru   r|   rC  b)rk   rb   rc   rE        z*create_development_faq.<locals>.<listcomp>c                    rK  rL  rM  rN  )r   rb   rc   rE    rP  c                    rK  rL  rM  rN  )r"  rb   rc   rE    rP  c                    rK  rL  rM  rN  )r!  rb   rc   rE    rP  c                 S   r  rb   r   rN  rb   rb   rc   rE    r  c                 S   r  rb   r   rN  rb   rb   rc   rE    r  c                 S   r  rb   r   rN  rb   rb   rc   rE    r  c                 S   r  rb   r   rN  rb   rb   rc   rE    r  z
 property.u    چه نوع ملکی است؟u    یک پروژه u+   Какой тип недвижимости u
    - это u   ما نوع العقار u     هو عقار من نوع zWhat is the zone number of z is located in u   شماره منطقه u    چیست؟u    در منطقه u    واقع شده است.u"   Какой номер зоны у u"    расположен в зоне u%   ما هو رقم المنطقة لـ u   يقع u    في المنطقة zWhat is the postcode of zThe postcode of u   کدپستی u)   Какой почтовый индекс u   Почтовый индекс u)   ما هو الرمز البريدي لـ u   الرمز البريدي لـ z
When will z be completed?z# is completed and ready to move in.uA    تکمیل شده و آماده جهت سرویس دهی است.u6    завершен и готов к заселению.u&    مكتمل ومستعد للخدمة.z  is expected to be completed by u    پیش‌بینی می‌شود u    تا u    تکمیل شود.u   Ожидается, что u     будет завершен к u6   من المتوقع أن يتم الانتهاء من u    بحلول u   زمان تکمیل u    کی خواهد بود؟u'   Когда будет завершен u&   متى سيتم الانتهاء من z$What is the price range of flats in z is sold out.u    تمام شده است.u    продан.u
    مباع.)r=  r=  base_price__minbase_price__maxzThe price range for flats in u3   محدوده قیمت آپارتمان‌ها در u1   Диапазон цен на квартиры в u7   يتراوح النطاق السعري للشقق في u    هي z	 is from z to u    از u    составляет от u    до u    هي من u    إلى u    چقدر است؟u<   Каков диапазон цен на квартиры в u0   ما هو نطاق السعري الشقق في z8Are financing options available for purchasing flats at z?Yes, financing options are available through our partner banks.uW   آیا گزینه‌های تأمین مالی برای خرید آپارتمان در u    موجود است؟ux   بله، گزینه‌های تأمین مالی از طریق بانک‌های همکار ما در دسترس است.ul   Доступны ли варианты финансирования для покупки квартир в uu   Да, варианты финансирования доступны через наши банки-партнеры.uC   هل خيارات التمويل متاحة لشراء شقق في ue   نعم، تتوفر خيارات التمويل من خلال البنوك الشريكة لدينا.z.What facilities are available to residents of )         rg   )type_id__indevelopments__developmentc                 S       g | ]}|j  d |jj  qS r   r>   rV  rC  pfrb   rb   rc   rE         r   zResidents can enjoy u,   چه امکاناتی برای ساکنان u    در دسترس است؟u&   ساکنان می‌توانند از u    استفاده کنند.u<   Какие удобства доступны жильцам u1   Жильцы могут пользоваться u3   ما هي المرافق المتاحة لسكان u2   يمكن للمقيمين الاستمتاع بـ z Are parking spaces available at z"Yes, parking spaces are available.u   آیا جای پارک در u0   بله، جای پارک در دسترس است.u;   Доступны ли парковочные места в u(   Да, парковочные места.u:   هل تتوفر أماكن وقوف السيارات في u9   نعم، تتوفر أماكن وقوف السيارات.zHow far is z from central z is approximately z,.2fz kilometers from central u    تا مرکز u"    چه فاصله‌ای دارد؟u    تقریباً u    کیلومتر از مرکز u    فاصله دارد.u   Как далеко u    от центра u*    расположен примерно в u(    километрах от центра u    ما هي المسافة بين u    و وسط u	   يبعد u    حوالي u    كيلومتر عن وسط z6What public transportation options are available near )r   r      rA        c                 S   rX  rY  rZ  r[  rb   rb   rc   rE    r]  zNearby transportation includes u@   گزینه‌های حمل و نقل عمومی نزدیک به u%   حمل و نقل نزدیک شامل u    می‌شود.uk   Какие варианты общественного транспорта доступны рядом с u;   Близлежащий транспорт включает uX   ما هي خيارات المواصلات العامة المتاحة بالقرب من u+   تشمل المواصلات القريبة z)Are there any parks or green spaces near rS  c                 S      g | ]}|j  qS rb   r   r[  rb   rb   rc   rE        zYes, nearby parks include u@   آیا پارک‌ها یا فضاهای سبز نزدیک به u    وجود دارد؟u/   بله، پارک‌های نزدیک شامل u    می‌شوند.uF   Есть ли парки или зеленые зоны рядом с u9   Да, близлежащие парки включают uH   هل هناك حدائق أو مساحات خضراء بالقرب من u0   نعم، تشمل الحدائق القريبة zWhich schools are located near r   c                 S   ra  rb   r   r[  rb   rb   rc   rE    rb  zSchools nearby include u   مدارس نزدیک به u    کدامند؟u   مدارس نزدیک شامل u;   Какие школы расположены рядом с u3   Близлежащие школы включают u<   ما هي المدارس الموجودة بالقرب من u'   تشمل المدارس القريبة z+Are there shopping and dining options near )         c                 S   ra  rb   r   r[  rb   rb   rc   rE    rb     c                 S   ra  rb   r   r[  rb   rb   rc   rE    rb  zYes, nearby options include z and restaurants like uH   آیا گزینه‌های خرید و رستوران در نزدیکی u/   بله، گزینه‌های خرید شامل u)    و رستوران‌هایی مانند uC   Есть ли магазины и рестораны рядом с u?   Да, близлежащие варианты включают u"    и рестораны вроде uI   هل توجد خيارات للتسوق والطعام بالقرب من u2   نعم، تشمل الخيارات القريبة u    ومطاعم مثل z(What healthcare facilities are close to r   c                 S   ra  rb   r   r[  rb   rb   rc   rE  )  rb  z%Nearby healthcare facilities include u.   تسهیلات بهداشتی نزدیک به u4   تشمل المرافق الصحية القريبة uZ   Какие медицинские учреждения находятся близко к uT   Близлежащие медицинские учреждения включают u:   ما هي المرافق الصحية القريبة من z4Are there any cultural or entertainment venues near rg      c                 S   rX  )r  rZ  r[  rb   rb   rc   rE  D  r]  zYes, venues such as z are located nearby.uH   آیا مکان‌های فرهنگی یا تفریحی نزدیک به u(   بله، مکان‌هایی مانند u,    در نزدیکی واقع شده‌اند.uj   Есть ли культурные или развлекательные заведения рядом с u+   Да, такие заведения как u-    расположены поблизости.uL   هل هناك مواقع ثقافية أو ترفيهية بالقرب من u$   نعم، توجد مواقع مثل u&    في المنطقة المجاورة.)4r*   rt   r   r   r   r   r	   r   r,   ru   r   r   r+   r   r{   r|   r  r_  r   r~   r   r   rF  rS  r>   answercreated_timer   rZ   r[   r?   r   valuer   ry   rw   r  r   zip_coderO  rP  r:  rQ  r   	aggregater.   r-   r(   r5   r   centroid
kilometers).cat1r   cat_facat_encat_rucat_arcat2cat3cat4cat5cat6r   rg  rv   development_endevelopment_fadevelopment_rudevelopment_arcity_encity_facity_rucity_arr_  rF  rG  faq_tra   rQ  rJ  property_type_enproperty_type_faproperty_type_ruproperty_type_arr  r  rO  	answer_en	answer_fa	answer_ru	answer_ar	min_price	max_pricepublic_facilities
facilitiesdistancerestaurantsrb   )r!  rk   r   r"  rc   create_development_faq"  s  *



$  
 
 
 
$ 



$ 



$ 



$ 



$ 



$ 



$   

""""



$ 



$ 1



$ 



$ a 
 
 
"
$ 



$ 



$ 



$ 



$ 



$ 



&       r  c              	   C   s  d|j  }d| }|rd|j  }| d| }| d}|d u r'|   |dddd}|dr|d}t|d	krG|   d S d}d
d dd dd dd dd dd dd dd d}	dd tddD }
td	t|D ]6}|| }|	 D ]\}}||r| d|| } nq|
 D ]\}}||r| d| } nqqu|dkr| | }|| d< d S |   d S |   d S )Nzcountry-/zcity-hrefzhttps://1newhomes.comrq   zhttps://1newhomes.aez/new-homes/r   c                 S      | S Nrb   r   rb   rb   rc   r        zchange_url.<locals>.<lambda>c                 S   r  r  rb   r  rb   rb   rc   r    r  c                 S   r  r  rb   r  rb   rb   rc   r    r  c                 S      |  ddS )Noptions-zkey_feature-r   r  rb   rb   rc   r    r  c                 S      dS Nzcompletion-ready-to-moverb   r  rb   rb   rc   r    r  c                 S   r  r  rb   r  rb   rb   rc   r    r  c                 S   r  )Nyear-zcompletion-r  r  rb   rb   rc   r    r  c                 S   r  )Nz	bedroom-0rb   r  rb   rb   rc   r    r  )z	district-zzone-zstation-r  zyear-finishedzready-to-mover  zproperty-studioc                 S   s    i | ]}d | dd| qS )rJ  z-bedroomzbedroom-rb   )rC  irb   rb   rc   
<dictcomp>  r]  zchange_url.<locals>.<dictcomp>r   rg   )	r   r   	decomposer   
startswithsplitlenr
  r   )a_tagr{  r  country_slugour_url	city_slugr  url_sectionsadd_urlurl_mappingr  r  sectionprefix	transformsuffixrb   rb   rc   
change_url  sT   






r  c                  C   s0  t jjdddd d } | D ]}zR|j}|j}|d ur0|jdks'|jdkr0d|_|  W q|jdkrC|jdkrCd|_|  W qd	}|jdkrMd
}nd}d}d	}|j}|j	}|dkr{|j
dkred}n'|j
dv rrd|j
 d}nd|_|  W q|d ur|d	krd|_|  W q|jrt|jdd}	|dkrd|	 d| }nX|dkrd|	 d| }nK|dkrd|	 d| }n>|dkr|	dkrd|	 d| }n-d|	 d| }n$|dkrd|	 d| }n|d u s|d	krd| }n	d|_|  W q|| }
tj|
dd}|jdkrY|j}t|d}|d d!d"i}|d#D ]}|  q!|d d!d$iD ]}|  q1|d%D ]	}t||| q>t||_t|j d&| d' n
d|_d(|j |_W n) ty } zd|_td)tj d* d+|j d,| W Y d }~nd }~ww d|_|  qd S )-NF)check_for_textget_text_errorr  londondubaiTunited-kingdomunited-arab-emiratesrq   zhttps://1newhomes.com/new-homeszhttps://1newhomes.ae/new-homesr  r  0zproperty-studio/)
12345678910rJ  z	-bedroom/r  r  z	/station-r  r  r;  zaround-londonz-london-area/r  rg   r   r  r  divclass
sf_contentr  zsentence-v3-catalogr  z: >>>>>>>>>>>>>>>>>>>>
z
<<<<<<<<<<<<<<<<<<<<<zstatus code: rP   rQ   z! get filter page text (filter id:z)error:)r   rt   ru   r{  r  r   r  r   r  r  r  r  r2   r   r   r  r=   r1   r  find_allr  r  strr[   r   r  get_text_error_messagerZ   r\   r]   r^   )fsr'  r{  r  r   r  s_slugr  r  r   r  r  r  r  r  r  ra   rb   rb   rc   get_filter_page_text  s   





2
r  a  
Paraphrase the following text, which describes a list of apartments or building projects on a real estate consulting website, into {language} language. Make sure to:
1. Use SEO-friendly language to help improve search engine rankings.
2. Avoid phrasing that closely resembles AI-generated text.
3. Maintain the professional tone of a real estate agent.
4. Retain the structure of any HTML tags present in the text.
5. Remove any empty HTML tags from the text.

Original Description: `{text}`
c              
   C   s   z*t td}|j| |d}|jjj|dddd|dgdd}d	|jd
 jjd dW S  t	yR } zt
dtj d d| dd | dW  Y d }~S d }~ww )Nr;   r   rB     You are an expert real estate consultant and content optimization specialist. Your task is to refine and enhance user prompts to create engaging, SEO-friendly, and persuasive text for real estate listings. Ensure the tone matches the target audience (families, first-time buyers, investors) and the structure remains clear and sales-oriented. Provide actionable suggestions to help achieve the user's goals effectively.rD   rG   rH   rI   Fr   rM   rP   rQ   z : error : TrS   )r=   rA   r_   rJ   r`   rU   ra   rb   rb   rc   paraphrase_text6	  s(   r  ao  
Translate the following text into {language}, ensuring:
1. The tone and meaning of the original content are preserved.
2. SEO-friendly keywords are adapted appropriately for the target language.
3. The translated text aligns with cultural and linguistic nuances of the target audience.
4. The structure of any HTML tags present is retained.

Original Text: `{text}`
c              
   C   s   z4t td}|jjj|dddd|j| |ddgdd}|jd	 jj}|	d
d	dd}d|d dW S  t
y\ } ztdtj d d| dd | dW  Y d }~S d }~ww )Nr;   rB   r  rD   rG   r   rH   rI   r   r  rq   rr   FrM   rP   rQ   r;  T)r3   r6   rU   rV   rW   rT   rX   rY   rF   r   rZ   r[   r\   r]   r^   )r=   rA   r_   rJ   r`   rU   r  ra   rb   rb   rc   translate_textV	  s*   r  c               
   C   s$  t jjddddd } | d u rd S tjjdd}tjjdd}tjj| |d}zG| j	}t
||jd}|d r:W d S |d	 }||_	|  |D ]}tjj| |d}t||j}	|	d r\qG|	d	 |_	|  qGd| _|   W d S  ty }
 ztd
tj d d|
 W Y d }
~
d S d }
~
ww )NTF)r  r  text__isnullre   rk   r   filter_seo_textrA   r   rN   rF   rP   rQ   z* : in paraphrase_filter_page_text error : )r   rt   ru   r|   r*   r   r   r   r   r=   r  r>   r   r  re   rZ   r[   r\   r]   r^   )r  r   r   fs_enr=   p_texten_textrA   fs_translatetranslate_text_resultra   rb   rb   rc   paraphrase_filter_page_textp	  s6   

,r  c            	   
   C   s  t jjdd} t jjdd}tjjtddjdddd|  d d	 }z
t
jj||d	}W n   d|_|  Y d S z.|j}| D ]}t
jj||d	}t||j}|d
 rXqC|d |_|  qCd|_|  W d S  ty } ztdtj d d| W Y d }~d S d }~ww )Nrk   r   r{   r   TFr   )r  r  r  re   r   r  rN   rF   rP   rQ   z) : in translate_filter_page_text error : )r*   rt   r   r   r   r   r,   ru   r   r|   r   re   r   r=   r   r  r>   rZ   r[   r\   r]   r^   )	r   r   r  r  r=   rA   r  r  ra   rb   rb   rc   translate_filter_page_text	  s0   .

,r  c                  C   s  t j } | D ]s}|j}|j}|d u r2|jjdkr"tjjdd}n|jjdkr0tjjdd}nd}|j	jdd}|j
 }d}|D ]%}|j	jdd}|d	|j d
|j d|j d|j |jradnd d
7 }qBtjj|d\}	}
dg d|j d|j d|j d|j d|j d|jj d|jj dddd |j D  dddd |j D  dddd |j D  dddd |j D  d dd!d |j D  d"|j d#|j d$|jj d|jj d%|j d&|j d'| d(|j  d)|j!j d*dd+d |j D  d,|j" |j#rDd-nd |jrMd.nd d/dd0d |j$ D  d1|j% d2|j& d3|j }||	_&|	'  qd S )4Nr  r   r   r  r   rq   rk   rl   z
            z: [floor_area:z m2, price:r   z, [is sold out]z]
            )rv   zreference ID: ETL-z
        title: z
        developer: z
        base price: z
        country: z
        city: z
        area: rh   c                 S   r  rb   r   )rC  r  rb   rb   rc   rE  	  r  z+set_development_details.<locals>.<listcomp>z
        postcode: c                 S   r  rb   r   )rC  r   rb   rb   rc   rE  	  r  z
        district: c                 S   r  rb   r   r  rb   rb   rc   rE  	  r  z
        zone: c                 S   r  rb   r   )rC  zrb   rb   rc   rE  	  r  z
        station: c                 S   r  rb   r   rC  srb   rb   rc   rE  	  r  z
        Address: z ( z ) [z]
        Floor Area: z m2
        Number of Flats: z
        Flats: z
        Number of Floors: z
        Building Type: z
        Nearest Station: c                 S   r  rb   r   r  rb   rb   rc   rE  	  r  z
        Completion Year: z [is ready to move]z [is sold out]z
        Features: c                 S   s   g | ]}|j jqS rb   )r   r>   r&  rb   rb   rc   rE  	  rb  z
        Features Description: z
        Description: z/
        url: https://entralon.com/en/property-)(r	   rt   ry   rS  r_  r{  r   r   r   r{   rQ  r>   r;  r=  rI  r:  r
   r   rw   r   r~   r  r  r  r  r  rx   r?   r   r   r   rj   rM  r   rO  rP  key_featuresr   r}   r   )r   rv   rS  r   r   rQ  
flats_textrj   flat_tdevelopment_detailr   r=   rb   rb   rc   set_development_details	  s   


	

r  c                  C   s   t j } g }| D ]+}|j}||j|jdkr|jnd |jj|j	jd|j |j
d|j |jd q	tj d}tj|sFt| t|d d}t|| W d    d S 1 s_w   Y  d S )	Nr   zsold outzETL-z!https://entralon.com/en/property-)r   r  r  r{  reference_idr>   r  r}   z/media/development_detail/zdevelopment_detail.jsonw)r
   rt   ry   rv   r   r   r=  r  r>   r{  r~   r   r}   r   r  r  r  r  makedirsr  r   dump)re  outr  rv   file_dirr'  rb   rb   rc   create_development_detail_json	  s(   





"r  )r9   r  r:   NNN)r:   r  )r\   rp   r  r   r  r  r  r   django.confr   r   data_scraper.utilsr   development.modelsr   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   development.utilsr%   geo_location.modelsr&   r'   r(   r)   main.modelsr*   django.db.modelsr+   r,   r-   r.   r   django.core.files.imagesr/   PILr0   urllib.requestr  bs4r1   django.utils.textr2   openair3   environ
main.utilsr4   Envenvread_envgeopy.distancer5   r  r6   r7   r8   PARAPHRASE_PROMPTrd   r   SUMMARY_PROMPTr   r   r   r   r   r   r   r   r   r   r   r  
apartmentsr3  rf  rh  r  r  r  r  r  r  r  r  r  r  r  r
  r  r:  r<  r=  r  r  r  r  TRANSLATE_PROMPTr  r  r  r  r  rb   rb   rb   rc   <module>   s6   



 <=X=@44454
AT
=       

/W
3