Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Python SDK for the Rocket Scraper API. For more information, visit the GitHub repository.
pip install rocketscraper
To use the SDK, you need to create a new instance of the RocketClient
class and pass your API key as an argument.
from rocketscraper import RocketClient
rocket_client = RocketClient('YOUR_API_KEY') # Simplified constructor
The scrape
method allows you to scrape data from a website using a schema. The method returns the scraped data in the format specified in the schema.
from rocketscraper import RocketClient
try:
client = RocketClient('YOUR_API_KEY')
# Define a comprehensive product schema
schema = {
"productDetails": {
"name": "string",
"brand": "string",
"currentPrice": "number",
"originalPrice": "number",
"discount": "number",
"availability": "boolean",
"rating": "number",
"reviewCount": "integer"
},
"specifications": [{
"name": "string",
"value": "string"
}],
"shipping": {
"freeShipping": "boolean",
"estimatedDays": "integer"
}
}
# Add a detailed task description for better accuracy (optional)
task_description = """
Extract product information with the following guidelines:
1. For prices, use the main displayed price (ignore bulk discounts)
2. Calculate discount percentage from original and current price
3. Include all technical specifications found on the page
4. Extract shipping details from both product and shipping sections
"""
result = client.scrape(
url='https://marketplace.example.com/products/wireless-earbuds',
schema=schema,
task_description=task_description
)
print(result)
except Exception as e:
print(f"Error: {e}")
{
"productDetails": {
"name": "Premium Wireless Earbuds Pro X",
"brand": "AudioTech",
"currentPrice": 149.99,
"originalPrice": 199.99,
"discount": 25.0,
"availability": true,
"rating": 4.5,
"reviewCount": 328
},
"specifications": [
{
"name": "Battery Life",
"value": "Up to 8 hours (single charge)"
},
{
"name": "Connectivity",
"value": "Bluetooth 5.2"
},
{
"name": "Water Resistance",
"value": "IPX4"
}
],
"shipping": {
"freeShipping": true,
"estimatedDays": 3
}
}
The SDK will raise exceptions for various error cases. It's recommended to wrap your API calls in try-catch blocks to handle potential errors gracefully.
Common error scenarios:
For more information on how to use the Rocket Scraper API, visit the Rocket Scraper API documentation.
This project is licensed under the MIT License. See the LICENSE file for more details.
FAQs
Python SDK for the Rocket Scraper API.
We found that rocketscraper demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.