Skip to content

Instantly share code, notes, and snippets.

@fayimora
Created March 30, 2016 16:52
Show Gist options
  • Save fayimora/d4d21abc521e98609a9ecf2437979fc4 to your computer and use it in GitHub Desktop.
Save fayimora/d4d21abc521e98609a9ecf2437979fc4 to your computer and use it in GitHub Desktop.
Scappers
from bs4 import BeautifulSoup
boutique_names = []
for page in xrange(1, 6):
html_doc = open("asos-boutiques-%d.html" % page).read()
soup = BeautifulSoup(html_doc, 'html.parser')
fieldset = soup.find(id="resultsWrp")
boutique_list = fieldset.findChild(id='boutiqueList')
print("Processing page %d" % page)
for boutique in boutique_list:
name = boutique.find('a', {'class': 'notranslate'}).text
boutique_names.append(name)
f = open('boutique_names.txt', 'wa')
[f.write(name.encode("utf-8")) for name in boutique_names]
from bs4 import BeautifulSoup
import requests
boutique_names = []
html_doc = requests.get('http://www.farfetch.com/uk/Boutiques/Index/0?cid=215&items=80').text
soup = BeautifulSoup(html_doc, 'html.parser')
names = [tag.text for tag in soup.findAll('h2', {'class': 'boutique_name'})]
f = open('farfetch_names.txt', 'w')
for name in names:
out = name.encode("utf-8")+"\n"
f.write(out)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment