himidori / golang-vk-api Goto Github PK
View Code? Open in Web Editor NEWMethods for VK API
License: GNU General Public License v3.0
Methods for VK API
License: GNU General Public License v3.0
Добрый день!
Нужна возможность самому делать запросы в частности
photos.getOwnerCoverPhotoUploadServer
Error:
$ go run vk-crawler
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x15e1f45]
goroutine 1 [running]:
github.com/himidori/golang-vk-api.NewVKClientWithToken(0xc000030070, 0x47, 0x0, 0x47, 0x0, 0xc000010728)
/Users/carter/go/pkg/mod/github.com/himidori/[email protected]/client.go:76 +0x105
main.init()
/Users/carter/go/src/vk-crawler/main.go:138 +0x578
exit status 2
When using the example for initialization with a token, a null pointer deference is raised (due to parsing nil to the TokenOptions parameter, which is later dereferenced in client.go before checking if TokenOptions is nil.
Example from Readme.md:
client, err := vkapi.NewVKClientWithToken("token", nil)
Error cause:
func NewVKClientWithToken(token string, options *TokenOptions) (*VKClient, error) {
vkclient := newVKClientBlank()
vkclient.Self.AccessToken = token
vkclient.Self.Lang = options.TokenLanguage // when options is nil, this is illegal
if options != nil {
if options.ValidateOnStart {
uid, err := vkclient.requestSelfID()
if err != nil {
return nil, err
}
vkclient.Self.UID = uid
if !options.ServiceToken {
if err := vkclient.updateSelfUser(); err != nil {
return nil, err
}
}
}
}
return vkclient, nil
}
Hope this help 👍
Cheers
Как я могу получить и отправить сообщение в беседу?
You left your secret keys in client.go
, please remove and reissue them.
IsFavorite returns bool and cannot be marshaled to int.
json: cannot unmarshal bool into Go struct field AttachmentVideo.items.attachments.video.is_favorite of type int
I will investigate it when I have some free time.
Приветствую, как можно обойти 2х факторную аутентификацию?
Где-то нужно писать обработчик (callback функцию) или что?
Тл
При использовании сервисного токена ваша библиотека падает с ошибкой:
panic: runtime error: index out of range
goroutine 1 [running]:
github.com/himidori/golang-vk-api.(*VKClient).isTokenValid(0xc0000e82c0, 0x6db5d2, 0x47, 0x0, 0x0)
/home/nomadic/go/src/github.com/himidori/golang-vk-api/client.go:116 +0x84a
github.com/himidori/golang-vk-api.NewVKClientWithToken(0x6db5d2, 0x47, 0xd0, 0x6a1a60, 0xc000080c01)
/home/nomadic/go/src/github.com/himidori/golang-vk-api/client.go:73 +0x86
Почему-то ВК для сервисного ключа при вызове https://api.vk.com/method/users.get возвращает пустой массив []
и вылетает ошибка при попытке получить данные пользователя в https://github.com/himidori/golang-vk-api/blob/master/client.go#L116
Можно это как-то обойти?
Как-то так например
if len(user) > 0 {
client.Self.UID = user[0].UID
client.Self.FirstName = user[0].FirstName
client.Self.LastName = user[0].LastName
client.Self.PicSmall = user[0].Photo
client.Self.PicMedium = user[0].PhotoMedium
client.Self.PicBig = user[0].PhotoBig
}
`type StickerAttachment struct {
ID int `json:"id"`
ProductID int `json:"product_id"`
Photo64 string `json:"photo_64"`
Photo128 string `json:"photo_128"`
Photo256 string `json:'photo_256"`
Photo352 string `json:"photo_352"`
Photo512 string `json:"photo_512"`
Width int `json:"width"`
Height int `json:"height"`
}вот здесь вместо двойной кавычки одинарная Photo256 string
json:'photo_256"`
Написал вк бота с этой либой, запушил в хероку, но он требует забиндить порт (Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch). Может кто помочь?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.