Created
March 30, 2016 16:52
-
-
Save fayimora/d4d21abc521e98609a9ecf2437979fc4 to your computer and use it in GitHub Desktop.
Scappers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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