Skip to content

Commit

Permalink
docs: deprecate performance benchmarks, fix example
Browse files Browse the repository at this point in the history
  • Loading branch information
barjin committed Nov 16, 2022
1 parent 46c92e9 commit cad8638
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 66 deletions.
100 changes: 50 additions & 50 deletions .github/workflows/test-and-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,54 +105,54 @@ jobs:
run: xvfb-run --auto-servernum -- npm test
if: ${{ matrix.os == 'ubuntu-latest'}}

test_antibot:
name: Test antibot services (with badges)
if: ((github.ref == 'refs/heads/master') && (github.event_name == 'push'))
runs-on: ubuntu-latest
needs: [ build_and_test ]
steps:
- name: Checkout Source code
uses: actions/checkout@v3

- name: Cache Node Modules
uses: actions/cache@v3
with:
path: |
node_modules
key: cache-${{ github.run_id }}

- name: Turbo cache
id: turbo-cache
uses: actions/cache@v3
with:
path: .turbo
key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.job }}-${{ github.ref_name }}-
- name: Build
run: npm run ci:build
# test_antibot:
# name: Test antibot services (with badges)
# if: ((github.ref == 'refs/heads/master') && (github.event_name == 'push'))
# runs-on: ubuntu-latest
# needs: [ build_and_test ]
# steps:
# - name: Checkout Source code
# uses: actions/checkout@v3

# - name: Cache Node Modules
# uses: actions/cache@v3
# with:
# path: |
# node_modules
# key: cache-${{ github.run_id }}

# - name: Turbo cache
# id: turbo-cache
# uses: actions/cache@v3
# with:
# path: .turbo
# key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
# restore-keys: |
# turbo-${{ github.job }}-${{ github.ref_name }}-

# - name: Build
# run: npm run ci:build

- name: Install Playwright
run: npx playwright install --with-deps

- id: tests
run: |
echo "::set-output name=botd::$(xvfb-run --auto-servernum -- node $GITHUB_WORKSPACE/test/antibot-services/antibot.js botd)"
echo "::set-output name=creepjs::$(xvfb-run --auto-servernum -- node $GITHUB_WORKSPACE/test/antibot-services/antibot.js creepjs)"
- name: CreepJS badge
uses: RubbaBoy/BYOB@v1.3.0
with:
NAME: CreepJS
LABEL: 'CreepJS (chromium, linux)'
STATUS: ${{ steps.tests.outputs.creepjs }}
COLOR: 7900aa
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: BotD badge
uses: RubbaBoy/BYOB@v1.3.0
with:
NAME: BotD
LABEL: 'BotD (chromium, linux)'
STATUS: ${{ steps.tests.outputs.botd }}
COLOR: 0079AA
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Install Playwright
# run: npx playwright install --with-deps

# - id: tests
# run: |
# echo "::set-output name=botd::$(xvfb-run --auto-servernum -- node $GITHUB_WORKSPACE/test/antibot-services/antibot.js botd)"
# echo "::set-output name=creepjs::$(xvfb-run --auto-servernum -- node $GITHUB_WORKSPACE/test/antibot-services/antibot.js creepjs)"
# - name: CreepJS badge
# uses: RubbaBoy/BYOB@v1.3.0
# with:
# NAME: CreepJS
# LABEL: 'CreepJS (chromium, linux)'
# STATUS: ${{ steps.tests.outputs.creepjs }}
# COLOR: 7900aa
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: BotD badge
# uses: RubbaBoy/BYOB@v1.3.0
# with:
# NAME: BotD
# LABEL: 'BotD (chromium, linux)'
# STATUS: ${{ steps.tests.outputs.botd }}
# COLOR: 0079AA
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41 changes: 25 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,39 +36,48 @@ With the help of `fingerprint-suite` you can generate and inject browser fingerp

The following example shows how to use the fingerprinting tools to camouflage your Playwright-managed Chromium instance.

```javascript
const { chromium } = require('playwright');
```typescript
const { firefox } = require('playwright');
const { FingerprintGenerator } = require('fingerprint-generator');
const { FingerprintInjector } = require('fingerprint-injector');
const { FingerprintInjector } = require('fingerprint-injector');

(async () => {
const b = await chromium.launch({headless: false});
const ctx = await b.newContext();

const fingerprintGenerator = new FingerprintGenerator();

const browserFingerprintWithHeaders = fingerprintGenerator.getFingerprint({
devices: ['desktop'],
browsers: ['chrome'],
});

const fingerprintInjector = new FingerprintInjector();
const { fingerprint } = browserFingerprintWithHeaders;

const browser = await firefox.launch({ headless: false });

const fingerprint = fingerprintGenerator.getFingerprint({
'locales': ['cs-CZ'], // setup your desired fingerprint features
'operatingSystems': ['linux'],
// With certain properties, we need to inject the props into the context initialization
const context = await browser.newContext({
userAgent: fingerprint.userAgent,
locale: fingerprint.navigator.language,
viewport: fingerprint.screen,
});
await fingerprintInjector.attachFingerprintToPlaywright(ctx, fingerprint);

// Attach the rest of the fingerprint
await fingerprintInjector.attachFingerprintToPlaywright(context, browserFingerprintWithHeaders);

// ...and enjoy your undercover browser while using the browser context as usual!
const page = await ctx.newPage();
await page.goto("https://apify.com");
const page = await context.newPage();
// ... your code using `page` here
})();
```

## Performance
<!-- ## Performance
With ever-improving performance of antibot fingerprinting services, we use some of the industry-leading services to benchmark our performance.
The following table shows how is the latest build of `fingerprint-suite` doing in tests provided by various open-source fingerprinting services.
The performace is evaluated using school-like grades (A being the best, F being the worst).
|Service|Grade|
|---|---|
|BotD |![](https://byob.yarr.is/apify/fingerprint-suite/BotD) |
|CreepJS |![](https://byob.yarr.is/apify/fingerprint-suite/CreepJS)|
|CreepJS |![](https://byob.yarr.is/apify/fingerprint-suite/CreepJS)| -->

## Support

Expand All @@ -77,7 +86,7 @@ For questions, you can ask on [Stack Overflow](https://stackoverflow.com/questio

## Contributing

Your code contributions are welcome and you'll be praised to eternity!
Your code contributions are welcome and you'll be praised for eternity!
If you have any ideas for improvements, either submit an issue or create a pull request.
For contribution guidelines and the code of conduct,
see [CONTRIBUTING.md](https://github.com/apify/fingerprint-suite/blob/master/CONTRIBUTING.md).
Expand Down

0 comments on commit cad8638

Please sign in to comment.