packages/embed-plugin-twitter/src/index.js
async function _process(
  args,
  { fetch },
  {
    _omitScript,
    maxWidth,
    hideMedia,
    hideThread,
    align,
    lang,
    theme,
    linkColor,
    widgetType
  }
) {
  const params = {
    url: args[0],
    omitScript: _omitScript,
    maxWidth,
    hideMedia,
    hideThread,
    align,
    lang,
    theme,
    linkColor,
    widgetType
  }
  try {
    const apiUrl = `https://api.twitter.com/1/statuses/oembed.json?${getQuery(
      params
    )}`
    const res = await (isBrowser ? jsonp : fetch)(apiUrl)
    return await res.json()
  } catch (e) {
    return {
      html: ""
    }
  }
}
async function _process(
  args,
  { fetch },
  {
    _omitScript,
    maxWidth,
    hideMedia,
    hideThread,
    align,
    lang,
    theme,
    linkColor,
    widgetType
  }
) {
  const params = {
    url: args[0],
    omitScript: _omitScript,
    maxWidth,
    hideMedia,
    hideThread,
    align,
    lang,
    theme,
    linkColor,
    widgetType
  }
  try {
    const apiUrl = `https://api.twitter.com/1/statuses/oembed.json?${getQuery(
      params
    )}`
    const res = await (isBrowser ? jsonp : fetch)(apiUrl)
    return await res.json()
  } catch (e) {
    return {
      html: ""
    }
  }
}
async function _process ( args , { fetch } , { _omitScript , maxWidth , hideMedia , hideThread , align , lang , theme , linkColor , widgetType } ) { const params = { url : args [ 0 ] , omitScript : _omitScript , maxWidth , hideMedia , hideThread , align , lang , theme , linkColor , widgetType } try { const apiUrl = ` ${ getQuery ( params ) } ` const res = await ( isBrowser ? jsonp : fetch ) ( apiUrl ) return await res . json ( ) } catch ( e ) { return { html : "" } } }
Fetch the html content from the API
@param url
@param args
@param omitScript
@param maxWidth
@param hideMedia
@param hideThread
@param align
@param lang
@param theme
@param linkColor
@param widgetType
@returns {Promise.<*>}
Fetch the html content from the API