[Userscript] Derpibooru Explorer

Taivastiuku
The End wasn't The End - Found a new home after the great exodus of 2012

Introduction  
The aim of Derpibooru Explorer is to make finding new quality images on Derpibooru easier. This is achieved by providing recommendations depending on user’s context and by enhancing Derpibooru user experience with navigational improvements and visual notifications.
 
Preview video  
Github
 
Example recommendations (first image is current image)
 
full  
Rarity being Trixie
 
 
full  
me gusta
 
 
Currently recommendations are:  
  • Images that are similar to current image based on tags and faves of images  
  • Artists that are similar to current artist based on tags and faves of each artist’s images  
  • Highlights
     
    Navigational improvements consist of adding keyboard navigation, a queue for images and visual notifications. The queue is useful for avoiding opening dozens of browser tabs while browsing through recommendations.
     
    Requirements  
    Chrome + Tampermonkey  
    or  
    Firefox + Greasemonkey
     
    Install  
    https://tiuku.me/static/Derpibooru_Explorer.user.js
     
    Changelog
     
    v1.6.0 - Fix queue and similar images and adjust for new derpibooru styling. Let derpibooru javascript handle interactions for faving and voting. Remove hats and video mode as they are broken. Remove highlights as they cannot be generated anymore without significant fixes to the recommender.  
    v1.5.3 - Fix for changed derpibooru styling  
    v1.5.2 - Handle changes in Interactions API and window.booru  
    v1.5.1 - Add queue navigation to native /related/  
    v1.5.0 - POST image data if no recommendations can be made with cached data. This allows making recommendations if there are 24 or more tags and faves combined even when cached data is stale.  
    v1.4.2 - Update changed CSS class names  
    v1.4.1 - Fix some error handling, layout of tag cloud.  
    v1.4.0 - Enable voting from thumbnails, handle deleted similar images.  
    v1.3.1 - Don’t hardcode the derpiboo.ru domain.  
    v1.3.0 - Refactor how APIs are used, paginated queue view.  
    v1.2.1 - Use derpibooru API to fetch fave and vote info for recommendation thumbnails. Removed stars altogether.  
    full  
    v1.2.0 - Add view for inspecting queue  
    full  
    v1.1.7 - Add thumbnail enhancements to /lists/ urls and “Queue All” button to /images/ and /lists/ metabar.  
    v1.1.6 - Add and remove significant white spaces to work with new styling.  
    v1.1.5 - Configuration option to remove stars.  
    v1.1.4 - Queue button toggles item in queue instead of adding  
    v1.1.3 - Keyboard faving bugfix  
    v1.1.2 – Remove ’Q’ from small thumbnails, short filenames for direct image links.  
    v1.1.1 - Direct image link in thumnbail frames, support small thumbnails.  
    full  
    v1.1.0 - Highlights, festive hats and privacy policy changes.
     
    full
     
    Highlights can be accessed from the top-right menu and contains the newest images in derpibooru with only images that current user might like.
     
    Privacy policy was changed as highlights require username for user specific filtering. Username is only sent as part of query if this feature is used.
     
    Hats for christmas holiday (can be disabled from config)!
     
    v1.0.0 - Initial release
     
    Features  
    This userscript adds queue navigation, similar images search, similar artists search, newest images that user might like, some keyboard shortcuts and visual notifications to Derpibooru.
     
    User can add images to queue from image thumbnails and navigate to the next image in the queue by pressing ‘e’.
     
    When viewing a single image user is given thumbnails of images that are similar to current image. Spoilered tags and hided tags are spoilered and hided respectively. More similar images may be fetched using a provided button.
     
    When viewing an artist tag image listing the user gets a list of similar artists.
     
    User can access highlighted images from top-right menu. This view contains newest images that are similar to users profile.
     
    When viewing a single image user can press ‘1’, ‘2’ or ‘3’ to toggle fave, upvote or downvote respectively on current image. A visual notification is displayed.
     
     
    Known Issues (v. 1.6.0)  
    Templates used by Derpibooru Explorer generate CSP warnings due to use of ‘unsafe-eval’.
     
    Dataset is not real time and most updates to it are only partial.  
  • First recommendation is often same as the current image/artist.  
  • Newest images won’t get any similar images and won’t show up in similar images lists. Same applies to artist similarity.
     
    Recommendations list doesn’t provide all the Derpibooru functionality.  
  • Number of comments is not displayed.  
  • Spoilers display a list of spoilered tags instead of image spoiler.  
  • Images behind spoilers cannot be inspected with mouse hover or click.
     
    Keyboard shortcuts do not guarantee that the action was successful  
  • The notification is displayed even if the action fails.
     
    Highlights could be better  
  • No pagination.  
  • Might not work well if user has low number of faves.  
  • Update only every few days
     
     
    Privacy Policy  
    Recommendations are based on public data fetched from Derpibooru API and on performance data collected from users of tiuku.me API.
     
    All users are given a session token. This token, along with requests and responses related to it, are saved by tiuku.me and are used for evaluating and improving tiuku.me service.
     
    Session tokens expires when user logs in, logs out or is logged out automatically. User’s local storage is used for storing session token and username to provide this functionality.
     
    Local storage is also used for storing other state information of this script, like the state of the image queue.
     
    Highlights feature uses current users username as query. Otherwise this script does not send usernames, user_ids, passwords or other personal information to tiuku.me or 3rd party services. Hiding, spoilering and showing favourites is done purely on client side and is based on public data from Derpibooru API and Derpibooru page that the user is currently viewing.
     
    All assets are downloaded from tiuku.me over a secure connection and the main script “derpibooru_explorer.js” makes secure queries to tiuku.me to fetch recommendations. No requests are made to 3rd party services.
