Skip to content

Commit

Permalink
🐛 Commented gzip header causing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
garaekz committed Feb 4, 2023
1 parent e488398 commit f4112bc
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions dist/clients/voyager.client.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/clients/voyager.client.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@garaekz/inscraper",
"version": "2.1.1",
"version": "2.1.2",
"description": "A LinkedIn voyager wrapper for scraping data from LinkedIn profiles. We'll be using Playwright as a fallback and for some other functionalities.",
"main": "dist/main.js",
"types": "dist/types/main.d.ts",
Expand Down
6 changes: 2 additions & 4 deletions src/clients/voyager.client.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { PageScreenshotOptions } from "playwright";
import { Education, Experience, GetProfileOptions, Profile } from "../types";
import { generateToken } from "../utils/tokengen.util";
import { createPlaywrightClient, PlaywrightClient } from "./playwright.client";

export class VoyagerClient {
#cookie: string;
Expand All @@ -13,7 +11,8 @@ export class VoyagerClient {
const token = generateToken();
this.#headers = new Headers();
this.#headers.append("accept", " application/vnd.linkedin.normalized+json+2.1");
this.#headers.append("accept-encoding", " gzip, deflate, br");
// TODO: Figure out gzip issue not decompressing
// this.#headers.append("accept-encoding", " gzip, deflate, br");
this.#headers.append("cookie", `li_at=${cookie}; JSESSIONID=\"ajax:${token}\";`);
this.#headers.append("csrf-token", `ajax:${token}`);
this.#slug = null;
Expand Down Expand Up @@ -91,7 +90,6 @@ export class VoyagerClient {
const data = await response.json();
const subExperience = data.included.find((item: any) => item.decorationType === 'NONE');
const experience = data.included.find((item: any) => item.decorationType === 'LINE_SEPARATED').components.elements.map((item: any) => this.#mapFullExperience(item, subExperience)).flat();
console.log(experience);

return experience;
}
Expand Down

0 comments on commit f4112bc

Please sign in to comment.