Hacker News new | ask | show | jobs
by pseudo_meta 582 days ago
> Show all images on the page in a grid with size and megapixel tags. Useful for manual scraping. Would you mind sharing that one?
1 comments

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.

  ; 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