I
I
Ivan Ivanov2016-12-12 16:03:28
PHP
Ivan Ivanov, 2016-12-12 16:03:28

How to parse lyrics from the site Vkontakte vk.com without using api in php without using phantomjs and the like?

I use curl, I log in to vk, I search for something like this
, I
https://vk.com/al_audio.php
send a POST request of such a plan to the URL

act=a_load_section&al=1&claim=0&offset=" . $offset . "&search_history=0&search_lyrics=0&search_performer=0&search_q=" . $_search . "&search_sort=0&type=search

a response comes, which I clean from garbage, translate json into an object using json_decode and get something like this at the output:
object(stdClass)#37 (10) {
  ["type"]=>
  string(6) "search"
  ["ownerId"]=>
  int(0)
  ["albumId"]=>
  NULL
  ["title"]=>
  string(38) "Поиск по запросу <strong>Ария</strong>"
  ["list"]=>
  array(49) {
    [0]=>
    array(14) {
      [0]=>
      string(8) "90036011"
      [1]=>
      string(8) "11793394"
      [2]=>
      string(0) ""
      [3]=>
      string(32) "Встань, страх преодолей&#33;    "
      [4]=>
      string(4) "Ария"
      [5]=>
      int(254)
      [6]=>
      int(0)
      [7]=>
      int(51137318)
      [8]=>
      string(0) ""
      [9]=>
      int(0)
      [10]=>
      int(9)
      [11]=>
      string(0) ""
      [12]=>
      string(2) "[]"
      [13]=>
      string(38) "2f2d0d91a243fd96de//1e7a2d19ea2165f8ff"
    }
    [1]=>
    array(14) {
      [0]=>
      string(9) "363229107"
      [1]=>
      string(9) "242306736"
      [2]=>
      string(0) ""
      [3]=>
      string(22) "А мы не ангелы, парень"
      [4]=>
      string(4) "Ария"
      [5]=>
      int(206)
      [6]=>
      int(0)
      [7]=>
      int(1952832)
      [8]=>
      string(53) "(<a href="/pohhu" class="mem_link">В. Скачинский</a>)"
      [9]=>
      int(0)
      [10]=>
      int(9)
      [11]=>
      string(0) ""
      [12]=>
      string(2) "[]"
      [13]=>
      string(38) "426645212c9caaff42//90db1cd1279669440d"
    }
...

The problem is that there is no lyrics_id to get the lyrics of the song, there are some numbers, for example 51137318 - but these are not lyrics_id, I checked it through api and looked in the browser - in fact, lyrics_id 4963240 for the song "Get up, overcome fear". That is, apparently, the lyrics_id is encrypted by javascript. How to find lyrics_id? Maybe someone has already solved a similar problem, I think now it will be relevant as an alternative in the light of the shutdown of vk audio api planned on December 16th. Thanks in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Aksentiev, 2016-12-12
@Sanasol

The first request to al_audio returns all the necessary data for the lyrics request, search better.
And in general, so that you don’t use the Internet xD
Why not parse texts from some text database? Why so perverted with VK?
Maybe somewhere there is even an API.
Why is the VK API not suitable? So is the search for music and the receipt of texts.

R
Roman, 2017-02-26
@daranger

you can parse for a fee through the service api.i.ws
AUDIO_ITEM_INDEX_LYRICS: 9

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question