Skip to content

Discussion API

Isaac edited this page Apr 3, 2022 · 4 revisions

Diffbot documentation:

https://www.diffbot.com/dev/docs/discussion/

Usage

letdiscussion=awaitdiffbot.discussion({url: 'https://www.theverge.com/2020/8/25/21400240/epic-apple-ruling-unreal-engine-fortnite-temporary-restraining-order',body: 'optional-html-post-body',});console.log(discussion.objects[0].title);console.log(discussion.objects[0].posts);console.log(discussion.objects[0].participants);console.log(discussion.objects[0].sentiment);

Full list of supported parameters:

ParamTypeRequiredDescription
urlstringYesWeb page URL of the discussion to process
fieldsstring[]NoUsed to specify optional fields to be returned by the Discussion API. See fields: https://www.diffbot.com/dev/docs/discussion/#fields
timeoutnumberNoSets a value in milliseconds to wait for the retrieval/fetch of content from the requested URL. The default timeout for the third-party response is 30 seconds (30000).
callbackstringNoUse for jsonp requests. Needed for cross-domain ajax.
maxPagesnumber|stringNoSet the maximum number of pages in a thread to automatically concatenate in a single response. Default = 1 (no concatenation). Set maxPages=all to retrieve all pages of a thread regardless of length. Each individual page will count as a separate API call.
proxystringNoUsed to specify the IP address of a custom proxy that will be used to fetch the target page, instead of Diffbot's default IPs/proxies. (Ex: &proxy=168.212.226.204)
proxyAuthstringNoUsed to specify the authentication parameters that will be used with the proxy specified in the &proxy parameter. (Ex: &proxyAuth=username:password)
bodystringNoOptional HTML markup to pass as POST body
customJSstringNoThis functionality is currently in beta. See docs for details: https://docs.diffbot.com/docs/en/api-discussion#custom-javascript
customHeadersobjectNoThis functionality is currently in beta. See docs for details: https://docs.diffbot.com/docs/en/api-discussion#custom-headers

Clone this wiki locally