Skip to content

Instantly share code, notes, and snippets.

View dubirajara's full-sized avatar
🎯
Focusing

Diego Ubirajara dubirajara

🎯
Focusing
View GitHub Profile
@alirezamika
alirezamika / autoscraper-examples.md
Last active July 3, 2024 21:02
AutoScraper Examples

Grouping results and removing unwanted ones

Here we want to scrape product name, price and rating from ebay product pages:

url = 'https://www.ebay.com/itm/Sony-PlayStation-4-PS4-Pro-1TB-4K-Console-Black/203084236670' 

wanted_list = ['Sony PlayStation 4 PS4 Pro 1TB 4K Console - Black', 'US $349.99', '4.8'] 

scraper.build(url, wanted_list)
'''
Example using headers. The fields were filled with generic values
'''
import requests
url = 'http://www.example.com/page'
#Create headers
header = {}
header['Host'] = 'www.example.com'