Created
          July 2, 2016 00:31 
        
      - 
      
 - 
        
Save bahoo/1ab63420e3d1d1e58175856a47eeaefa to your computer and use it in GitHub Desktop.  
    Scrape fundraising progress from GoFundMe
  
        
  
    
      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
    
  
  
    
  | # 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