I have it in my todos to make some for their other offerings, like the new translations service they just released.
This one is very niche, but I was getting 100% in Tears of the Kingdom and the map didn’t tell me how many Koroks (or whatever else) I had left. So I threw this one together to tell me. It just counts the elements of a certain type and displays an alert with the number.
Sure. Note that it does some hqdefault vs maxresdefault loading logic for yt, which you can rip away if not needed and make it a little smaller. Also splits images into two sections, 1st all >= HD-sized pics, 2nd the rest. It still doesn't analyze css bg urls, I'm too lazy for walking the stylesheets. Click again to hide it. Images must be initially on-screen, so scroll the site down if it lazy loads them.
Bonus for fellow scraper: AHK script for saving images. Hover over an image in the grid and press alt-shift-s. It will rclick, type i, s, enter etc. I bound it to my mouse side button to save images under cursor without going through menus.
; Alt-Shift-s (&image -> &save image)
!+s::
Click, right
Sleep, 350
Send, i
Sleep, 100
Send, s
WinWaitActive, Save As,, 5
if ErrorLevel
{
SoundBeep, 150, 300
return
}
Sleep, 100
Send, {Enter}
return
1. u don't have to use `window.`, window is the default object (maybe less readable, but folks don't use window.fetch either)
2. using an IIFE is sometimes useful and necessary, but this is a simple bookmarklet
3. as i wrote in the other comment, u don't need to encode it, and if u did, you could use encodeURIComponent to do it for you. ie, show the plain code here and let someone encode it if necessary (but i've never encoded mine)
Bypass the clutter from any web article
This service takes any web article or news page and returns only the relevant content, freeing you from any clutter, including ads, popups and more.
which also sidesteps some (not all) paywall blocking markups.
javascript: var index,offerButtons=Array.from(document.getElementsByClassName("offer-cta")).filter(a=>"Add to Card"==a.title);for(index=0;index<offerButtons.length;++index)console.log("Clicking offer button"),offerButtons[index].click(),(async()=>{await new Promise(a=>setTimeout(a,2e3))})();
javascript:(async()=>{var e,l,a=Array.from(document.getElementsByClassName("x193iq5w")).filter(e=>"Sold"==e.innerHTML);for(let i=0;i<a.length;++i)console.log("Clicking Sold Listing"),a[i].click(),await new Promise(e=>setTimeout(e,3e3)),document.querySelector('[aria-label="Save"]').click(),await new Promise(e=>setTimeout(e,1e3)),document.querySelector('[aria-label="Close"]').click(),await new Promise(e=>setTimeout(e,2e3));location.reload()})();
I should really convert these to Tampermonkey scripts
i think this works for the Amex one. where do you run/test this?
javascript:for (let b of document.querySelectorAll('.offer-cta[title="Add to Card"]')) {
console.log("Clicking offer button");
b.click();
(async () => {await new Promise(r => setTimeout(r, 2e3))})();
}
does the setTimeout work? wouldn't you need something like this (in an async function)
for (let b of document.querySelectorAll('.offer-cta[title="Add to Card"]')) {
console.log('Clicking offer button');
b.click();
await new Promise(r => setTimeout(r, 2e3));
}
I made a basic one for Kagi’s summarizer service.
javascript:(function()%7Bwindow.location.href%20%3D%20%60https%3A%2F%2Fkagi.com%2Fsummarizer%2Findex.html%3Ftarget_language%3D%26summary%3Dtakeaway%26url%3D%24%7BencodeURIComponent(window.location.href)%7D%60%7D)()
I have it in my todos to make some for their other offerings, like the new translations service they just released.
This one is very niche, but I was getting 100% in Tears of the Kingdom and the map didn’t tell me how many Koroks (or whatever else) I had left. So I threw this one together to tell me. It just counts the elements of a certain type and displays an alert with the number.
javascript:(function()%7Bfunction%20countTitles(title)%20%7Bconst%20elementsWithTitle%20%3D%20document.querySelectorAll(%60%5Btitle%3D%22%24%7Btitle%7D%22%5D%60)%3Bconst%20count%20%3D%20elementsWithTitle.length%3Breturn%20count%3B%7Dalert(countTitles(%22Korok%20Seed%22)%20%2B%20(countTitles(%22Korok%20Seed%20x2%22)*2))%7D)()
Show all images on the page in a grid with size and megapixel tags. Useful for manual scraping.
Dereferer current tab in a new tab. Some sites refuse to be referred from search/etc but copy-pasting an url into a new tab works.
Various “save” bms. Picks up a resource and opens it in new tab for a specific site that disallows right-click or hides an image in css bg, etc.
“Video”. Turns yt short into normal video (short id is regular video id).
It’s a shame that bookmarklets can’t refer to a file and require this %%% inlining. Probably solvable with tampermonkey, but not worth the research.
> Show all images on the page in a grid with size and megapixel tags. Useful for manual scraping. Would you mind sharing that one?
Sure. Note that it does some hqdefault vs maxresdefault loading logic for yt, which you can rip away if not needed and make it a little smaller. Also splits images into two sections, 1st all >= HD-sized pics, 2nd the rest. It still doesn't analyze css bg urls, I'm too lazy for walking the stylesheets. Click again to hide it. Images must be initially on-screen, so scroll the site down if it lazy loads them.
https://pastebin.com/VMr8L6qK
It uses semicolons, so is pasteable as-is in a bookmark's address field.
License is full surrender anonymous public domain, in case that matters.
Bonus for fellow scraper: AHK script for saving images. Hover over an image in the grid and press alt-shift-s. It will rclick, type i, s, enter etc. I bound it to my mouse side button to save images under cursor without going through menus.
> refer to a file
What do you mean?
> require %%% inlining
They don't, and even if they did, you could encode it yourself
What do you mean?
A bookmarklet to take its code from a local file. Would be useful for debugging, ctrl-s and click again.
You can use the Snippet editor in Chrome which is an IDE with a debugger. Then Save As. If u prefix them with `javascript:`, you can drag/drop or copy/paste to the bookmark bar. https://developer.chrome.com/docs/devtools/javascript/snippe... and https://developer.chrome.com/docs/devtools/javascript/refere...
Firefox also has a nice console.
Nice, thank you very much!
This seems to work as well:
Notes:1. u don't have to use `window.`, window is the default object (maybe less readable, but folks don't use window.fetch either)
2. using an IIFE is sometimes useful and necessary, but this is a simple bookmarklet
3. as i wrote in the other comment, u don't need to encode it, and if u did, you could use encodeURIComponent to do it for you. ie, show the plain code here and let someone encode it if necessary (but i've never encoded mine)
I've posted several bookmarklets here: https://hn.algolia.com/?dateRange=all&page=0&prefix=true&que...
For archiving a page:
Should probably encode the href but it has worked so farHmm, just tested this variation:
and it works to invoke ClearThisPage: https://clearthis.page/ which also sidesteps some (not all) paywall blocking markups.Add all Amex offers:
Force paste (works sometimes) Facebook Marketplace delete all sold I should really convert these to Tampermonkey scriptsi think this works for the Amex one. where do you run/test this?
does the setTimeout work? wouldn't you need something like this (in an async function)I run it on the offers page https://global.americanexpress.com/offers/eligible
The wrapped async function is for Firefox I understand.
I have used variations of password revel bookmarklets. I keep searching for new one when I need them again. Most recent find was.
https://gist.github.com/robbiet480/4711696
this seems to work:
or if there's only 1 password on the page