barbeque
Roseluck - Had their OC in the 2023 Derpibooru Collab.
Elements of Harmony - Had an OC in the 2022 Community Collab
Non-Fungible Trixie -
Twinkling Balloon - Took part in the 2021 community collab.
Friendship, Art, and Magic (2018) - Celebrated Derpibooru's six year anniversary with friends.
Magical Inkwell - Wrote MLP fanfiction consisting of at least around 1.5k words, and has a verified link to the platform of their choice
Magnificent Metadata Maniac - #1 Assistant
Thread Starter - Tag alias request thread
Artist -
Bronze Bit -

oh gods yes it’s back. INTERNET HUGS HAVE BEEN DELIVERED TO YOUR COMPUTER SCREEN.
 
The only drawback I can see is that I now have no excuse but to have to spend all my free time browsing for more pictures…
Taivastiuku
The End wasn't The End - Found a new home after the great exodus of 2012

The suggestions were broken for last 6 hours or so due to an update. Hopefully no-one judged their accuracy too harshly during that time.
 
@barbeque  
@VladimirMacHolzraum  
One of the largest problems for getting this released was that every time I started working on the script or the recommender I ended just looking at ponies.
Taivastiuku
The End wasn't The End - Found a new home after the great exodus of 2012

I did few updates:
 
  • The queue now supports navigating and adding to queue from multiple tabs without messing up the queue.  
  • KEYBOAR_SHORTCUTS config option for enabling/disabling keyboard  
  • LOGOUT_ENDS_SESSION config option for enabling/disabling session session clearing on logout  
  • DEBUG config option actually silences debug logging
CobaltTiger

@Taivastiuku  
Doesn’t work for me, I don’t think there is any code other than the config in the version currently up?
 
You also might want to add the www urls to your @match list, that’s what I happened to have bookmarked so at first I couldn’t even get it to run until I edited it in:
 
// @match https://www.derpiboo.ru/*
Taivastiuku
The End wasn't The End - Found a new home after the great exodus of 2012

@CobaltTiger  
The main Derpibooru_Explorer.user.js doesn’t contain any real code but loads the main script file as a dependency:  
// @require https://tiuku.me/static/derpibooru_explorer.js?1.0.2
 
I think this makes sense since I require other libraries too. The Derpibooru_Explorer.user.js file is only used for configuration, readme and bootstrapping the main script.
 
