Skip to content
David Refoua edited this page Aug 14, 2019 · 83 revisions

DiFi Documentation Home

DiFi, or the deviantART interactive fragmented interface, is a multi-purpose API that is utilized by deviantART webpages in order to retrieve information as well as sending commands to their servers. Using the DiFi API calls, it is possible to do quite a bit of manipulation with DeviantART, with minimal HTML scraping.  Read more…

This Wiki's goal is to document the DeviantART's DiFi protocol as much as possible, by reverse engineering network calls and parsing available source codes.

Most of the described classes and their method calls were discovered by the following combination of methods:

  • looking through the javascript files on deviantART, either using grep to find DiFi calls or manually by hand
  • using the following filters into Wireshark and surfing dA:
    • http.request.uri contains "/difi"
    • data-text-lines contains "DiFi" and data-text-lines contains "status"
  • using the Chrome Developer Menu (F12Network tab), and either entering /difi or filtering XHR requests

The original source code files (that are un-minified and contain comments) are also available. More information on the Reverse-engineering page.

Protocol Basics

DiFi requests are sent to the /global/difi/ path. The HTTP request verbs are either GET or POST, depending on the type of operation (auth-dependent operations always use POST). A list of DiFi call requests are sent in the c[] parameter; more than one call may be performed per HTTP request. Each call must name an object, a method from the object, and a list of parameters to pass to the method.

The call can be used in order to either request information from the website (e.g. to populate parts of the website), or to perform certain actions on different parts of the website (e.g. giving "favourites").

For more info on the basic protocol, see Protocol.

Authentication

Most of the public information (and certain actions) can be requested without providing any authentication cookies.

However, accessing user-based information, as well as performing most of the actions on the website requires authentication cookies to be present with the requests.

The auth cookies are shared with the HTML pages, and can only be acquired by doing a bit of HTML scraping and performing an HTTP POST request.

Using DiFi in projects

While the DiFi API was designed to be used internally by the website itself, quite a number of third-party projects exist that make use of the same calls in order to retrieve information or perform actions within the website.

The third-party projects are divided into CLI scripts, Bots, and Userscripts.

Userscript requests

One of the easiest methods to develop scripts for the website is to use Userscript browser extensions, as they basically inject Javascript codes right into the webpage.
Here is a list of browser extensions that were used to run DeviantArt Userscripts:

One advantage of using Userscripts in general (in contrast to Bots, as an example) is that they do not require a manual login process, as all DiFi requests share the same authentication cookie with the webpages themselves.

JS Access demonstrates how to use DiFi requests using Javascript language (and especially within Userscripts).

The DiFi object is a native client that is used by DeviantArt to perform DiFi requests.

Bots and libraries

Tne DiFi project is used by a number of bots that automate routines on the website. Notable DeviantArt bots are:

  • dAhub: (discontinued, closed-source) a point trade account
  • dAtrade: (abandoned) a point trade account
  • dAbot: (open-source) a multi-purpose python-based script
  • dADroid: (open-source) a cross-platform general-purpose library, able to authenticate to the website. Written in two separate Node.js and PHP packages.

Browsing the Classes

The easiest way to document calls is to divide the docs up by the objects:

General information

  • Protocol: Describes the mechanism of the DiFi protocol
  • JS Access: Provides examples and snippets to interact with the DiFi protocol with javascript (e.g. userscripts)
  • DiFi object: Explains how the website uses DiFi communications natively
  • Glossary: List of DeviantArt technology words

Other Snippets

  • Dialog: A common DiFi response format that contains a lot of HTML/CSS data.
  • Admin Privs: List of Admin Privs and associated ids
  • Resource Types: List of resource types on dA, used to identify folder types and comment's typeids
  • Deleted Classes: List of now inaccessible classes
  • Interesting URLs: List of some links on the website worth checking out
  • Reverse-engineering: List of methods used to reverse-engineer the source code

Userscript resources

Links to outside

Contribution

We welcome and appreciate any contribution to the wiki.
Please create an issue to either:

  • get write access to the wiki
  • report missing, deprecated, erroneous or any new information

Disclaimer

DiFi is an internal API of deviantART, and can change at any time. deviantART has made no commitment to support applications using it.

Clone this wiki locally