Jump to content

Fakespot Script

Recommended Posts

I'm trying to make a script that opens the amazon url I'm currently on (in safari or chrome) and open it in Fakespot. 


I got as far as 


on alfred_script(q)
tell application "Safari" to return URL of front document
end alfred_script


And then added a {query} but here's where I get stuck because Fakespot turns the URL into a different one and I don't know how. 


When I go to Fakespot and paste in 




The address it sends me to is 




And that detail isn't in the amazon URL so I don't know how to find it. 


Any ideas on how I might achieve this short of doing a copy and paste into the fakespot field? 



Link to comment

What you’re looking for is https://www.fakespot.com/analyze?url=, and then your URL. So in your example, it would be https://www.fakespot.com/analyze?url=https://www.amazon.co.uk/Braun-Replacement-Foil-Cutter-Cassette/dp/B001EVNMTK/ref=sr_1_2_a_it?ie=UTF8&qid=1552643933&sr=8-2&keywords=braun++7-760cc+razor+foils.


Here is a Workflow for it. It works with Google Chrome, Google Chrome Canary, Chromium, Opera, Vivaldi, Brave, Safari, Safari Technology Preview, and Webkit.

Edited by vitor
Link to comment
  • vitor changed the title to Fakespot Script
21 minutes ago, bongobong said:

Wow. Did you just make that workflow?


Yes, took me only a few minutes. The only complex part is the browser support, for which I leaned on work I did previously, which cumulatively has taken me many hours. But since it was already done, and was built to be easy to reuse, making it work for your needs took no effort at all.


26 minutes ago, bongobong said:

I wish I knew AppleScript and python.


No Python here, just AppleScript (JavaScript for Automation, to be precise). I mostly use Ruby and Bash, not Python (that’s more @deanishe’s domain). If you’re interested in scripting, I’d suggest you start with Bash, because you can start doing useful (and dangerous) things fast and learn progressively. This is one of the few things Dean and I disagree on (and why I pinged him), in that he’d suggest learning Python or Ruby to start with. We had a short friendly public discussion on it which you can read and make up your mind.


But he’ll back me up when I say “forget about AppleScript”. It’s an awful language with bad documentation, and we only use it when it’s absolutely necessary.

Link to comment
  • 1 year later...

If you'd prefer to open the Fakespot listing in whichever browser you're already using for Amazon, you can use this Javascript as a bookmark.  (This doesn't use Alfred at all.)


javascript:void function(){var country_site="amazon.com",b=0<=location.href.search(/(amazon.|amzn.)(com|co\.uk|ca|de|fr|es|it|cn|co\.jp).+/i),d=/amazon.(com|co\.uk|ca|de|fr|es|it|cn|co\.jp).*\/(asin|dp|gp|product|exec\/obidos|gp\/offer-listing|product\-reviews|gp\/aw\/d)\/[A-Z0-9]{10,13}/i,c=0<=location.href.search(d);if(c)try{var a=document.getElementById("ASIN").value;window.open("https://www.fakespot.com/analyze?url=https://"+country_site+"/dp/"+a)}catch(a){window.open(" https://www.fakespot.com/analyze?url=https://"+country_site+window.location.pathname)}}();


Just make a new bookmark and paste this in as the URL.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...