It seems that the script doesn’t work with GreaseMonkey on Firefox after all. The script seems to stop whenever I try to use localStorage, GM_setValue or GM_getValue. I’ll try to figure out why this is and fix Firefox support but for now the only way to run Derpibooru Explorer is by using Tampermonkey on Chrome.
 
I updated the script to @match www subdomains.
Taivastiuku
The End wasn't The End - Found a new home after the great exodus of 2012

@VladimirMacHolzraum  
The suggestions data, including faves, is updated only every few days.
 
It’s pretty hard to update faves in real-time since I don’t want to collect usernames from users, I don’t have direct access to the Derpibooru database and I don’t want to make an abusive number of requests to the Derpibooru API.
Rene_Z
Non-Fungible Trixie -
My Little Pony - 1992 Edition
Wallet After Summer Sale -
Not a Llama - Happy April Fools Day!
Artist -

The simliar images don’t work for me at all. :(  
I’m using Firefox 34.0 with Greasemonkey 2.3. I tried turning VIDEO_MODE on and off, in both cases no similar images appear. In video mode the main image is rescaled properly. The log looks fine to me and I can also see that the API request is made and gets a response with the proper data. All other features (queue, keyboard shortcuts and similar artists) do function.
Taivastiuku
The End wasn't The End - Found a new home after the great exodus of 2012

@Rene_Z  
It seems that the script was injecting recommendations within an element that is used for ads. There are no ads currently displaying, so the recommendations didn’t go anywhere.
 
I updated the script and everything should now work if you update/reinstall the script.
Taivastiuku
The End wasn't The End - Found a new home after the great exodus of 2012

Version 1.1.0 with highlights, festive hats and update to privacy policy!
 
Highlights: Have you ever browsed the newest images page and wished that it left out all the crappy uploads? Well now you can! Highlights page shows newest images but filters out images that don’t match current users profile.  
  • No pagination :(  
  • Might require respectable amount of faves to work (works fine for me but I have close to 8000 faves)  
  • Requires username as query as the list is filtered with users profile.  
  • Updates only every few days.  
    full
     
    Privacy policy: Highlights queries https://tiuku.me/ with current username as query.
     
    Festive hats: Hats will be displayed on comment and forum avatars during the christmas holiday.  
  • Hats can be disabled with appropriate configuration option.  
    full
Background Pony #BD20
When will this be built in derpibooru? Now that I saw this, the site is missing the similar images panel.
5hyflutter

Wonderful update. The direct image button is the only thing I needed. Thanks.
 
Now let me just point out two things:
 
1. Full image link vs shortened image link:
 
Could the frame button lead to the shortened link so I wouldn’t have to download files with long and potentially embarrassing names?
 
795020.jpg
instead of
795020__safe_solo_fluttershy_traditional+art_artist-colon-sarehkee.jpg
 
From links:
And
 
2. You need to drop the letter Q next to the queue button:  
  • with 3-digit favourite count and 3-digit score, the frame becomes stretched and the whole row gets shifted lower (using small thumbnails mode).
Taivastiuku
The End wasn't The End - Found a new home after the great exodus of 2012

@5hyflutter
 
Fixed.
 
Version 1.1.2 - Remove ‘Q’ from small thumbnails, short filenames for download links  
  • Remove queue text from small thumbnails  
  • Remove tags from thumbnail frame download link filenames.
5hyflutter

Great! That’d fix a lot. I queued Rarijack Daily gallery download yesterday and it’s still hickupping with those long names for some reason.
 
EDIT: Yeah those files break DownThemAll (Main download manager for Firefox) so it’s counterproductive.
 
But you wrote that the link directs to short filenames now, it doesn’t yet.  
Thank you so much. You’re the best.
Interested in advertising on Derpibooru? Click here for information!
Techy Cutie Pony Collection!

Help fund the $15 daily operational cost of Derpibooru - support us financially!

Syntax quick reference: **bold** *italic* ||hide text|| `code` __underline__ ~~strike~~ ^sup^ %sub%

Detailed syntax guide