Modified Booru Downloader + Viewer (Fixed for rule34.xxx as of February 2022)

The original fullsize images downloader, and viewer for more than 20 booru imageboards

Tekijä
tincan
Päivittäiset asennukset
2
Asennuskerrat
4 532
Arvostelut
6 3 2
Versio
1.1.0.modified
Luotu
4.2.2022
Päivitetty
4.2.2022
Lisenssi
MIT
Käytössä

Modified Booru Downloader + Viewer (Fixed for rule34.xxx as of February 2022)

Regarding this repost/fork of the original script by Se7en

I'm posting this because recently the script finally stopped working due to some sort of error that says "DOMException: The play() request was interrupted." I have no coding experience so I won't be maintaining this script. Feel free to take over as Se7en no longer maintains this script either and I don't have the expertise to. I fixed the issue(line 2873) by copying the code from a fix detailed in this article. It was a very sloppy copy and paste and honestly I have no idea what it does so there's probably a better fix out there. I also changed the viewer to stretch all images to fit to screen and I have no idea how to change it back. It's on line 3956 if anyone wants to try and fix it.

Here's a pastebin of this description if you want to add onto and repost this.

Short description

This script allows you to download/view images on the various imageboard sites. When download mode is enabled, make a simple click on the image thumbnail to start donwloading the image. Use Left/Right1 hotkeys to navigate, when viewing images.
1 use Ctrl+Left/Right on donmai.us imageboards, because the Left/Right hotkeys are attached to paginator

List of originally supported imageboards:
gelbooru.com, rule34.xxx, yande.re, donmai.us (danbooru.donmai.us, sonohara.donmai.us, etc.), sankakucomplex.com (both sankaku: chan.sankakucomplex.com, idol.sankakucomplex.com), behoimi.org (3dbooru), youhate.us, safebooru.org, uberbooru.com, bronibooru.com, mspabooru.com, e926.net, e621.net, booru.org (all subdomains), atfbooru.ninja, lolibooru.moe, hypnohub.net, tbib.org, konachan.net, konachan.com, rule34.paheal.net

Small glossary

  • image initialization – getting the original image's data (source link, tag list, etc.)
  • empty image – the image that is tracked by the script, but not initialized
  • busy image – the image that is in progress of the initialization
  • ready image – the image that is initialized

Quick start

By default the script initializes all the available images on the start 2 . The initialized image is indicated by the yellow colored status bar on its bottom.
2 If some images aren't initialized, use Shift+I hotkey to complete initialization

  • Hotkeys
    1. Shift+A - download all the ready (initialized) images
    2. Shift+D - switch the Download Mode on/off
    3. Shift+I - (re)initialize the images
      it is usefull for imageboards with auto paging, or when some images are not initialized due to an error 429 (too many requests)
    4. Shift+M - open/close the user menu window
    5. Shift+V - open/close the viewer
    6. Left/Right - view previous/next image 1
  • Image downloading
    • In order to download the ready image, the Download Mode must be activated: use Shift+D hotkey, or press "Download Mode" button. Once the Download Mode is activated 3 , make a simple click on the image (thumbnail) to start the download. The downloading progress is indicated by the blue colored progress bar on the image's bottom. After the donwload is complete, the color of the image's status bar is changed to green.
    • One can also download the ready image by clicking on the "Download" button on the viewer's navigation bar.
    • To download all the ready images, use hotkey Shift+A, or press the "Download All" button. The amount of the ready images is visible on the button's name, e.i. 20 images are result in the name "Download All (20)", and if 4 images are downloaded, then the name is "Download All (4/20)".

  • Image viewing
    In order to open the viewer, use hotkey Shift+V, or press the "Viewer" button. By default, the first image is loaded on the first open. To start viewing, the image must be initialized. There are 3 ways to navigate when viewing:
    1. Left/Right 1 hotkeys
    2. a simple click on the thumbnails (right sidebar) 4
    3. the "Prev"/"Next" buttons on the viewer's navigation bar (bottom) 4
    The tag list of the viewed image is shown on the left sidebar.

3 The enabled "Download Mode" button has suffix "[on]", disabled one - "[off]"
4 The viewer's thumbnails and navigation bar are hidden, they fade in when the mouse cursor is over the right side/bottom of the viewer window

  • You can download the image only once per page open - if the image is downloaded, the script sets its state as "downloaded", and that image is no more available for download, unless you refresh the site page.
  • When downloading large amount of images at a time (e.i. by clicking the "Download All (40)" button), it may cause the error 429 (too many requests), that results in stop of downloading. Wait a little, then try again (click the "Downalod All" button again) to resume downloading.

