Skip to content

Instantly share code, notes, and snippets.

@rmolina
Created April 22, 2015 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmolina/6e3920f82eff4c2d5963 to your computer and use it in GitHub Desktop.
Save rmolina/6e3920f82eff4c2d5963 to your computer and use it in GitHub Desktop.
PrimeObsession.py
# -*- coding: utf-8 -*-
import requests
import lxml
import sympy
import numpy
def PeopleSetDetail(PeopleSetID, PrimeObsession=False):
site = 'http://comics.www.collectors-society.com/'
url = 'registry/comics/PeopleSetDetail.aspx?PeopleSetID=%s' % PeopleSetID
req = requests.get(site + url)
html = lxml.etree.HTML(req.text)
rows = html.xpath("//table[@class='TopSetsGrid']/tr")
data = list()
for row in rows:
cols = row.xpath("td/a/text()")
try:
if sympy.isprime(cols[1]) or not PrimeObsession:
data.append(cols[-2::-1])
except (IndexError, ValueError):
pass
return numpy.array(data)
print PeopleSetDetail(79399, PrimeObsession=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment