Skip to content

Instantly share code, notes, and snippets.

@captivus
captivus / audible_matchmaker_scraping_gist1.py
Last active April 26, 2020 17:31
Load BeautifulSoup and parse the Audible Matchmaker page ...
import requests
from bs4 import BeautifulSoup
# open Audible Matchmaker page locally
# (see accompanying Jupyter notebook for details)
infile = open(file='audible_matchmaker.html', mode='r')
# parse the page with BeautifulSoup
soup = BeautifulSoup(markup=infile, features='html.parser')
@captivus
captivus / audible_matchmaker_scraping_gist2.py
Created April 26, 2020 17:29
Parse Audible Matchmaker data into something mathematically useful ...
# find all of the spans containing the audiobook price
# (see accompanying Jupyter notebook for details)
upgrade_prices = soup.findAll(name='span', attrs={'class' : 'a-size-base a-color-price a-text-bold'})
# iterate over each of the book prices
for book in upgrade_prices:
# convert the span price data to a string
price_string = book.string
# remove the dollar sign from the price string
price_string = price_string.replace('$', '')
@captivus
captivus / audible_matchmaker_scraping.py
Created April 26, 2020 17:31
Audible Matchmaker scraping in Python
import requests
from bs4 import BeautifulSoup
# open Audible Matchmaker page locally
# (see accompanying Jupyter notebook for details)
infile = open(file='audible_matchmaker.html', mode='r')
# parse the page with BeautifulSoup
soup = BeautifulSoup(markup=infile, features='html.parser')
@captivus
captivus / meta.yaml
Created February 27, 2021 19:14
Example meta.yaml recipe file for Conda Forge packaging
# Note: there are many handy hints in comments in this example -- remove them when you've finalized your recipe
# Jinja variables help maintain the recipe as you'll update the version only here.
# Using the name variable with the URL in line 14 is convenient
# when copying and pasting from another recipe, but not really needed.
{% set name = "simplejson" %}
{% set version = "3.8.2" %}
package:
name: {{ name|lower }}
@captivus
captivus / meta.yaml
Created February 27, 2021 19:17
grayskull-generated meta.yaml recipe for the spotipy package from PyPI
{% set name = "spotipy" %}
{% set version = "2.16.1" %}
package:
name: {{ name|lower }}
version: {{ version }}
source:
url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/spotipy-{{ version }}.tar.gz
@captivus
captivus / meta.yaml
Created February 27, 2021 19:23
Final, pull request-ready meta.yaml recipe for the spotipy package
{% set name = "spotipy" %}
{% set version = "2.16.1" %}
package:
name: {{ name|lower }}
version: {{ version }}
source:
url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/spotipy-{{ version }}.tar.gz
sha256: 4564a6b05959deb82acc96a3fe6883db1ad9f8c73b7ff3b9f1f44db43feba0b8
@captivus
captivus / meta.yaml
Created February 27, 2021 19:28
Edit the meta.yaml file to reflect minimum python versions in both the host and run sections of requirements
requirements:
host:
- pip
- python >=3.6
run:
- python >=3.6
- requests >=2.20.0
- six >=1.10.0