Vincario VIN Decoder API Services avatar
Vincario VIN Decoder API Services

Pricing

Pay per usage

Go to Store
Vincario VIN Decoder API Services

Vincario VIN Decoder API Services

Developed by

Vincario

Vincario

Maintained by Community

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 debugging
RUN 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 imports
9// read more about this here: https://nodejs.org/docs/latest-v18.x/api/esm.html#mandatory-file-extensions
10// 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 code
24 */
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 t4
6 }
7
8 var _cvtHex = function (val) {
9 var str = ''
10 var i
11 var v
12
13 for (i = 7; i >= 0; i--) {
14 v = (val >>> (i * 4)) & 0x0f
15 str += v.toString(16)
16 }
17 return str
18 }
19
20 var blockstart
21 var i, j
22 var W = new Array(80)
23 var H0 = 0x67452301
24 var H1 = 0xEFCDAB89
25 var H2 = 0x98BADCFE
26 var H3 = 0x10325476
27 var H4 = 0xC3D2E1F0
28 var A, B, C, D, E
29 var temp
30
31 // utf8_encode
32 str = unescape(encodeURIComponent(str))
33 var strLen = str.length
34
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 = 0x080000000
47 break
48 case 1:
49 i = str.charCodeAt(strLen - 1) << 24 | 0x0800000
50 break
51 case 2:
52 i = str.charCodeAt(strLen - 2) << 24 | str.charCodeAt(strLen - 1) << 16 | 0x08000
53 break
54 case 3:
55 i = str.charCodeAt(strLen - 3) << 24 |
56 str.charCodeAt(strLen - 2) << 16 |
57 str.charCodeAt(strLen - 1) <<
58 8 | 0x80
59 break
60 }
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 = H0
80 B = H1
81 C = H2
82 D = H3
83 E = H4
84
85 for (i = 0; i <= 19; i++) {
86 temp = (_rotLeft(A, 5) + ((B & C) | (~B & D)) + E + W[i] + 0x5A827999) & 0x0ffffffff
87 E = D
88 D = C
89 C = _rotLeft(B, 30)
90 B = A
91 A = temp
92 }
93
94 for (i = 20; i <= 39; i++) {
95 temp = (_rotLeft(A, 5) + (B ^ C ^ D) + E + W[i] + 0x6ED9EBA1) & 0x0ffffffff
96 E = D
97 D = C
98 C = _rotLeft(B, 30)
99 B = A
100 A = temp
101 }
102
103 for (i = 40; i <= 59; i++) {
104 temp = (_rotLeft(A, 5) + ((B & C) | (B & D) | (C & D)) + E + W[i] + 0x8F1BBCDC) & 0x0ffffffff
105 E = D
106 D = C
107 C = _rotLeft(B, 30)
108 B = A
109 A = temp
110 }
111
112 for (i = 60; i <= 79; i++) {
113 temp = (_rotLeft(A, 5) + (B ^ C ^ D) + E + W[i] + 0xCA62C1D6) & 0x0ffffffff
114 E = D
115 D = C
116 C = _rotLeft(B, 30)
117 B = A
118 A = temp
119 }
120
121 H0 = (H0 + A) & 0x0ffffffff
122 H1 = (H1 + B) & 0x0ffffffff
123 H2 = (H2 + C) & 0x0ffffffff
124 H3 = (H3 + D) & 0x0ffffffff
125 H4 = (H4 + E) & 0x0ffffffff
126 }
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 folders
apify_storage
crawlee_storage
storage
# installed files
node_modules
# git folder
.git

.editorconfig

root = true
[*]
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf

.eslintrc

{
"extends": "@apify",
"root": true
}

.gitignore

# This file tells Git which files shouldn't be added to source control
.DS_Store
.idea
node_modules
storage
# 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"
}