Urgent.News

What's breaking now, across thousands of outlets.

Tech

Isolando sessões de navegador com Playwright em Python (a ideia por trás dos perfis antidetect)

Quem vende online acaba com várias contas abertas: loja, anúncios, marketplace. No mesmo Chrome, cookie e login se misturam. Navegador antidetect resolve isso com perfis isolados. Dá pra entender a ideia em 20 linhas de Python. O que vamos fazer Abrir dois "perfis" com Playwright, cada um com cookies, idioma, fuso, user agent e tela próprios, e confirmar que um não enxerga o outro. Instalação pip…

Local vendors often run multiple accounts on platforms like shops, ads, or marketplaces. When using a single browser like Chrome, cookies and login information get mixed together. An antidetect browser resolves this issue with isolated profiles. You can grasp the concept in just 20 lines of Python.

To begin, launch two profiles using Playwright, each with its own cookies, language, timezone, user agent, and screen resolution. Confirm that one profile cannot see the other.

Install Playwright by running `pip install playwright` and then install Chromium with `playwright install chromium`. The code is as follows:

```python

from playwright.sync_api import sync_playwright

with sync_playwright() as p:

b = p.chromium.launch()

a = b.new_context(

user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/124 Safari/537.36",

locale="pt-BR",

timezone_id="America/Sao_Paulo",

viewport={"width": 1366, "height": 768}

)

c = b.new_context(

user_agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/124 Safari/537.36",

locale="en-US",

timezone_id="America/New_York",

viewport={"width": 1440, "height": 900}

)

for name, ctx in (("A", a), ("B", c)):

pg = ctx.new_page()

ctx.add_cookies([

{

"name": "conta",

"value": name,

"url": "http://localhost:8765"

}

])

pg.goto("http://localhost:8765")

print(name, pg.evaluate("[navigator.language, Intl.DateTimeFormat().resolvedOptions().timeZone, screen.width]"), [x["value"] for x in ctx.cookies()])

b.close()

```

Before running the code, start a local server, such as `python3 -m http.server 8765`. The output should look like this:

```

A ['pt-BR', 'America/Sao_Paulo', 1366] ['A']

B ['en-US', 'America/New_York', 1440] ['B']

```

Each context has its own cookies and identity, with no one seeing the other's information. This solution provides basic isolation. A true antidetect browser handles dozens of signals, such as canvas, WebGL, and fonts, and allows you to open profiles through an interface without writing code. However, keep in mind that no tool authorizes violating platform rules.

Many shops prohibit duplicate accounts, so always read their terms. If you don't want to code, consider GoLogin, which offers a free plan with 3 profiles and 7 days of testing. Check their pricing page here: https://go.nowto.link/gologin. For more content in Portuguese, visit my newsletter: https://nuvemdev.substack.com. Some links are affiliate links: if you purchase, I may earn a commission with no extra cost to you.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Learning SQL on a Smartphone: My Journey to Becoming a Data Analyst Without a Laptop

Why I Refuse To Wait Until Graduation To Start Building My Future In Tech My name is Bassey. I'm a 300-level Microbiology student at the University of Uyo, Akwa Ibom State, Nigeria.

  • Bassey, a Microbiology student, aims for a tech career despite no laptop
  • Uses smartphone to learn SQL via Mimo, SQLBolt, SQLZoo, DataLemur
  • Seeks laptop donation to advance data analytics skills

Add Local Developer Utilities to Any MCP Assistant with DevUtils

AI assistants are useful at translating intent into actions, but small developer utilities are an easy place for an agent to guess.

  • DevUtils MCP Server offers 36 local developer utilities.
  • Install v1.1.0 using npx command configuration.
  • Server operates via stdio with JSON-RPC messages.

Your Screenshots Are 38% Heavier Than They Need to Be: Converting to WebP in the Browser

Priya writes two tutorials a week. Each one carries eight to twelve screenshots. She is careful about code quality, careless about file size — and after eighteen months her blog has 600 images and a…

  • Priya's blog has 600 images, causing a growing hosting bill
  • 11 top network requests are her own screenshots, heavier than needed
  • WebP conversion via OnliTools could reduce hosting costs by 38%

An open map of Brazil's courts and prisons: 2,167 municipalities, one CSV, CC BY 4.0

If someone is arrested in a small Brazilian town, three questions come before anything else: which judicial district (comarca) does the town belong to, which courthouse handles the case, and which…

  • Brazilian lawyer creates open dataset mapping courts and prisons across 2,167 municipalities
  • Available under CC BY 4.0 license for free use and redistribution

**WEEK 4 DEV CHALLENGE - HALLOWEEN THEME - GHOST STORY GENERATOR:)**

👻 GhostWriter — Stories from Beyond the Machine This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine .

  • GhostWriter is AI-powered supernatural storytelling website
  • Users create eerie tales with narrative concepts and settings
  • Source code and deployment details available on GitHub

More from Saturday 31 October →