Class SpazImageURL
Defined in: spazimageurl.js.
Constructor Attributes | Constructor Name and Description |
---|---|
SpazImageURL(args)
a library to get direct image urls for various image hosting servces |
Method Attributes | Method Name and Description |
---|---|
addAPI(service_name, opts)
add a new API for a service |
|
find the image service URLs that work with our defined APIs in a given string |
|
getAPI(service_name)
get an api for a service |
|
getAPIs()
retrieve APIs |
|
getImageForUrl(url)
given a single image hosting service URL, this returns a URL to the image itself |
|
getImagesForMatches(matches)
find the image service URLs that work with our defined APIs in a given string |
|
getImagesForUrls(str)
given a string, this returns a set of key:val pairs of main url:image url for image hosting services for urls within the string |
|
getThumbForUrl(url)
given a single image hosting service URL, this returns a URL to the thumbnail image itself |
|
getThumbsForMatches(matches)
find the image service URLs that work with our defined APIs in a given string |
|
getThumbsForUrls(str)
given a string, this returns a set of key:val pairs of main url:thumbnail url for image hosting services for urls within the string |
|
initAPIs()
Creates the initial default set of API descriptions |
SpazImageURL(args)
a library to get direct image urls for various image hosting servces
- Parameters:
- args
addAPI(service_name, opts)
add a new API for a service
- Parameters:
- {string} service_name
- {object} opts
- (url_regex regexp, getThumbnailUrl method, getImageUrl method)
{object|null} findServiceUrlsInString(str)
find the image service URLs that work with our defined APIs in a given string
- Parameters:
- {string} str
- Returns:
- {object|null} an object of services (keys) and an array of their matches (vals)
{object} getAPI(service_name)
get an api for a service
- Parameters:
- {string} service_name
- Returns:
- {object}
{string|null} getImageForUrl(url)
given a single image hosting service URL, this returns a URL to the image itself
- Parameters:
- {string} url
- Returns:
- {string|null}
{object|null} getImagesForMatches(matches)
find the image service URLs that work with our defined APIs in a given string
- Parameters:
- {object} matches
- Returns:
- {object|null} fullurl:thumburl key:val pairs
{object|null} getImagesForUrls(str)
given a string, this returns a set of key:val pairs of main url:image url for image hosting services for urls within the string
- Parameters:
- {string} str
- Returns:
- {object|null} fullurl:imageurl key:val pairs
{string|null} getThumbForUrl(url)
given a single image hosting service URL, this returns a URL to the thumbnail image itself
- Parameters:
- {string} url
- Returns:
- {string|null}
{object|null} getThumbsForMatches(matches)
find the image service URLs that work with our defined APIs in a given string
- Parameters:
- {object} matches
- Returns:
- {object|null} fullurl:thumburl key:val pairs