Last active
November 26, 2022 11:37
-
-
Save Mamdouh-Freelancer/e26c3b480e2ac9598d25385026bdb042 to your computer and use it in GitHub Desktop.
Useful tool to access seller profile of expired ad. a Javascript code can be injected to the expired ad page via browser's console tab.
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
/* | |
This tool is useful to reach the seller if the ad is expired. Tested & works with Olx Egypt "olx.com.eg" | |
*/ | |
adid = document.URL.split("-ID")[1].split(".")[0]; | |
contact_info = "https://www.olx.com.eg/api/listing/" + adid + "/contactInfo/"; | |
ad_details = "https://www.olx.com.eg/api/listing/?external_id=" + adid; | |
callAPI(contact_info, function(d) { | |
j = JSON.parse(d); | |
//output seller name & registered mobile number if exists | |
console.log("name:", j.name, "\nmobile:", j.mobile); | |
}); | |
callAPI(ad_details, function(d) { | |
j = JSON.parse(d); | |
//output seller profile page which may contains another ads | |
console.log("seller_profile:", "https://www.olx.com.eg/profile/" + j.userExternalID); | |
}); | |
function callAPI(url, callback) { | |
console.log(url); | |
var xhttp = new XMLHttpRequest(); | |
xhttp.onreadystatechange = function() { | |
if (this.readyState == 4 && this.status == 200) { | |
callback(xhttp.responseText); | |
} | |
}; | |
xhttp.open("GET", url, true); | |
xhttp.send(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment