Documentation
¶
Overview ¶
Package linkedin fetches LinkedIn user profile data via web search.
Since LinkedIn blocks direct scraping, this package uses web search engines to extract profile data from search result snippets. When a Searcher is configured, it searches for the LinkedIn URL and parses the results to extract name, headline, company, and location.
Without a Searcher configured, it returns minimal profiles with just the URL and username for manual verification.
Index ¶
Constants ¶
const LinkedInCacheTTL = 180 * 24 * time.Hour
LinkedInCacheTTL is the cache duration for LinkedIn profile data (180 days). LinkedIn profiles change infrequently, so long caching is appropriate.
Variables ¶
This section is empty.
Functions ¶
func AuthRequired ¶
func AuthRequired() bool
AuthRequired returns true because LinkedIn requires authentication for direct access. When a Searcher is configured, we can still extract data via search results.
func LoadBraveAPIKey ¶ added in v0.9.7
func LoadBraveAPIKey() string
LoadBraveAPIKey loads the Brave API key from multiple sources (in priority order): 1. BRAVE_API_KEY environment variable 2. ~/.brave file (first line, trimmed)
Returns empty string if no key is found.
Types ¶
type BraveOption ¶ added in v0.9.7
type BraveOption func(*BraveSearcher)
BraveOption configures a BraveSearcher.
func WithBraveCache ¶ added in v0.9.7
func WithBraveCache(cache httpcache.Cacher) BraveOption
WithBraveCache sets a cache for storing search results.
func WithBraveLogger ¶ added in v0.9.7
func WithBraveLogger(logger *slog.Logger) BraveOption
WithBraveLogger sets a logger for the searcher.
type BraveSearcher ¶ added in v0.9.7
type BraveSearcher struct {
// contains filtered or unexported fields
}
BraveSearcher implements Searcher using the Brave Search API. Free tier: 2,000 queries/month, 1 query/second. Get an API key at https://api.search.brave.com/
func NewBraveSearcher ¶ added in v0.9.7
func NewBraveSearcher(apiKey string, opts ...BraveOption) *BraveSearcher
NewBraveSearcher creates a new Brave Search API client. apiKey is your Brave Search API subscription token.
func (*BraveSearcher) Search ¶ added in v0.9.7
func (b *BraveSearcher) Search(ctx context.Context, query string) ([]SearchResult, error)
Search performs a web search using the Brave Search API.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client handles LinkedIn requests.
func (*Client) EnableDebug ¶
func (*Client) EnableDebug()
EnableDebug enables debug logging (currently a no-op).
type Option ¶
type Option func(*config)
Option configures a Client.
func WithBrowserCookies ¶
func WithBrowserCookies() Option
WithBrowserCookies enables reading cookies from browser stores (currently unused - auth is broken).
func WithCookies ¶
WithCookies sets explicit cookie values (currently unused - auth is broken).
func WithHTTPCache ¶
WithHTTPCache sets the HTTP cache (currently unused - auth is broken).
func WithSearcher ¶ added in v0.9.7
WithSearcher sets a web search backend for extracting profile data. When configured, Fetch will search for the LinkedIn URL and parse the results to extract name, headline, company, and location.
type SearchResult ¶ added in v0.9.7
type SearchResult struct {
Title string // Page title (e.g., "Dan Lorenc - Chainguard, Inc | LinkedIn")
URL string // Result URL
Snippet string // Text snippet from search results
}
SearchResult represents a single web search result.