View Source ExCrawlzy.Client.Handlers.BrowserClients (ExCrawlzy v0.1.1)

Module to add more browser clients to the predefined client module

add to the module the use and use the macro add_browser_client/1

defmodule Some.Module do
  use ExCrawlzy.Client.Handlers.BrowserClients

  add_browser_client([
    {"referer", "https://your_site.com"},
    {"user-agent", "Custom User Agent"}
  ])
  ...

and adds the function fields/0 to the module

> Some.Module.clients()
[
  %Tesla.Client{
    fun: nil,
    pre: [
      {Tesla.Middleware.Compression, :call, [[format: "gzip"]]},
      {Tesla.Middleware.Headers, :call,
       [
         [
           {"referer", "https://your_site.com"},
           {"user-agent", "Custom User Agent"}
         ]
       ]}
    ],
    post: [],
    adapter: nil
  }
]

Summary

Functions

Add a new browser client to the module sending headers

Functions

Link to this macro

add_browser_client(selector)

View Source (macro)

Add a new browser client to the module sending headers

Example headers

{"referer", "https://your_site.com"},
{"user-agent", "Custom User Agent"}