Socket
Socket
Sign inDemoInstall

yandex-pictures

Package Overview
Dependencies
84
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    yandex-pictures

Yandex pictures api for image search


Version published
0
Maintainers
1
Created
Weekly downloads
 

Readme

Source

enter image description here

lang: ru en

yandex-pictures

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")

чтобы начать вам понадобится объект с параметрами поиска

Объект

обязательные параметры

ключзначениеинформация
textstringиспользуется для поиска картинки по тексту
urlstringиспользуется для поиска похожей картинки или оригинала

не обязательные параметры

ключзначениезначение по-умолчаниюинформация
isizestring[large, medium, small, eq, wallpaper, eq]используется для поиска картинки определенного размера
iwint*используется для поиска картинки точного размера, при этом значение ключа "isize" должно быть "eq"
ihint*используется для поиска картинки точного размера, при этом значение ключа "isize" должно быть "eq"
iorientstring[square, horizontal, vertical]используется для поиска картинки определенной ориентации
typestring[photo, clipart, lineart, face, demotivator]используется для поиска картинки определенного типа
icolorstring[orange, color, gray, red, orange, yellow, cyan, green, blue]используется для поиска картинки определенной цветовой гаммы
itypestring[png, jpg, jpeg, gif]используется для поиска картинки определенного типа файлов
pageint0используется для поиска картинки на точной позиции (смещении)
countint30необходимое количество картинок которое нужно вернуть (пробовал 610 норм)
commint[*, 1]используется для поиска картинки в качестве товара
recentstring[*, D7]используется для поиска более свежих картинок
wpstring[*, wh16x9_1366x768]используется для поиска картинок для рабочего стола
sitestring*используется для поиска картинки на определенном сайте
familystring[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 by JSus

yandex-pictures

yandex-pictures - library for pulling Ynadex images

Why?

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.

Get started

to begin, install the package yandex-pictures

$ npm install yandex-pictures -s

Examples

connect the module

const yapic = require("yandex-pictures")

and so to begin the desired object with the search parameters of the picture

Object

required parameter

optionstypesinfo
textstringsearch for string
urlstringsearch for a similar picture

optional parameter

optionstypesdefaultinfo
isizestring[large, medium, small, eq, wallpaper, eq]used to search for images of a certain size " eq "used with" iw " and " ih"
iwint*is used to search for images of a certain size in the case when i size the "eq"
ihint*is used to search for images of a certain size in the case when i size the "eq"
iorientstring[square, horizontal, vertical]used to search for an image of a specific orientation
typestring[photo, clipart, lineart, face, demotivator]used to search for a certain type of picture
icolorstring[orange, color, gray, red, orange, yellow, cyan, green, blue]used to search for color pictures
itypestring[png, jpg, jpeg, gif]is used to search for images of a specific file type
pageint0shift the search page
countint30the maximum number of images to return
commint[*, 1]is used to search for pictures of product
recentstring[*, D7]used to find a more recent picture
wpstring[*, wh16x9_1366x768]is used to search images for your desktop
sitestring*used to search for images on the specified site
familystring[1,2,3]allows you to configure search security

The object is used in the following functions

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)
A few more examples

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)

})

Contacts

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

yandex-pictures by JSus

Keywords

FAQs

Last updated on 04 Mar 2018

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc