Skip to main content

Overview

The AffiliateMarketing class handles affiliate marketing operations including product scraping, pitch generation, and social media sharing.

Constructor

AffiliateMarketing(
    affiliate_link: str,
    fp_profile_path: str,
    twitter_account_uuid: str,
    account_nickname: str,
    topic: str
)
The affiliate link to the product
fp_profile_path
str
required
The path to the Firefox profile
twitter_account_uuid
str
required
The Twitter account UUID
account_nickname
str
required
The account nickname
topic
str
required
The topic of the product
Example:
afm = AffiliateMarketing(
    affiliate_link="https://amazon.com/dp/PRODUCT123?tag=affiliate",
    fp_profile_path="/path/to/firefox/profile",
    twitter_account_uuid="uuid-789",
    account_nickname="Tech Deals",
    topic="Tech Gadgets"
)

Methods

scrape_product_information

def scrape_product_information() -> None
Scrapes product information from the affiliate link. This method is called automatically during initialization. Returns: None

generate_response

def generate_response(prompt: str) -> str
Generates an LLM response for the given prompt.
prompt
str
required
The prompt for the user
Returns: str - The response for the user

generate_pitch

def generate_pitch() -> str
Generates a marketing pitch for the product based on scraped information. Returns: str - The pitch for the product, including the affiliate link Example:
afm = AffiliateMarketing(
    affiliate_link="https://amazon.com/dp/PRODUCT123?tag=affiliate",
    fp_profile_path="/path/to/firefox/profile",
    twitter_account_uuid="uuid-789",
    account_nickname="Tech Deals",
    topic="Tech Gadgets"
)

pitch = afm.generate_pitch()
print(f"Generated pitch: {pitch}")

share_pitch

def share_pitch(where: str) -> None
Shares the generated pitch on the specified platform.
where
str
required
The platform where the pitch will be shared (currently supports “twitter”)
Returns: None Example:
afm.generate_pitch()
afm.share_pitch("twitter")

quit

def quit() -> None
Quits the browser instance. Returns: None

Complete Workflow Example

from classes.AFM import AffiliateMarketing

# Initialize with affiliate link
afm = AffiliateMarketing(
    affiliate_link="https://amazon.com/dp/PRODUCT123?tag=affiliate",
    fp_profile_path="/path/to/firefox/profile",
    twitter_account_uuid="uuid-789",
    account_nickname="Tech Deals",
    topic="Tech Gadgets"
)

# Generate marketing pitch
pitch = afm.generate_pitch()

# Share to Twitter
afm.share_pitch("twitter")

# Clean up
afm.quit()

Build docs developers (and LLMs) love