Skip to content

Instantly share code, notes, and snippets.

View captcha_resolver.py
import pytesseract
import sys
import argparse
try:
import Image
except ImportError:
from PIL import Image
from subprocess import check_output
@scrapehero
scrapehero / zillow.py
Last active Dec 23, 2022
Python 3 script to find real estate listings of properties up for sale on zillow.com
View zillow.py
from lxml import html
import requests
import unicodecsv as csv
import argparse
import json
def clean(text):
if text:
return ' '.join(' '.join(text).split())
@scrapehero
scrapehero / yahoo_finance.py
Last active Dec 2, 2022
Python 3 code to extract stock market data from yahoo finance
View yahoo_finance.py
from lxml import html
import requests
from time import sleep
import json
import argparse
from collections import OrderedDict
from time import sleep
def parse(ticker):
url = "http://finance.yahoo.com/quote/%s?p=%s"%(ticker,ticker)
@scrapehero
scrapehero / amazon_reviews.py
Last active Nov 16, 2022
Python 3 code to extract amazon reviews
View amazon_reviews.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Written as part of https://www.scrapehero.com/how-to-scrape-amazon-product-reviews-using-python/
from lxml import html
from json import dump,loads
from requests import get
import json
from re import sub
from dateutil import parser as dateparser
from time import sleep
@scrapehero
scrapehero / geocoder.py
Created Mar 30, 2017
Python script to parse unstructured addresses
View geocoder.py
from requests import get
from pprint import pprint
from json import dump
from csv import QUOTE_ALL, DictWriter
API_KEY = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
def address_resolver(json):
final = {}
if json['results']:
data = json['results'][0]
for item in data['address_components']:
View amazon_product.py
from lxml import html
import csv
import os
import requests
from exceptions import ValueError
from time import sleep
from random import randint
def parse(url):
headers = {
View amazon_review_scraper.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Written as part of https://www.scrapehero.com/how-to-scrape-amazon-product-reviews-using-python/
from lxml import html
import json
import requests
import json,re
from dateutil import parser as dateparser
from time import sleep
@scrapehero
scrapehero / nasdaq_finance.py
Last active Jul 3, 2022
Script to scrape financial data from NASDAQ
View nasdaq_finance.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from lxml import html
import requests
from time import sleep
import json
import argparse
from random import randint
@scrapehero
scrapehero / yelp_search.py
Last active Apr 7, 2022
Python 3 code to extract business listings from Yelp.com
View yelp_search.py
from lxml import html
import unicodecsv as csv
import requests
from time import sleep
import re
import argparse
import json
def parse(url):
@scrapehero
scrapehero / amazon-reviews.json
Last active Feb 25, 2022
Sitemap to extract data of review listings of a single product on Amazon.com using Web Scraper Chrome Extension. Instructions - https://www.scrapehero.com/amazon-review-scraper/
View amazon-reviews.json
{
"_id": "amazon_reviews",
"startUrl": [
"https://www.amazon.com/Screen-Protector-SPARIN-Tempered-Glass/product-reviews/B013JZCAZK/ref=cm_cr_dp_d_show_all_btm?ie=UTF8&reviewerType=all_reviews"
],
"selectors": [
{
"id": "review",
"type": "SelectorElement",
"parentSelectors": [