Skip to content

Instantly share code, notes, and snippets.

@bahoo
Created July 2, 2016 00:31
Show Gist options
  • Save bahoo/1ab63420e3d1d1e58175856a47eeaefa to your computer and use it in GitHub Desktop.
Save bahoo/1ab63420e3d1d1e58175856a47eeaefa to your computer and use it in GitHub Desktop.
Scrape fundraising progress from GoFundMe
# do:
# pip install beautifulsoup4 requests
# then this:
import requests
from bs4 import BeautifulSoup
# this cookie triggers / forces its new layout (as of July 1 2016)
headers = {
'Cookie': 'flow=%7B%22DONATION%22%3A%22d_ad_v2a%22%7D'
}
req = requests.get('https://www.gofundme.com/sendculvertophilly', headers=headers)
soup = BeautifulSoup(req.text)
raised, goal = soup.select('h2')[0].text.strip('\n').rstrip(' goal').replace('$', '').replace(',', '').split(' of ')
print raised
print goal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment