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
<style> | |
summary::-webkit-details-marker { | |
color: #00ACF3; | |
margin-right: 2px; | |
} | |
summary:focus { | |
outline-style: none; | |
} | |
article > details > summary { | |
font-size: 18px; |
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
# | |
# | |
# based on https://github.com/tweepy/tweepy/blob/master/examples/streaming.py | |
import tweepy # to get your tweepy version go python -c "import tweepy; print(tweepy.__version__)" | |
import time | |
import json | |
import datetime |
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
'''A script to scrape the ONS release schedule''' | |
import urllib | |
import bs4 | |
page = 0 | |
URL = "http://www.statistics.gov.uk/hub/release-calendar/index.html?newquery=*&newoffset=" + str(page) + "&theme=%22%22&source-agency=%22%22&uday=0&umonth=0&uyear=0&lday=-29&lmonth=0&lyear=0&coverage=%22%22&designation=&geographic-breakdown=%22%22&title=%22%22&pagetype=calendar-entry&sortBy=releaseDate&sortDirection=EITHER" | |
# open webpage | |
webpage = urllib.urlopen(URL).read() |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Twitter volume</title> | |
<!--Load the AJAX API--> | |
<script type="text/javascript" src="https://www.google.com/jsapi"></script> | |
<script type="text/javascript"> | |
// Load the Visualization API and the core charts package. | |
google.load('visualization', '1.0', { |
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
PREFIX sch-ont: <http://education.data.gov.uk/def/school/> | |
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> | |
SELECT ?name ?ptr ?address1 ?address2 ?postcode ?town WHERE { | |
?school a sch-ont:School; | |
sch-ont:establishmentName ?name; | |
sch-ont:nurseryProvision "true"^^xsd:boolean; | |
sch-ont:districtAdministrative <http://statistics.data.gov.uk/id/local-authority-district/00AZ>. | |
OPTIONAL { | |
?school sch-ont:address ?address. |
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
import time | |
import tweepy | |
import csv | |
# == OAuth Authentication == | |
# The consumer keys can be found on your application's Details | |
# page located at https://dev.twitter.com/apps (under "OAuth settings") | |
consumer_key="your key" | |
consumer_secret="your secret" |
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
# basic scrape and write demonstration used in Goldsmiths digital sandbox 2014 | |
import urllib # fetches raw web pages for us | |
import bs4 # turns raw web pages into object hierarchy and provides selectors (like CSS and Xpath does) | |
import csv # simplifies the process of writing data to Comma Separated Values in a file | |
# a list of URLs on YouTube that we want to scrape data from | |
pagesToScrape = ['http://www.youtube.com/watch?v=9hIQjrMHTv4' | |
,'https://www.youtube.com/watch?v=Uk8x3V-sUgU'] | |
# open a file in append mode to write into in the same directory where we ran this script from |
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
import twitter | |
import json | |
# == OAuth Authentication == | |
# The consumer keys can be found on your application's Details | |
# page located at https://dev.twitter.com/apps (under "OAuth settings") | |
consumer_key="" | |
consumer_secret="" | |
# After the step above, you will be redirected to your app's page. |
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
# Finding topics of interest by using the filtering capablities it offers. | |
import twitter | |
import json | |
import sys | |
# == OAuth Authentication == | |
# The consumer keys can be found on your application's Details | |
# page located at https://dev.twitter.com/apps (under "Keys and tokens") | |
# PUT YOUR KEYS AND SECRETS IN HERE, IT WONT WORK WITHOUT YOUR KEYS FROM TWITTER !!!!! | |
consumer_key="" |
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
# Finding topics of interest by using the filtering capablities it offers. | |
import twitter, json, sys, csv | |
# == OAuth Authentication == | |
# The consumer keys can be found on your application's Details | |
# page located at https://dev.twitter.com/apps (under "OAuth settings") | |
consumer_key="" | |
consumer_secret="" | |
# After the step above, you will be redirected to your app's page. |
OlderNewer