As the link Vkontakte to determine what kind of object it is?

Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
As the link Vkontakte to identify this object: photo, post on wall, comment, post, etc.?

References come from the browser. Opened a photo, or a product or writing on the wall. Copy the link and because it is necessary to obtain the object. For example, "photo1_456315566":
const obj = { ownerId:1, objectId:456315566, type:'photo'}
by | 14 views

1 Answer

0 like 0 dislike
Collect more link options, and there will be a guess! ; )
From documentation to messages.send():
photo — photography; video — video recording; audio — audio recording; doc — document; wall — write on the wall; market — product.

Upd. through the regular season:
parseVkLink function(link) { var re = new RegExp('(photo|video|audio|doc|wall|market)(\\\\d+)_(\\\\d+)'); var matches = link.match(re); if(matches) { return { type: matches[1], ownerId: matches[2], objectId: matches[3], }; } else { return false; } } var test = ''; JSON.stringify( parseVkLink(test) ) // {"type":"photo","ownerId":"1","objectId":"456315566"}
110,608 questions
257,187 answers
40,796 users