Skip to content

Instantly share code, notes, and snippets.

@mica
Last active June 26, 2024 22:04
Show Gist options
  • Save mica/5c9427fab98da699f1fe70fd2730212e to your computer and use it in GitHub Desktop.
Save mica/5c9427fab98da699f1fe70fd2730212e to your computer and use it in GitHub Desktop.
//bookmarklet_title: FB Marketplace Profile
//bookmarklet_about: From a user's main FB page, click this bookmarklet for their Marketplace profile
if (location.host == 'www.facebook.com') {
if (location.pathname == '/profile.php') {
location.href = 'https://www.facebook.com/marketplace/profile/' + new URLSearchParams(location.search).get('id');
} else if (location.pathname == '/friends/suggestions/') {
location.href = 'https://www.facebook.com/marketplace/profile/' + new URLSearchParams(location.search).get('profile_id');
} else {
let xhr = new XMLHttpRequest();
xhr.open("GET", location.origin + location.pathname);
xhr.send();
xhr.onload = () => {
if (xhr.response.includes('userID":"')) {
location.href = 'https://www.facebook.com/marketplace/profile/' + xhr.response.match(/(?<=userID":")\d*/g)[0];
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment