First experience of using API.hh.ru

Version 1.03 // Yes, there is not enough versioning of articles on Habré. Comments help make improvements to the article.



Good afternoon.



A couple of years ago, in the headhunter's support (hh.ru) I threw a proposal to make an additional search option for key skills in addition to the three available ones (in the job title, in the company name, in the job description). I was told that there are more proposals for improving the service than darkness, so dosvidos. The result is this research ...



I found out about api.hh.ru and decided to start making a parser in Excel, so that the result is somehow visually easier to analyze. The API dock at github.com/hhru/api is fine, so you can work. First of all, I decided to analyze the Key Skills Reference (key_skills). While he was stretching, it turned out that the first thousand and a half are the standard introduced by default. And the rest of the confusion and wobbling, I stopped at 13,000 and dropped the load. It is clear, we need to go to the parser.



I made the first conclusion of the data as follows:



image



I did not think of how to use it. Therefore, I decided to do it like in an RDBMS and then make a pivot table for filtering. And now the conclusion is:



image



Immediately lay out the code and in order.



Sub vvv()
    Dim http
    Set http = CreateObject("WinHttp.WinHttpRequest.5.1")
    timeout = 2000 'milliseconds
    http.setTimeouts timeout, timeout, timeout, timeout
    http.Option(2) = 0 '   65001     utf-8
    Dim url_ As String
    url0 = "https://api.hh.ru/vacancies?text=NAME:() and DESCRIPTION:(NOT intermediate)&area=1&only_with_salary=true&no_magic=true&salary=100000&currency_code=RUR&period=30&label=not_from_agency&order_by=publication_time"
    http.Open "get", url0
    http.send
    text = http.responseText
    If InStr(text, "errors") > 0 Then
        Debug.Print text
        Stop
    Else
        If text <> "" Then
            Set qwe = JsonConverter.ParseJson(text)
        End If
    End If
    CountV = qwe("found")
    CountP = qwe("pages")
    isk = 1
On Error GoTo AfterSk
    For pg = 1 To CountP
        If pg > 1 Then
            url_ = url0 & "&page=" & pg
            http.Open "get", url_
            http.send
            text = http.responseText
            Set qwe = JsonConverter.ParseJson(text)
        End If
        For i = 1 To 20
            ii = (pg - 1) * 20 + i
            Set Item = qwe("items")(i)
            url1 = Item("alternate_url")
            ThisWorkbook.Worksheets(2).Cells(ii + isk, 1) = Item("name")
            ThisWorkbook.Worksheets(2).Cells(ii + isk, 3) = url1
            ThisWorkbook.Worksheets(2).Cells(ii + isk, 1).Font.Bold = True
            ThisWorkbook.Worksheets(2).Cells(ii + isk, 1).Font.Size = 14
            ThisWorkbook.Worksheets(2).Cells(ii + isk, 3).Font.Bold = True
            url_ = Item("url")
            url_ = Replace(url_, "?host=hh.ru", "")
            http.Open "get", url_
            http.send
            text = http.responseText
            Set vak = JsonConverter.ParseJson(text)
            Set keySkills = vak("key_skills")
            CountSk = keySkills.Count
            If CountSk > 0 Then
                For jj = 1 To CountSk
                    If jj <> 1 Then isk = isk + 1
                    ThisWorkbook.Worksheets(2).Cells(ii + isk, 1) = Item("name")
                    ThisWorkbook.Worksheets(2).Cells(ii + isk, 2) = keySkills(jj)("name")
                    ThisWorkbook.Worksheets(2).Cells(ii + isk, 2).Font.Italic = True
                    ThisWorkbook.Worksheets(2).Cells(ii + isk, 3) = url1
                Next jj
'            Else
'                ThisWorkbook.Worksheets(2).Cells(2 + (ii - 1) * 3, 1) = vak("description")
'                ThisWorkbook.Worksheets(2).Cells(2 + (ii - 1) * 3, 1).Select
'                Rows("2 + (ii - 1) * 3:2 + (ii - 1) * 3").EntireRow.AutoFit
            End If
AfterSk:
        If Err.Number <> 0 Then
            'Stop
            Resume Next
            Err.Clear
        End If
            DoEvents
        Next i
    Next pg
    Stop
End Sub


The GET request is accepted in Cyrillic, and in the Activex component WinHttp.WinHttpRequest in the Option (2) property - the utf-8 code page (65001), so I spent some time on "why are not Russian letters in the request?" - replaced by 0.



Added a link to the vacancy in the output - it seems to be unique.



Made a pivot table.



And as you understand, a unique set of skills out of a thousand vacancies amounted to 1500, i.e. the same confusion and vacillation, so that the main goal "to find vacancies as close as possible to the skills indicated in my resume" seemed to have moved away from me.



I decided to count and choose my favorites something like this:



Spoiler header
skill;count

Git;546

JavaScript;458

SQL;283

MySQL;255

PostgreSQL;251

;197

Java;196

HTML;186

Linux;177

Python;164

C#;139

HTML5;131

MS SQL;120

REST;82

XML;61

.NET Framework;56

MVC;55

ASP.NET;51

MS SQL Server;49

.NET Core;24

Entity Framework;21

HTTP;20

MS Visual Studio;20

Rest API;18

TCP/IP;15

C ;13

LINQ;12

SQLite;12

WCF;11



In general, I will add a salary to the output and maybe something else, but the continuation of automation has stalled. Then use the handles Ctrl + C, search.



If there are ideas and suggestions, let's discuss and continue.



Note 1. I can't quickly master a foreign language to an intermediate level, and the maximum of vacancies issued by the API = 2 thousand by default, 20 per page, so the request in the code made this.



The json converter took from here github.com/VBA-tools/VBA-JSON .



For the JSON converter to work:

Open Excel and turn on the display of the Developer tab

Go to the Visual Basic Editor (in the Developer> Visual Basic ribbon).

Open the list of references: in the Tools> References ...

Check the Microsoft Scripting Runtime and Microsoft VBScript Regular Expressions 5.5. Click OK.



All. The world is changing - I am adapting. And you do not get sick.



PS:

In general, the article is not so much technical as about aspects of job search. I would like to see comments on how portals like hh can improve the use of some points.

For example, here are the key skills discussed in the article.

If in vacancies / resumes indicate the level of proficiency (Beginner, Intermediate, Senior) for each skill - this would help to improve the display of relevance in search results.



All Articles