Skip to content

Commit

Permalink
Merge pull request #9 from djackreuter/add_jitter
Browse files Browse the repository at this point in the history
Add jitter
  • Loading branch information
l4rm4nd authored Mar 12, 2024
2 parents 7ff9c32 + f00c8fd commit 5f56511
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ LinkedInDumper talks with the unofficial LinkedIn Voyager API, which requires au
## 🎓 Usage

````
usage: linkedindumper.py [-h] --url <linkedin-url> [--cookie <cookie>] [--quiet] [--include-private-profiles] [--email-format EMAIL_FORMAT]
usage: linkedindumper.py [-h] --url <linkedin-url> [--cookie <cookie>] [--quiet] [--include-private-profiles] [--jitter] [--email-format EMAIL_FORMAT]
options:
-h, --help show this help message and exit
Expand All @@ -45,7 +45,9 @@ options:
--quiet Show employee results only
--include-private-profiles
Show private accounts too
--email-format Python string format for emails; for example:
--jitter Add a random jitter to HTTP requests
--email-format EMAIL_FORMAT
Python string format for emails; for example:
--email-format '{0}.{1}@example.com' --> [email protected]
--email-format '{0[0]}.{1}@example.com' --> [email protected]
--email-format '{1}@example.com' --> [email protected]
Expand Down
8 changes: 8 additions & 0 deletions linkedindumper.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import requests
import random
import json
import re
import argparse
Expand Down Expand Up @@ -29,6 +30,7 @@
parser.add_argument("--cookie", metavar='<cookie>', help="LinkedIn 'li_at' session cookie", type=str, required=False,)
parser.add_argument("--quiet", help="Show employee results only", required=False, action='store_true')
parser.add_argument("--include-private-profiles", help="Show private accounts too", required=False, action='store_true')
parser.add_argument("--jitter", help="Add a random jitter to HTTP requests", required=False, action='store_true')
parser.add_argument("--email-format", help="Python string format for emails; for example:"+format_examples, required=False, type=str)

args = parser.parse_args()
Expand Down Expand Up @@ -151,6 +153,11 @@ def show(j):
employee_dict = []
# paginate API results
for page in progressbar(range(required_pagings), "Progress: ", 40):
if args.jitter:
jitter_dict = [0.5, 1, 0.8, 0.3, 3, 1.5, 5]
jitter = random.randrange(0, len(jitter_dict) - 1)
time.sleep(jitter)

api2 = "https://www.linkedin.com/voyager/api/search/dash/clusters?decorationId=com.linkedin.voyager.dash.deco.search.SearchClusterCollection-165&origin=COMPANY_PAGE_CANNED_SEARCH&q=all&query=(flagshipSearchIntent:SEARCH_SRP,queryParameters:(currentCompany:List(" + str(companyID) + "),resultType:List(PEOPLE)),includeFiltersInResponse:false)&count=" + str(paging_count)+ "&start=" + str(page*10)
# retrieve employee information from the api based on previously obtained company id
r2 = requests.get(api2, headers=headers, cookies=cookies_dict)
Expand Down Expand Up @@ -263,3 +270,4 @@ def show(j):
print()
print("[!] Invalid URL provided.")
print("[i] Example URL: 'https://www.linkedin.com/company/apple'")

0 comments on commit 5f56511

Please sign in to comment.