Script configuration (user options)

This script uses GM.setValue/GM.getValue API to save/load the configuration data. The user interface is attached to the popup window (user options' window). To open/close the user interface press Shift+M, or click on the "User Menu" button. The cofiguration data (user options) is devided into 3 categories called "General", "Filename", and "Viewer":

  • General options:
    1. autoRun – initialize the images on start – [ true ]
    2. createViewer – add image viewer to imageboard – [ true ]
    3. downloadJPEG – download jpeg image (jpeg vs png on yande.re) – [ false ]
      on yande.re (and yande.re like) imageboards the highres images may have 2 versions with the same resolution: png (large filesize), and jpeg (smaller filesize), if so, the enabled downloadJPEG option forces to download the jpeg image
    4. animateProgress – animate initialization/downloading progress – [ true ]
      this option enables, or disables the animation of the status/progress bar when the image initialization/downloading starts. Warning, the animation may increase CPU load
  • Filename options:
    1. maxTagsInName – maximum tags in file name – [ 10 ]
      the maximum amount of the tags that are added to the filename, it is limited by 100
    2. tagsOrder – tags order in file name – [see defaults below]
      the ordered list of tag-types according to which the tags are added to the filename, default is ['character', 'copyright', 'artist', 'species', 'model', 'idol', 'photo_set', 'circle', 'medium', 'metadata', 'general', 'faults']
    3. ignoredTags – ignored tag names – []
      comma separated list of tag names that are skiped when making the filename
    4. tagsDelim – tags delimeter – [' ']
      the delimeter of tag names in the filename, it is the character string limited by length 4
    5. addImgBrdName – add imageboard name to file name – [ true ]
    6. prefixedName – prefixed names of imageboards – [ false ]
      when true, the long/prefixed name is used, otherwise – short name, e.i. chan.sankakucomplex.com has the prefixed/long name – 'chan.sankaku', and the short name - 'sankaku';
    7. imgIdAtNameEnd – image ID and imageboard name at file name end – [ true ]
      if true, then add the image ID, and the imageboard name to the filename end, otherwise – to the begin. The image ID is always added to the filename, and the imageboard name is always placed before the image ID
  • Viewer options:
    1. viewOriginal – view original images – [ false ]
      if true, then the original image is loaded when viewing, otherwise – the image sample
    2. viewJPEG – view jpeg image (yande.re option) – [ false ]
      if there is jpeg version of the original png image, and both (this one, and viewOriginal ) options are true, then load the jpeg one
    3. viewFirst – load 1st image on viewer open – [ true ]
      the image is going to be viewed must be initialized, otherwise nothing happens
    4. holdCtrl – hold Ctrl key to left/right navigate when viewing – [ false ]
    5. fixedTags – fix tag list – [ true ]
    6. fixedThumbs – fix thumb list – [ false ]
    7. showProgress – show progress/status bar – [ true ]
      show or hide status/progress bar on the viewer's thumbnails

Progress / status bar

There are 4 states 5 of the image's status/progress bar:

  1. the empty image has the red colored status bar
  2. the ready image has the yellow colored status bar
  3. the image, that is in progress of downloading has the blue colored progress bar
  4. the downloaded image has the green status bar

5 if the option animateProgress is enabled, the busy image has the animated red status bar

Changelog

  • v1.1.0.modified
    + new fork created due to Se7en no longer maintaining the script
    * (line 2873) fix DOMException: The play() request was interrupted (Fix detailed in this article)
    - (line 3956) kinda broke the viewer by forcing it to fit the image to the window, idk how to change it back
  • v1.1.0
    + added "close" button to viewer's navigation bar
    * fix userOptions loader (TamperMonkey bug?)
    * fix redirect on gelbooru's favorite pages
    * disable video preloader
  • v1.0.1
    * fixed image preloader
  • v1.0.0
    + user options:
    • ignored tag names - []
    • fixed tab list - [ true ]
    • fixed thumb list - [ false ]
    • view original images - [ false ]
      the old option viewSample is replaced by the viewOriginal keeping backward compatibility
    • added tabs to user menu window:
      • General: autoRun, createViewer, downloadJPEG, animateProgress
      • Filename: maxTagsInName, tagsOrder, ignoredTags, tagsDelim, addImgBrdName, prefixedName, imgIdAtNameEnd
      • Viewer: viewOriginal, viewJPEG, viewFirst, holdCtrl, fixedThumbs, fixedTags
    • auto hide the viewer's navigation bar
    • auto focus on the viewer's thumb/tag list when the mouse cursor is over them, thus, making much easier to start scrolling them
    • image preloader
    • changed the default value of the holdCtrl option to [ false ]
    • set controls, and loop attributes on the video elements
    • restore browser history URL after viewer exit
        this is sankaku hack: simply replaces the current history URL by the image's post URL to enable the valid image load
    • hide main page scroll bar when viewer opened
    • fixed viewer's 1st image thumbnail (post image thumb) on post page
    • little refactoring (for further changes)
    • v0.7.0
    • compatibility with Greasemonkey 4.0+
    • v0.6.0
    • advanced viewer:
      • tag list on left sidebar
      • thumbnail list on right sidebar
    • removed user options: max width, max height
    • v0.5.0
    • image status/progress bar
    • user option:
      • animate initialization/downloading progress - [ true ]
    • fix button events
    • v0.4.2
    • hotkey:
      • Shift+A
        • download all available images
    • fix image source getter
    • v0.4.1
    • fix exclude-list typo
    • fix konachan jpeg images extension
    • v0.4.0
    • added new portion of imageboards:
      • atfbooru
      • lolibooru
      • hypnohub
      • tbib
      • konachan
      • paheal
    • fix bug on post page due to empty viewer div
    • rename 'rule34' to 'rule34.xxx'
    • v0.3.2
    • user option:
      • ordered list of tag-types in file name - [see default in file name options]
    • v0.3.1
    • user options:
      • hold Ctrl key to left/right navigate when viewing - [ true ]
      • maximum width of image, px - [ 1000 ]
      • maximum height of image, px - [ 700 ]
    • v0.3.0
    • simple image viewer
    • user options:
      • create image viewer - [ true ]
      • view image sample - [ true ]
      • view jpeg image (yande.re option) - [ false ]
      • view 1st image on viewer activation - [ true ]
    • hotkeys:
      • Shift+V
        • switch viewer on/off
        • Ctrl+Left/Right
        • view previous/next image
    • @connect meta-data - to silence tampermonkey
    • fix wrong image hostname for uberbooru
    • v0.2.7
    • scrollable content of user menu window
    • user menu window's size fitted to client's size
    • move user menu 'close' button to the top right of the menu window (X sign)
    • other little changes
    • v0.2.5
    • fix typos
    • v0.2.4
    • user option:
      • image ID, and imageboard name at file name end [ true ]
    • dynamically rename images on user options change
    • v0.2.3
    • fix image extensions (on tampermonkey)
    • v0.2.2
    • bugfixes
    • little changes
    • v0.2.0
    • new downloaders:
      • youhate.us
      • safebooru
      • uberbooru
      • bronibooru
      • mspabooru
      • e926.net / e621.net
      • booru.org
    • user option:
      • prefixed imageboard name [ false ]
    • v0.1.1
    • user option:
      • auto initialize the script on start [ true ]
    • hotkey:
      • Shift+M
        • open/close the user menu window
    • little changes
    • v0.1.0
    • user menu
    • v0.0.13
    • refactoring
    • fix button events
    • v0.0.10
    • behoimi downloader
    • v0.0.9
    • hotkey:
      • Shift+I to (re)initialize the script (usefull for the imageboards with auto pagination)
    • fix yande.re jpeg image extension
    • v0.0.8
    • sankaku downloader:
      • chan.sankakucomplex.com
      • idol.sankakucomplex.com
    • v0.0.7
    • hotkey:
      • Shift+D to toggle the download mode
    • donmai downloader:
      • safebooru.donmai.us
      • danbooru.donmai.us
      • sonohara.donmai.us
      • hijiribe.donmai.us
    • v0.0.6
    • yande.re downloader
    • user option:
      • download jpeg (instead of png) [ false ]
    • v0.0.5
    • rule34 downloader
    • user option:
      • add imageboard name to image name [ true ]
    • v0.0.3
    • gelbooru downloader
    • user options:

      • maximum tags in image name [ 10 ]
      • tags delimeter [' ']

    P.S. sorry for my bad English