
Vincario VIN Decoder API Services
Pricing
Pay per usage
Go to Store

Vincario VIN Decoder API Services
Powerful Vincario plugin to extract data from API responses. Download Vincario data as a JSON to enrich your own applications with a powerful vehicle data partner.
0.0 (0)
Pricing
Pay per usage
1
Total users
22
Monthly users
1
Runs succeeded
0%
Last modified
2 years ago
.actor/Dockerfile
# Specify the base Docker image. You can read more about# the available images at https://docs.apify.com/sdk/js/docs/guides/docker-images# You can also use any other image from Docker Hub.FROM apify/actor-node:18
# Copy just package.json and package-lock.json# to speed up the build using Docker layer cache.COPY package*.json ./
# Install NPM packages, skip optional and development dependencies to# keep the image small. Avoid logging too much and print the dependency# tree for debuggingRUN npm --quiet set progress=false \ && npm install --omit=dev --omit=optional \ && echo "Installed NPM packages:" \ && (npm list --omit=dev --all || true) \ && echo "Node.js version:" \ && node --version \ && echo "NPM version:" \ && npm --version \ && rm -r ~/.npm
# Next, copy the remaining files and directories with the source code.# Since we do this after NPM install, quick build will be really fast# for most source file changes.COPY . ./
# Run the image.CMD npm start --silent
.actor/actor.json
{ "actorSpecification": 1, "name": "vincario-vin-decoder-api-services", "title": "Empty JavaScript project", "description": "Empty project in JavaScript.", "version": "0.0", "buildTag": "latest", "meta": { "templateId": "js-empty" }, "dockerfile": "./Dockerfile", "input": "./input_schema.json", "storages": { "dataset": { "actorSpecification": 1, "views": { "overview": { "title": "Overview", "transformation": { "fields": [ "VIN" ] }, "display": { "component": "table", "properties": { "VIN": { "label": "Text", "format": "text" } } } } } } }}
.actor/input_schema.json
{ "title": "PlaywrightCrawler Template", "type": "object", "schemaVersion": 1, "properties": { "apiCall": { "title": "API Endpoints", "type": "string", "description": "Select API Service", "editor": "select", "default": "info", "enum": ["info", "decode", "stolen-check", "vehicle-market-value", "balance"], "enumTitles": ["VIN Decode Info", "VIN Decode", " VIN Stolen Check", "Vehicle Market Value", "Get balance"] }, "apiKey": { "title": "API Key", "type": "string", "description": "Request API Keys at https://vindecoder.eu/api/", "editor": "textfield" }, "apiSecret": { "title": "API Secret", "type": "string", "description": "Request API Keys at https://vindecoder.eu/api/", "editor": "textfield" }, "vin": { "title": "VIN", "type": "string", "description": "Vehicle Identification Number", "editor": "textfield" } }, "required": ["apiCall", "apiKey", "apiSecret"]}
.vscode/launch.json
{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "type": "node", "request": "launch", "name": "Launch Program", "skipFiles": [ "<node_internals>/**" ], "program": "${workspaceFolder}\\src\\main.js" } ]}
src/main.js
1// Apify SDK - toolkit for building Apify Actors (Read more at https://docs.apify.com/sdk/js/)2import { Actor, Dataset, KeyValueStore } from 'apify';3import {sha1} from './sha1.js'4import {vinDecoder} from './vindecoder.js'5// Crawlee - web scraping and browser automation library (Read more at https://crawlee.dev)6// import { CheerioCrawler } from 'crawlee';7
8// this is ESM project, and as such, it requires you to specify extensions in your relative imports9// read more about this here: https://nodejs.org/docs/latest-v18.x/api/esm.html#mandatory-file-extensions10// import { router } from './routes.js';11
12// The init() call configures the Actor for its environment. It's recommended to start every Actor with an init()13await Actor.init();14
15const {apiCall, apiKey, apiSecret, vin} = await Actor.getInput();16const result = await vinDecoder(apiKey,apiSecret,apiCall, vin); 17
18console.log(result);19await Dataset.pushData(result);20await KeyValueStore.setValue('OUTPUT', result);21
22/**23 * Actor code24 */25
26// Gracefully exit the Actor process. It's recommended to quit all Actors with an exit()27await Actor.exit();
src/sha1.js
1export const sha1 = (str) => {2
3 var _rotLeft = function (n, s) {4 var t4 = (n << s) | (n >>> (32 - s))5 return t46 }7 8 var _cvtHex = function (val) {9 var str = ''10 var i11 var v12 13 for (i = 7; i >= 0; i--) {14 v = (val >>> (i * 4)) & 0x0f15 str += v.toString(16)16 }17 return str18 }19 20 var blockstart21 var i, j22 var W = new Array(80)23 var H0 = 0x6745230124 var H1 = 0xEFCDAB8925 var H2 = 0x98BADCFE26 var H3 = 0x1032547627 var H4 = 0xC3D2E1F028 var A, B, C, D, E29 var temp30 31 // utf8_encode32 str = unescape(encodeURIComponent(str))33 var strLen = str.length34 35 var wordArray = []36 for (i = 0; i < strLen - 3; i += 4) {37 j = str.charCodeAt(i) << 24 |38 str.charCodeAt(i + 1) << 16 |39 str.charCodeAt(i + 2) << 8 |40 str.charCodeAt(i + 3)41 wordArray.push(j)42 }43 44 switch (strLen % 4) {45 case 0:46 i = 0x08000000047 break48 case 1:49 i = str.charCodeAt(strLen - 1) << 24 | 0x080000050 break51 case 2:52 i = str.charCodeAt(strLen - 2) << 24 | str.charCodeAt(strLen - 1) << 16 | 0x0800053 break54 case 3:55 i = str.charCodeAt(strLen - 3) << 24 |56 str.charCodeAt(strLen - 2) << 16 |57 str.charCodeAt(strLen - 1) <<58 8 | 0x8059 break60 }61 62 wordArray.push(i)63 64 while ((wordArray.length % 16) !== 14) {65 wordArray.push(0)66 }67 68 wordArray.push(strLen >>> 29)69 wordArray.push((strLen << 3) & 0x0ffffffff)70 71 for (blockstart = 0; blockstart < wordArray.length; blockstart += 16) {72 for (i = 0; i < 16; i++) {73 W[i] = wordArray[blockstart + i]74 }75 for (i = 16; i <= 79; i++) {76 W[i] = _rotLeft(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1)77 }78 79 A = H080 B = H181 C = H282 D = H383 E = H484 85 for (i = 0; i <= 19; i++) {86 temp = (_rotLeft(A, 5) + ((B & C) | (~B & D)) + E + W[i] + 0x5A827999) & 0x0ffffffff87 E = D88 D = C89 C = _rotLeft(B, 30)90 B = A91 A = temp92 }93 94 for (i = 20; i <= 39; i++) {95 temp = (_rotLeft(A, 5) + (B ^ C ^ D) + E + W[i] + 0x6ED9EBA1) & 0x0ffffffff96 E = D97 D = C98 C = _rotLeft(B, 30)99 B = A100 A = temp101 }102 103 for (i = 40; i <= 59; i++) {104 temp = (_rotLeft(A, 5) + ((B & C) | (B & D) | (C & D)) + E + W[i] + 0x8F1BBCDC) & 0x0ffffffff105 E = D106 D = C107 C = _rotLeft(B, 30)108 B = A109 A = temp110 }111 112 for (i = 60; i <= 79; i++) {113 temp = (_rotLeft(A, 5) + (B ^ C ^ D) + E + W[i] + 0xCA62C1D6) & 0x0ffffffff114 E = D115 D = C116 C = _rotLeft(B, 30)117 B = A118 A = temp119 }120 121 H0 = (H0 + A) & 0x0ffffffff122 H1 = (H1 + B) & 0x0ffffffff123 H2 = (H2 + C) & 0x0ffffffff124 H3 = (H3 + D) & 0x0ffffffff125 H4 = (H4 + E) & 0x0ffffffff126 }127 128 temp = _cvtHex(H0) + _cvtHex(H1) + _cvtHex(H2) + _cvtHex(H3) + _cvtHex(H4)129 return temp.toLowerCase()130 }
src/vindecoder.js
1import got from 'got'2import {sha1} from './sha1.js'3
4export const vinDecoder = async (apiKey, secretKey, id, vin = null) => {5
6 let apiPrefix = "https://api.vindecoder.eu/3.2";7 let action = (id === "info") ? "decode/info" : id;8
9 let hash = sha1((vin ? vin + '|' : '') + id + '|' + apiKey + '|' + secretKey).substring(0, 10);10 let path = apiPrefix + '/' + apiKey + '/' + hash + '/' + action + (vin ? '/' + vin : '') + '.json';11
12 return await got({url:path}).json();13
14 return new Promise((resolve, reject) => {15 https.get(path, (resp) => {16 let data = '';17
18 resp.on('data', (chunk) => {19 data += chunk;20 });21
22 resp.on('end', () => {23 resolve(data)24 });25
26 }).on("error", (err) => {27 reject(err);28 });29 });30}
.dockerignore
# configurations.idea
# crawlee and apify storage foldersapify_storagecrawlee_storagestorage
# installed filesnode_modules
# git folder.git
.editorconfig
root = true
[*]indent_style = spaceindent_size = 4charset = utf-8trim_trailing_whitespace = trueinsert_final_newline = trueend_of_line = lf
.eslintrc
{ "extends": "@apify", "root": true}
.gitignore
# This file tells Git which files shouldn't be added to source control
.DS_Store.ideanode_modulesstorage
# Added by Apify CLI.venv
package.json
{ "name": "vindecoder", "version": "0.0.1", "type": "module", "description": "This is a boilerplate of an Apify Actor.", "engines": { "node": ">=18.0.0" }, "dependencies": { "apify": "^3.1.10", "crawlee": "^3.5.4", "got": "^13.0.0" }, "scripts": { "start": "node ./src/main.js", "lint": "./node_modules/.bin/eslint ./src --ext .js,.jsx", "lint:fix": "./node_modules/.bin/eslint ./src --ext .js,.jsx --fix", "test": "echo \"Error: oops, the actor has no tests yet, sad!\" && exit 1" }, "author": "It's not you it's me", "license": "ISC"}