Playwright හි ප්රොක්සියක් සකසන ආකාරය (Browser සහ Per-Context Auth)
Updated:
Playwright මඟින් Chromium, Firefox සහ WebKit හරහා කිසිදු බ්රවුසර දිගුවක් හෝ තෙවන පාර්ශ්වීය wrappers අවශ්යතාවයකින් තොරව සෘජුවම HTTP ප්රොක්සි authentication (server, username, password) සඳහා සහාය දක්වයි. ඊටත් වඩා, Playwright හි Per-Context Proxy විශේෂාංගය මඟින් තනි බ්රවුසර instance එකකට හුදකලා වූ BrowserContext සැසි දුසිම් ගණනක් ධාවනය කිරීමට ඉඩ සලසන අතර, ඒ සෑම එකක්ම තමන්ගේම VinaProxy ස්ථාවර IP එකක් සමඟ සම්බන්ධ වේ.
proxy={ server: 'http://ip:port', username: 'user', password: 'pass' }- IP 1₫40,000
- IP 5+₫35,000
- IP 10+₫25,000
- IP 20+₫25,000
- IP 50+₫25,000
- IP 100+₫25,000
- IP 200+₫25,000
- IP 500+₫25,000
- IP 1000+₫22,000
- IP 2000+₫20,000
- IP 1₫50,000
- IP 3+₫40,000
- IP 5+₫40,000
- IP 10+₫32,000
- IP 50+₫30,000
- IP 100+₫30,000
- IP 200+₫30,000
- IP 500+₫25,000
Playwright ප්රොක්සි object වින්යාසය
proxy වින්යාස object එක chromium.launch({ proxy }) හි ගෝලීයව හෝ browser.newContext({ proxy }) හි එක් එක් සැසියට වෙන වෙනම ලබා දෙන්න:
| Playwright Key | අගය ආකෘතිය | තාක්ෂණික සටහන |
|---|---|---|
server | 'http://ip:port' | Host සහ port පමණි, http:// සමඟින් මුලට එක් කෙරේ |
username | 'user' | ඔබගේ VinaProxy ප්රොක්සි username එක |
password | 'pass' | ඔබගේ VinaProxy ප්රොක්සි password එක (HTTP 407 හි ස්වදේශීයවම හසුරුවනු ලැබේ) |
bypass | 'localhost,127.0.0.1' | ප්රොක්සිය මඟහරින (bypass කරන), කොමාවලින් වෙන් කළ විකල්ප hosts |
බහු-IP BrowserContexts කාර්යක්ෂමව ධාවනය කිරීම
- Windows සහ macOS මත, තනි
browser.newContext()ඇමතුම් තුළproxyoverride කිරීමට බලාපොරොත්තු වන සෑම විටමchromium.launch()තුළ placeholder එකක් ලෙසproxy: { server: 'http://per-context' }ලබා දෙන්න - headers සහ JS
IntlAPIs ප්රොක්සි රට සමඟ ගැළපෙන පරිදි ඔබගේ ප්රොක්සිය සමඟbrowser.newContext()තුළtimezoneIdසහlocaleසකසන්න - scraping වේගවත් කිරීම සඳහා
page.route()මඟින් අනවශ්ය පින්තූර සහ font ඉල්ලීම් නවත්වන්න
පියවරෙන් පියවර
- 1
ip, port, username සහ password ලබා ගන්න
VinaProxy dashboard එකෙන් ඔබගේ
ip:port:user:passcredentials පිටපත් කරගන්න. - 2
proxy object එක newContext() වෙත ලබා දෙන්න
const context = await browser.newContext({ proxy: { server: 'http://ip:port', username: 'user', password: 'pass' } })අමතන්න. - 3
timezoneId සහ locale ගැළපෙන සේ සකසන්න
ඔබගේ ප්රොක්සි ස්ථානයට ගැළපෙන පරිදි
timezoneIdසහlocaleඇතුළත් කරන්න (උදා:America/New_YorkහෝAsia/Ho_Chi_Minh). - 4
නව පිටුවක exit IP එක තහවුරු කරන්න
const page = await context.newPage()විවෘත කරhttps://vinaproxy.com/api/my-ipවෙත ඉල්ලීමක් යවන්න.
නිතර අසන ප්රශ්න
Playwright විසින් 'Proxy is only supported when browser is launched with a proxy' යන දෝෂය දැක්වූයේ ඇයි?
Windows සහ macOS මත, Chromium මඟින් per-context overrides ඉඩ දීමට පෙර ගෝලීය launch proxy flag එකක් අවශ්ය වේ. chromium.launch({ proxy: { server: 'http://per-context' } }) සමඟ බ්රවුසරය ආරම්භ කර, එක් එක් browser.newContext({ proxy }) වෙත සැබෑ ප්රොක්සිය ලබා දෙන්න.
VinaProxy ප්රොක්සි Playwright Firefox සහ WebKit සමඟද ක්රියා කරයිද?
ඔව්. Chromium, Firefox සහ WebKit හරහා Node.js සහ Python යන දෙකෙහිම හරියටම එකම proxy: { server, username, password } syntax එක ක්රියා කරයි.
headless Playwright බ්රවුසර ධාවනය කිරීමේදී bandwidth සීමා කර තිබේද?
නැත. සියලුම VinaProxy Dedicated IPv4 සහ Static ISP සැලසුම් සඳහා අසීමිත මාසික traffic ඇතුළත් වේ.
Dedicated static IP සමඟ Playwright BrowserContexts පරිමාණය කරන්න
ගෝලීය ස්ථාන 7ක් හරහා ක්ෂණික අසීමිත HTTP(S) ප්රොක්සි.
Playwright ප්රොක්සි මිලදී ගන්න