Skip to content

Instantly share code, notes, and snippets.

@scrapehero
scrapehero / zillow.py
Last active November 10, 2023 03:06
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 / fandango.py
Created February 12, 2018 07:46
Python 3 Code for scraping movie details from fandango.com
View fandango.py
from lxml import html, etree
import datetime
import requests
import re
import os
import sys
import unicodecsv as csv
import argparse
import json
# from exceptions import ValueError
@scrapehero
scrapehero / yahoo_finance.py
Last active July 7, 2023 08:00
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 / target.py
Last active April 5, 2023 15:33
Python 3 code to extract target store locations
View target.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
import re
from time import time
import json
import argparse
def get_store(store):
store_name = store['Name']
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 / amazon_reviews.py
Last active November 16, 2022 03:43
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 March 30, 2017 07:57
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 = {
@scrapehero
scrapehero / amazon_review_scraper.py
Last active August 5, 2022 10:59
Python Code to Scrape Customer Reviews from Amazon.com. Read more on https://www.scrapehero.com/how-to-scrape-amazon-product-reviews-using-python/
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 July 3, 2022 06:38
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