To begin with, this is what the group header is:
enter image description here
The API documentation says absolutely nothing about downloading. Outings through unofficial clients no longer help, because in them this is not implemented (a reference to this question ). By viewing the requests, I found that the call signature does not look like more than one method / file upload method specified here . So, what I was able to discover from requests:

  1. Each file uploaded to the header has a _sig . It strangely changes from request to request, but without it you cannot upload a file.
  2. If you catch requests for VC, then we get a static link to download the file. This static link works quite well and when you go to it, it says:

    {"error":"ERR_UPLOAD_FILE_NOT_UPLOADED: file not found","bwact":"owner_cover","server":836521,"mid":151665536,"_sig":"83447078c5079124026b80d90f116398"} 

However, after loading the code, we get:

 {"error":"ERR_UPLOAD_BAD_SIGNATURE","bwact":"owner_cover","server":836521,"_sig":"d762c16dc795c4f65b59aafdaa39628a"} 
  1. The method used by VK (usually the method is visible in the act parameter. Suppose, when loading an audio message , there was add_doc ), it is not in the documentation and looks like this: act = owner_cover .
  • one
    This feature with a cap in groups appeared relatively recently, it seems to me that the API has not yet been added - tCode
  • 2
    Well, maybe ... But you can still try to find a way out. For now all that they do - the API does not go. The exception is advertising. Money is necessary to cut ... - Flerry
  • Is there a ready-made free solution? Does this not violate VC policy? - Sergey Breslavets
  • one
    @ Sergey Breslavets If you want to ask a new question, post it exactly as a question. Well, it is better to search about VK policy in their user agreement. - Nick Volynkin

2 answers 2

Hooray! Hooray! Hooray! The question has been resolved again :) True, I will immediately say, gentlemen, that here it is much more difficult than what I decided before - tyk .
Attention : we will make all requests with cookies. Without them - no way.
In general, let's go:

  1. We get a link to download our carpet (in VK the header is called cover) :

    • We make the request here: https://vk.com/al_page.php
    • In headers we attach our cookies
    • We write this in the body of the POST request: act=owner_photo_box&al=1&cover=1&oid=-id вашей группы
    • If everything went well, we get about this page in response: enter image description here
    • At the end of the page there will be links. We need the first one (comes immediately after OwnerPhoto.uploadInit ). See screenshot: enter image description here
      Our link turned out to be this: https:\/\/pu.vk.com\/c837731\/upload.php?act=owner_cover&oid=-136618761&square=&mid=151665536&server=837731&_origin=https%3A%2F%2Fvk.com&_sig=c55042259e8ee7c612cdcd9861961cdf
  2. We upload our photos to VK servers using the link obtained in the previous paragraph :

    How to upload a file in multipart / form-data format I described here (the standard Java library) or much shorter and more beautifully can be downloaded using the OkHttp library - the process is described here .
    ATTENTION: now VK accepts pictures only with the file field in the post-request! So (here in Java) - multipart.addFilePart ("file", uploadFile1);
    If the picture is in a field with a different name, you will receive the following error:

    {"error": "ERR_UPLOAD_FILE_NOT_UPLOADED: file not found", "bwact": "owner_cover", "server": 638219, "mid": 151665536, "_ sig": "9417bfeb4cca32304ed587818dd191931"}

In response, we will receive a description of our pictures in this format:

 `{"oid":"-136618761","photo":{"photo":"6fae155614x","sizes":[["x","837731536","18af4","9lzKWBYrE2w",795,1060],["y","837731536","18af5","8knjXW2i2K8",810,1080],["o","837731536","18af6","-w20s8JJGNA",810,1080]],"kid":"9d20ccbaa7b6ec6d7171716dcd5bade1","debug":"xxoyooo"},"x_src":"v837731536\/18af4\/9lzKWBYrE2w.jpg","x_size":[795,1060],"size":[810,1080],"bwact":"owner_cover","server":837731,"mid":151665536,"_sig":"fe9a46f1b2e26f4a1c56bbc36850a10e"}` 
  1. Save our work of art :

    • We take the first part of our link, obtained in the first paragraph with the server number, and substitute to it act = owner_cover_crop & _query = and the description of our photo , obtained from the point above. In our case it looks like this:

    https://pu.vk.com/c837731/upload.php?act=owner_cover_crop&_query={"oid":"-136618761","photo":{"photo":"2b522d8e86x","sizes":[["x","837731536","18aa5","tuY07_54Ovk",795,497],["y","837731536","18aa6","RxPs7YD5hCs",1590,994],["o","837731536","18aa7","nmZ4LwQDbgw",2880,1800]],"kid":"621fad611afefb9048b478bcc627ab12","debug":"xxoyooo"},"x_src":"v837731536\/18aa5\/tuY07_54Ovk.jpg","x_size":[795,497],"size":[2880,1800],"bwact":"owner_cover","server":837731,"mid":151665536,"_sig":"efb64dcfd413f8e1cd52c86c9ffe98d6"}
    This is our URL, which will be accessed.

    • Be sure to insert our cookies into the header.
    • The answer is:

    {"oid":"-136618761","data":["xAAzIYwAAAAAx7sTQAAGK9PZcylgWKxNsYAAGK9fJJ411totivOAAGK9vsNtLPCSRjQAAAGK91LwRyB-lQoPBAAGK-LTMIdOtvbDACAAGK-W1AR45kIrfADAAGK-n6SOgL5ttKpEAAGK-6ApZsVYFCSa","0,0,795,200",0,"810,1080","795,1060"],"bwact":"owner_cover_crop","server":837731,"mid":151665536,"_sig":"7e008ee2a25eaafe4921763ee3b3691d"}

  2. We force VK to obey and insert our long-suffering picture into the header :

    • We make a request to this address: https://vk.com/al_page.php
    • Be sure to insert cookies into headers
    • Insert the line obtained in the paragraph above into the body of the POST request and add _query = before it, followed by & act = owner_photo_save & al = 1 & from = groups . The body will look like this:

    _query={"oid":"-136618761","data":["xAAzIYwAAAAAx7sTQAAGKnqTNf2fQ6fuoYAAGKn3Z9dX-ImPaLOAAGKoG1FCgvWBDhHAAAGKqJRsM9D7RwUzBAAGKqWp6mu7odOTZCAAGKqsVKNMJ80uh9DAAGKq99X4PZhrf1wEAAGKrFjQIUH8hRcw","0,536,2880,724",0,"2880,1800","795,497"],"bwact":"owner_cover_crop","server":837731,"mid":151665536,"_sig":"3aeeb1dff8888aed8bf8f65c91568bb0"}&act=owner_photo_save&al=1&from=groups

Watch the resolution of the photo when you upload it. If it doesn’t fit, VK will begin to cut, but you can specify dimensions in requests (I think it’s clear where and how). In general, VK recommends 1590 × 400 ...

Thanks for attention! I hope someone helped ...

  • one
    But one day it all breaks down) - andreymal
  • @andreymal Vryatli. Unless the API appears. - Flerry

Recently there were API methods for this:

Call the first method (there we are asked to select an area for trimming, if you specify not proportional to 795x200, the top of the selected area will be cut out), load the file using the received link, transfer the received hash and photo to the second method - the header is updated.