So I have my phone system shoot me a webhook every time a text is recieved. When there is a zillow link in that text I want to extract the zpid and then call the api I use from RapidAPI to send me back property details. Then I take those details and create an custom module entry in zoho crm for each property.
I am totally new to most of this, but I seem to be catching on quick.
I got the webhook, got my filter to decide if there is a zillow link, i then got the zillow url. I am having trouble extracting just the zpid from the url though. I have tried multiple ways and read every forum post, I just can’t seem to get it
the url will always look like this
https://www.zillow.com/homedetails/540-Ohio-St-Lexington-KY-40508/77532621_zpid/but sometimes it will have a variable on the end like this
https://www.zillow.com/homedetails/95-Orphia-Lewis-Rd-Hinkle-KY-40953/2062411787_zpid/?mmlb=g,8
regardless, I just need the “2062411787_zpid” part from every url
This is probably the closest I got using code
def extract_zpid_from_url(urls):
# Extract the ZPID from the Zillow URL
parts = urls.split('/')
zpid_part = parts[-2] # Get the second-to-last part of the URL
zpid = zpid_part.split('_')[0] # Extract the ZPID from the part before the underscore
return zpid
output = extract_zpid_from_url(urls)
Like I said, I am new to all this, copy paste is my best friend at this point
Running version [email protected] cloud