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 = 90 * 24 * time.Hour
LinkedInCacheTTL is the cache duration for LinkedIn profile data (90 days).
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.
func (*BraveSearcher) SearchByName ¶ added in v0.9.16
func (b *BraveSearcher) SearchByName(ctx context.Context, name, employer, jobTitle string) (*ProfileSearchResult, error)
SearchByName searches for a LinkedIn profile by name and employment info. This is useful when you have GitHub profile data with name/employer but no LinkedIn URL. Returns nil if no profile is found or if there's insufficient data to search.
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 ProfileSearchResult ¶ added in v0.9.16
type ProfileSearchResult struct {
Query string `json:"query,omitempty"`
ProfileURL string `json:"profile_url,omitempty"`
Name string `json:"name,omitempty"`
Headline string `json:"headline,omitempty"`
JobTitle string `json:"job_title,omitempty"`
Company string `json:"company,omitempty"`
Location string `json:"location,omitempty"`
Education string `json:"education,omitempty"`
Connections string `json:"connections,omitempty"`
Bio string `json:"bio,omitempty"`
Confidence float64 `json:"confidence"`
}
ProfileSearchResult represents location and profile data found via search.
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.