Security News
The Dark Side of Open Source
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
yandex-pictures
Advanced tools
Readme
yandex-pictures - Оболочка внутреннего программного интерфейса Yandex Image
поскольку у Яндекса нет API для получения общедоступных изображений (03.03.2018), то вчера утром я еще раз убедился, что его не существует, а точнее он есть , но только "на бумаге" Yandex pictures api , я решил разработать его на основе внутреннего API Яндекс Картинок.
Установим npm модуль yandex-pictures
$ npm install yandex-pictures -s
подключение модуля
const yapic = require("yandex-pictures")
чтобы начать вам понадобится объект с параметрами поиска
обязательные параметры
ключ | значение | информация |
---|---|---|
text | string | используется для поиска картинки по тексту |
url | string | используется для поиска похожей картинки или оригинала |
не обязательные параметры
ключ | значение | значение по-умолчанию | информация |
---|---|---|---|
isize | string | [large, medium, small, eq, wallpaper, eq] | используется для поиска картинки определенного размера |
iw | int | * | используется для поиска картинки точного размера, при этом значение ключа "isize" должно быть "eq" |
ih | int | * | используется для поиска картинки точного размера, при этом значение ключа "isize" должно быть "eq" |
iorient | string | [square, horizontal, vertical] | используется для поиска картинки определенной ориентации |
type | string | [photo, clipart, lineart, face, demotivator] | используется для поиска картинки определенного типа |
icolor | string | [orange, color, gray, red, orange, yellow, cyan, green, blue] | используется для поиска картинки определенной цветовой гаммы |
itype | string | [png, jpg, jpeg, gif] | используется для поиска картинки определенного типа файлов |
page | int | 0 | используется для поиска картинки на точной позиции (смещении) |
count | int | 30 | необходимое количество картинок которое нужно вернуть (пробовал 610 норм) |
comm | int | [*, 1] | используется для поиска картинки в качестве товара |
recent | string | [*, D7] | используется для поиска более свежих картинок |
wp | string | [*, wh16x9_1366x768] | используется для поиска картинок для рабочего стола |
site | string | * | используется для поиска картинки на определенном сайте |
family | string | [0,1,2] | используется для цензурирования поиска 0 - без цензуры 1 - умеренный 2 - семейный поиск |
асинхронная функция
const yapic = require("yandex-pictures")
yapic.getImage({
text: "JSusDev",
count: 2
}, (err, res) => {
// обработка ошибок как везде...
console.log(res)
/* тут вернется массив картинок
если они если есть или
пустой массив */
})
синхронная функция
const yapic = require("yandex-pictures")
const images = yapic.getImageSync({
text: "JSusDev",
count: 2
})
console.log(images)
/* тут вернется массив картинок
если они если есть или
пустой массив */
вы можете передать следующим параметром в каждую из функций объект с заголовками и тд
асинхронная функция
const yapic = require("yandex-pictures")
yapic.getImage({
text: "JSusDev",
count: 2
}, {/* ... обратитесь к библиотеке 'request' чтобы уточнить структуру объекта с настроками запроса ... */}, (err, res) => {
console.log(res)
})
синхронная функция
const yapic = require("yandex-pictures")
const images = yapic.getImageSync({
text: "JSusDev",
count: 2
}, {/* ... обратитесь к библиотеке 'sync-request' чтобы уточнить структуру объекта с настроками запроса ... */})
console.log(images)
асинхронная функция для поиска подобной картинки
const yapic = require("yandex-pictures")
yapic.getImage({
url: "https://static1.tgstat.com/public/images/channels/_0/82/822ecac8ab696703149dc7bb7ce2474d.jpg"
}, (err, res) => {
console.log(res)
/* тут вернется массив картинок
если они если есть или
пустой массив */
})
асинхронная функция для поиска картинки по параметрам объекта
const yapic = require("yandex-pictures")
yapic.getImage({
text: "гражданская оборона",
icolor: "gray",
isize: "eq",
iw: 800,
ih: 600,
count: 3
}, (err, res) => {
console.log(res)
/* тут вернется массив картинок
если они если есть или
пустой массив */
})
Мой Телегам: @JSusDev, канал https://t.me/Jsusdevs
если у вас есть какие-либо вопросы и/или предложения, пожалуйста, напишите мне в телеграмме, если вы найдете ошибки я буду очень благодарен, также дайте мне знать
yandex-pictures - library for pulling Ynadex images
since Yandex does not have an API to get public images (03.03.2018), yesterday morning I was once again convinced that it does not exist, or rather it is, but only "on paper" Yandex pictures api , I decided to develop it on the basis of the internal API Yandex images.
to begin, install the package yandex-pictures
$ npm install yandex-pictures -s
connect the module
const yapic = require("yandex-pictures")
and so to begin the desired object with the search parameters of the picture
required parameter
options | types | info |
---|---|---|
text | string | search for string |
url | string | search for a similar picture |
optional parameter
options | types | default | info |
---|---|---|---|
isize | string | [large, medium, small, eq, wallpaper, eq] | used to search for images of a certain size " eq "used with" iw " and " ih" |
iw | int | * | is used to search for images of a certain size in the case when i size the "eq" |
ih | int | * | is used to search for images of a certain size in the case when i size the "eq" |
iorient | string | [square, horizontal, vertical] | used to search for an image of a specific orientation |
type | string | [photo, clipart, lineart, face, demotivator] | used to search for a certain type of picture |
icolor | string | [orange, color, gray, red, orange, yellow, cyan, green, blue] | used to search for color pictures |
itype | string | [png, jpg, jpeg, gif] | is used to search for images of a specific file type |
page | int | 0 | shift the search page |
count | int | 30 | the maximum number of images to return |
comm | int | [*, 1] | is used to search for pictures of product |
recent | string | [*, D7] | used to find a more recent picture |
wp | string | [*, wh16x9_1366x768] | is used to search images for your desktop |
site | string | * | used to search for images on the specified site |
family | string | [1,2,3] | allows you to configure search security |
asynchronous function
const yapic = require("yandex-pictures")
yapic.getImage({
text: "JSusDev",
count: 2
}, (err, res) => {
console.log(res)
})
synchronous function
const yapic = require("yandex-pictures")
const images = yapic.getImageSync({
text: "JSusDev",
count: 2
})
console.log(images)
for these functions, you can pass an optional header parameter and other crap
asynchronous function
const yapic = require("yandex-pictures")
yapic.getImage({
text: "JSusDev",
count: 2
}, {/* ... options request from lib 'request' ... */}, (err, res) => {
console.log(res)
})
synchronous function
const yapic = require("yandex-pictures")
const images = yapic.getImageSync({
text: "JSusDev",
count: 2
}, {/* ... options request from lib 'sync-request' ... */})
console.log(images)
asynchronous search function for similar images
const yapic = require("yandex-pictures")
yapic.getImage({
url: "https://static1.tgstat.com/public/images/channels/_0/82/822ecac8ab696703149dc7bb7ce2474d.jpg"
}, (err, res) => {
console.log(res)
})
asynchronous function text search with other parameters
const yapic = require("yandex-pictures")
yapic.getImage({
text: "гражданская оборона",
icolor: "gray",
isize: "eq",
iw: 800,
ih: 600,
count: 3
}, (err, res) => {
console.log(res)
})
my telegram: @JSusDev, channel https://t.me/Jsusdevs
if you have any questions and suggestions please email me in telegram if you find bugs I will be very grateful if you also let me know
FAQs
Yandex pictures api for image search
The npm package yandex-pictures receives a total of 0 weekly downloads. As such, yandex-pictures popularity was classified as not popular.
We found that yandex-pictures demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.
Security News
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.