Comments (1)
There's no way to do this securely. Images from VK require authorization, so browser extension can't reach it.
In case an idea will come, keeping visual search snippet:
import base64
from typing import Any
from ikea_api.api import API
from ikea_api_wrapped import parse_item_codes
class VisualSearch(API):
def __init__(self):
super().__init__(
token=None, # type: ignore
endpoint="https://visual-intelligence.ikea.net/visual-search/v3/public/image",
)
self._session.headers["X-Client-Id"] = "AIzaSyBX8RsOkAzdfM1WW0ZiHVG8q7coOdowdXk"
def _encode_image(self, image_url: str):
image = self._session.get(image_url).content
return base64.b64encode(image).decode()
def _get_response(self, image: str) -> dict[str, Any]:
payload = {
"jobs": [
{
"base64": image,
"features": [
{
"type": "search",
"saveImage": False,
"includeIdentify": True,
"maxResults": 1,
}
],
}
]
}
return self._call_api(data=payload)
def _parse_response(self, resp: dict[str, Any]):
raw_item_code: str = resp["results"][0]["search"][0]["products"][0]["globalId"]
return parse_item_codes(raw_item_code)[0]
def __call__(self, image_url: str) -> Any:
image = self._encode_image(image_url)
resp = self._get_response(image)
return self._parse_response(resp)
test_url = "https://www.ikea.com/ru/ru/images/products/malm-komod-s-6-yashchikami-belyy__0484884_pe621348_s5.jpg?f=xxxl"
items = VisualSearch()(test_url)
print(items)
from comfort.
Related Issues (20)
- Popups bug
- feat: Warehouse management
- perf, feat: Add DocTypes to Global Search HOT 1
- perf: Use frappe.read_only() HOT 1
- Add Scheduled Job for updating item info HOT 1
- Use enum in ikea_api for fetch_items_specs
- Make fixture for Currency because Currency symbol not working on fresh install HOT 1
- Dependabot not working with setup.cfg
- Make replacement for “bench update” that takes required version of frappe and installs it and not the latest one HOT 1
- Waiting list HOT 1
- Handle internal Order Capture error
- Mailing doctype HOT 1
- Auto commission for friends HOT 1
- Delivery Trip: Delivery type priority resolving works
- Dark theme for Driver mode
- Change Delivery to Apartment default rate to 400 ₽
- Sometime links to Yandex Maps go to weird places
- Money transfers (ERPNext's Journal Entry equivalent)
- Fix text alignment in Stock Balance report
- Use profiles in compose file for site creation, database migrations etc
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from comfort.