What You'll Learn
- • Setting up your development environment
- • Installing the required HTTP client
- • Authenticating with the ScrapeCreators API
- • Making requests to Pillar
- • Handling responses and errors
- • Best practices for production use
Extract pillar data from Pillar
Learn how to scrape Pillar pillars using Swift. This comprehensive guide will walk you through the entire process, from setup to implementation.
First, you'll need a ScrapeCreators API key to authenticate your requests.
Sign up at app.scrapecreators.com to get your free API key with 100 requests.
Make sure you have the following installed:
Alamofire is an HTTP networking library for Swift
swift package add Alamofire
Now let's make a request to the Pillar API using Swift. Replace YOUR_API_KEY
with your actual API key.
import Foundation
class Scraper {
private static let API_KEY = "YOUR_API_KEY"
private static let BASE_URL = "https://api.scrapecreators.com"
private static let ENDPOINT_PATH = "/v1/pillar"
static func scrape(completion: @escaping (Result<String, Error>) -> Void) {
// Build query parameters
var components = URLComponents(string: BASE_URL + ENDPOINT_PATH)!
components.queryItems = [
URLQueryItem(name: "url", value: "https://pillar.io/angelstrife")
]
guard let url = components.url else {
completion(.failure(NSError(domain: "Invalid URL", code: -1, userInfo: nil)))
return
}
var request = URLRequest(url: url)
request.setValue(API_KEY, forHTTPHeaderField: "x-api-key")
URLSession.shared.dataTask(with: request) { data, response, error in
if let error = error {
completion(.failure(error))
return
}
guard let data = data else {
completion(.failure(NSError(domain: "No data", code: -1, userInfo: nil)))
return
}
if let responseString = String(data: data, encoding: .utf8) {
completion(.success(responseString))
} else {
completion(.failure(NSError(domain: "Invalid data", code: -1, userInfo: nil)))
}
}.resume()
}
}
// Usage
Scraper.scrape { result in
switch result {
case .success(let response):
print("Response: \(response)")
case .failure(let error):
print("Error: \(error)")
}
}
This endpoint accepts the following parameters:
url
Required(string)URL to Pillar page
Example: https://pillar.io/angelstrife
Execute your script to test the API connection. You should see a JSON response with Pillar pillars data.
✅ Success: You should receive a structured JSON response containing the requested data.
Here's an example of the JSON response you'll receive:
{
"success": true,
"id": "d8a5cbb4-a64d-44f2-830d-27a489bbc608",
"first_name": "Angel",
"last_name": "Blanco",
"email_primary": "angelrafaelcovablanco@gmail.com",
"location": "México",
"email": "angelrafaelcovablanco@gmail.com",
"amazon": "",
"medium": "",
"tiktok": "https://tiktok.com/@angelstrifeoficial",
"twitch": "",
"discord": "",
"patreon": "",
"spotify": "https://open.spotify.com/artist/3Lse4fAlOchY8msotsYMA6?si=4nKqeTSRRsSDoNj1tfvNtA",
"twitter": "https://twitter.com/SoyAngelStrife",
"youtube": "https://www.youtube.com/channel/UCgZSHuBjHSFADbFQOCN1ifg",
"facebook": "https://www.facebook.com/AngelStrifeOficial",
"linkedin": "https://mx.linkedin.com/in/angelcovablanco",
"snapchat": "",
"instagram": "https://www.instagram.com/angelstrifeoficial",
"soundcloud": "https://soundcloud.com/contienda-records",
"apple_app_store": "",
"google_app_store": "",
"links": [
{
"id": "66472110-1ba7-11ee-b33b-e5396daf72e9",
"type": "twitter",
"title": "twitter",
"url": "https://twitter.com/SoyAngelStrife",
"clicks": 2,
"order": null
},
{
"id": "669fef70-1ba7-11ee-b33b-e5396daf72e9",
"type": "30 mil pies de altura para morir de amor",
"title": "30 mil pies de altura para morir de amor",
"url": "https://open.spotify.com/album/14jqUYFbuBs0HcftvQ7jC3?si=bX_bInR7R9Wu-mC9_77Fvw&context=spotify%3Aalbum%3A14jqUYFbuBs0HcftvQ7jC3",
"clicks": 0,
"order": 2
}
],
"products": [
{
"id": "254c8681-1d52-11ee-b065-850167411bb1",
"title": "\"30 Mil Pies De Altura Para Morir de Amor\" - LP",
"price": 0,
"url": "https://angel-strife.ueniweb.com/products/merchandise/30-mil-pies-de-altura-para-morir-de-amor-lp-especial-edition-vynil-deluxe-53106871",
"name": "\"30 Mil Pies De Altura Para Morir de Amor\" - LP",
"description": "Especial Edition Vynil Deluxe",
"image": "https://athlane-file-management-prod.s3.amazonaws.com/a925f7b5-77ba-4095-b755-27b2bc221baa"
}
]
}
Check that your response includes the expected fields:
success
(boolean)id
(string)first_name
(string)last_name
(string)email_primary
(string)Implement comprehensive error handling and retry logic for failed requests. Log errors properly for debugging.
Cache responses when possible to reduce API calls and improve performance. Consider data freshness requirements.
Never expose your API key in client-side code. Use environment variables and secure key management practices.
When scraping multiple pillars, consider batching requests to maximize throughput while staying within rate limits.
Use asynchronous processing in Swift to handle multiple requests concurrently and improve overall performance.
Analyze Pillar pillars to understand market trends, competitor analysis, and audience insights.
Track performance metrics, engagement rates, and content trends across Pillar pillars.
Identify potential customers and business opportunities throughPillar data analysis.
Check your API key is correct and properly formatted in the x-api-key header.
You ran out of credits and need to buy more.
The resource might not exist or be private.
Temporary server issue. Implement retry logic with exponential backoff.
ScrapeCreators offers 100 free API calls to get started. After that, pricing starts at $10 for 5k requests with volume discounts available.
Scraping publicly available data is fair game, and we only collect public data. So anything that you can see in an incognito browser is what we collect.
There is no rate limit! So you can scrape as fast as you want!
All API responses are returned in JSON format, making it easy to integrate with any programming language or application.
Yes! This tutorial focuses on core Swift HTTP concepts that work with any framework. The API calls remain the same regardless of your specific Swift setup.
For large datasets, implement pagination, use streaming responses where available, and consider storing data in a database for efficient querying.
Get started with 100 free API calls. No credit card required.