I am trying to mirror a ruby scraper that I wrote but for a python only environment. I've decided to use lxml and requests to get this done. My problem is pagination:
base_url = "http://example.com/something/?page=%s"
for url in [base_url % i for i in xrange(10)]:
r = requests.get(url)
I'm new to python and this library so I'm not sure the best way to perform the equivalent ruby code:
last_pg = (page.xpath("//div[contains(@class, 'b-tabs-utility')]").text.split('of ')[-1].split(' Results')[0].to_f / 60).ceil
puts "Current Index: #{last_pg}"
for pg_number in 1..last_pg do
puts "Getting links on page #{pg_number}"