Last active
March 21, 2018 19:37
-
-
Save trahloff/30497aa52525ad4d34277ee4eca5910e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require('axios') | |
const url = 'https://www.immobilienscout24.de/expose/98935021?referrer=RESULT_LIST_LISTING&navigationServiceUrl=%2FSuche%2Fcontroller%2FexposeNavigation%2Fnavigate.go%3FsearchUrl%3D%2FSuche%2FS-T%2FHaus-Kauf%2FHamburg%2FHamburg%2FWinterhude%26exposeId%3D98935021&navigationHasNext=true&navigationBarType=RESULT_LIST&searchId=728d7848-a86b-3931-a46d-1654428323ad#/' | |
/*====================================================*/ | |
const parseContactName = html => { | |
const result = JSON.parse( | |
html.substring( | |
html.search('contactData:') + 13, | |
html.search('contactButton') - 2 | |
) + '}' | |
) | |
console.log(result) | |
} | |
/*====================================================*/ | |
axios.get(url) | |
.then(response => parseContactName(response.data)) | |
.catch(error => console.error(error)) | |
/*==================== Result: ========================*/ | |
{ | |
"phoneNumbers": { | |
"phoneNumber": { | |
"contactNumber": "040 473329" | |
}, | |
"cellPhoneNumber": { | |
"contactNumber": "0172 4073329" | |
}, | |
"faxNumber": { | |
"contactNumber": "040 46779864" | |
} | |
}, | |
"contactPerson": { | |
"salutationAndTitle": "Frau", | |
"firstName": "Inga", | |
"lastName": "Krüll" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment