Danbooru

[Userscript] New Twitter Image Searches and Stuff

Posted under General

New Twitter Image Searches and Stuff (NTISAS) searches the Danbooru database for tweet IDs, adds image search links, highlights images based on Tweet favorites, and provides a variety of additional user interface enhancements.

It works with the new layout that Twitter has recently released (July 2019). It is based off the idea of the popular userscript Pixiv Image Searches and Stuff (PISAS, About:Userscripts).

Installation

Project page
Main script

https://raw.githubusercontent.com/BrokenEagle/JavaScripts/stable/New_Twitter_Image_Searches_and_Stuff.user.js

Updates

The script is based upon the previous version of TISAS which worked with the old version of Twitter (topic #15976).

NOTE: The program data scheme was altered in NTISAS 1.6+. To transfer the program data, export the database using TISAS or previous versions of NTISAS, and then import it using NTISAS 1.6+.

Usage notes

The following wiki is for TISAS, but a lot of the same still applies.

https://github.com/BrokenEagle/JavaScripts/wiki/Twitter-Image-Searches-and-Stuff

One primary difference is that there is now a link to query SauceNAO. Currently this functions exactly the same as the IQDB link, with the similarity cutoff being 80%.

Final

Any suggestions or feedback is appreciated.

Latest edits

  • (2019-03-04)
    • Version 6 Added tweet views
      • Added ability to lock page navigation
      • Fixed uploader names not appearing on posts

Versions

Updated

Pushed Version 3 which has several additions and fixes:

  • Additions:
    • Ability to merge results by running a new query
    • User setting for the minimum similarity cutoff on IQDB/SauceNAO
    • User setting to display a Twitter user's ID on the Tweet view
    • Additional clickable areas around the links <fredgido - Discord>
  • Changes:
    • Added types of data being exported to the Export Data filename
    • Account for items that Danbooru Member-level user's can't do (i.e. more than 2 tags for post queries)
  • Fixes:
    • Fixed spacing of Twitter menu items being occasionally unchanged
    • Fixed anchor hashmarks "#" in the URL causing page detection to fail
    • Fixed tweet statistics incorrectly resetting when going to the Tweet view and back
  • Other:
    • Updated external code library versions
    • Several other code refactors and minor fixes

Updated

Pushed Version 4 which has several additions and fixes:

  • Additions:
    • User setting to display the image number when hovering over an image
      • Mostly useful for when using the Download Original function
    • User setting for the maximum number of results to return for IQDB/SauceNAO
    • User setting to bypass checking the Tweet Database server
      • Mostly useful if the server is unreachable from your browser/device/location
  • Fixes:
    • Fixed image menu being doubled up or not there at all for some retweets <fredgido - Discord>
    • Fixed Tweet videos not being processed when autoplay was enabled <fredgido - Discord>
    • Fixed Tweet videos/GIFs sometimes not being playable <fredgido - Discord>
    • Fixed Tweet video images not being downloadable <fredgido - Discord>
    • Fixed Tweet cards and quoted tweets being incorrectly processed
    • Fixed post tooltips not being added in some cases
    • Fixed status markers not being positioned correclty

Pushed Version 5 which primarily includes an update to the library code plus a few additions and fixes:

  • Changes
    • Altered how IQDB/Sauce check save data to avoid saving unnecessary information
      • This fixes the image menu sometimes stalling when loading new tweets
  • Fixes
    • Fix popup text in IQDB/Post advanced tooltips causing the tooltips to disappear
  • Other
    • Multiple internal code changes and refactors

Pushed Version 6 which primarily includes adding tweet views.

  • Additions:
    • Added ability to track tweet views
      • Only tweets with media are tracked
      • Tweets are only counted once per page load
      • Tweets with previous views can be highlighted
        • With a control in the side menu
        • This shows up as rounded rectangle on the left side of a tweet
      • Tweet views currently expire after one month if they are not renewed
    • Added ability to lock page navigation
      • This blocks navigating to external links and page reloads/unloads
      • This does not block regular Twitter navigation
    • Added setting to show/hide network error count
      • As shown in the side menu
  • Changes:
    • Grouped storage and network calls for better efficiency
      • Pending requests are sent as a group at tenth second intervals
    • Created static anchor points for the tweet status bar
      • This guarantees the order of elements appearing there
  • Fixes:
    • Uploader names not appearing on the post tooltips
    • Tweet indicators not rendering in some cases
    • Status bar was not rendering correctly on main tweets in some cases
  • Other:
    • Added additional unhandled image URLs
      • This keeps the image menu from being added to the wrong tweets
    • Additional refactoring and relocating of code
      • Both for better grouping and to fix some minor issues

I'm getting an error looking through any tweet as of late. The error I get reads "Error marking up stream tweet!".
Downgrading to an older version of this script has the same problem.

Debug console shows a lot of net::ERR_NAME_NOT_RESOLVED connection errors.

AkenoA said:

I'm getting an error looking through any tweet as of late. The error I get reads "Error marking up stream tweet!".
Downgrading to an older version of this script has the same problem.

Yeah, that's to let me know when Twitter changes their page structure, since the script is very dependent on a stable structure. I've been working on an update to the script, but have had several other items that have also kept me busy. Regardless, I'll try to have what I've got cleaned up and pushed out by tomorrow. You can disable the script until then so that you don't keep getting those error messages.

Debug console shows a lot of net::ERR_NAME_NOT_RESOLVED connection errors.

Those have nothing to do with the script. It does the same thing even with all userscripts disabled. I'm thinking it might have to do with an extension, but as it doesn't have a lot to do with my scripts, I'm not really invested in finding about something that I can't really affect anyways.

Just pushed Version 6.1 which should fix the issues mentioned above on the changes in Twitter's page structure.

  • 1