mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-04-20 23:23:56 +03:00
randomize User-Agent
The VBB endpoint blocks all requests with the exact User-Agent of "https://github.com/public-transport/hafas-client".
This commit is contained in:
parent
b6c530915f
commit
d54c26d9be
1 changed files with 3 additions and 1 deletions
|
@ -9,6 +9,8 @@ const {stringify} = require('query-string')
|
|||
const Promise = require('pinkie-promise')
|
||||
const {fetch} = require('fetch-ponyfill')({Promise})
|
||||
|
||||
const clientId = Math.random().toString(16).substr(2, 10)
|
||||
|
||||
const md5 = input => createHash('md5').update(input).digest()
|
||||
|
||||
const request = (profile, data) => {
|
||||
|
@ -21,7 +23,7 @@ const request = (profile, data) => {
|
|||
'Content-Type': 'application/json',
|
||||
'Accept-Encoding': 'gzip, deflate',
|
||||
'Accept': 'application/json',
|
||||
'user-agent': 'https://github.com/public-transport/hafas-client'
|
||||
'user-agent': clientId + ' https://github.com/public-transport/hafas-client'
|
||||
},
|
||||
query: {}
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue