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
The path to the Firefox profile
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
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.
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.
The platform where the pitch will be shared (currently supports “twitter”)
Returns: None
Example:
afm.generate_pitch()
afm.share_pitch("twitter")
quit
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()