This file contains 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
import urllib | |
from bs4 import BeautifulSoup | |
from flask import Flask, jsonify, request | |
app = Flask(__name__) | |
@app.route('/scrape') | |
def scrape(): | |
sport = request.args['sport'] | |
html = urllib.urlopen("http://www.espn.com/" + sport).read() |
This file contains 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
import urllib | |
from bs4 import BeautifulSoup | |
sport = "nhl" | |
html = urllib.urlopen("http://www.espn.com/" + sport).read() | |
headlines = [headline.get_text() for headline in BeautifulSoup(html).find(class_="headlines").find_all('li')] | |
print headlines |
This file contains 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
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> | |
<style> /* set the CSS */ | |
#forecastExampleContainer { | |
font: 12px Arial; | |
} | |
#forecastExampleContainer path { |
This file contains 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
<html> | |
<head> | |
<style> /* set the CSS */ | |
#forecastExampleContainer { | |
font: 12px Arial; | |
} | |
#forecastExampleContainer path { | |
stroke: steelblue; |
This file contains 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
var request = require('request'); | |
var cheerio = require('cheerio'); | |
var blockspring = require('blockspring'); | |
blockspring.define(function(req, res){ | |
request('http://www.espn.com/' + req.params['sport'], function(error, response, html){ | |
if(!error){ | |
var $ = cheerio.load(html); | |
var headlines = [] |
This file contains 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
<html> | |
<body> | |
<form accept-charset="UTF-8" action="/scrape" method="post"> | |
<input autofocus="autofocus" placeholder="nba" type="text" name="sport"> | |
<input type="submit" value="Get my headlines!"> | |
<br> | |
</form> | |
</body> | |
</html> |
This file contains 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
{ | |
"name" : "espn-scrape", | |
"version" : "0.0.1", | |
"description" : "Scrape espn headlines.", | |
"main" : "server.js", | |
"author" : "Blockspring", | |
"dependencies" : { | |
"express" : "latest", | |
"request" : "latest", | |
"cheerio" : "latest" |
This file contains 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
var request = require('request'); | |
var cheerio = require('cheerio'); | |
var sport = "nhl"; | |
request('http://www.espn.com/' + sport, function(error, response, html){ | |
if(!error){ | |
var $ = cheerio.load(html); | |
var headlines = [] |
This file contains 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
<html> | |
<head> | |
<style> /* set the CSS */ | |
#paletteExampleContainer { | |
font: 12px Arial; | |
} | |
.swatches { | |
width: 100%; |
This file contains 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 fuzzywuzzy import fuzz | |
from fuzzywuzzy import process | |
import pandas as pd | |
import numpy as np | |
# inputs | |
fuzzy_match = [["My IDs"], ["Red"], ["Green"], ["Blue"], ["Black"], ["Yellow"], ["Pink"]] | |
match_against = [["Other IDs"], ["Rdd"], ["Grown"], ["Grodkj"], ["Blome"], ["Bluz"], ["Yell"], ["Yelloow$"], ["Punk"], ["Pank"], ["Other"]] | |
count_match = 2 |