Updates to PACKT claimer/downloader.
This commit is contained in:
parent
c545de0b35
commit
3bfc387394
@ -36,9 +36,11 @@ g.doc.text_assert('"sid":')
|
||||
g.doc.text_assert('Claim Your Free eBook')
|
||||
claim_book = g.doc.select('//div[@class="dotd-title"]/h2').text()
|
||||
print("Book: {}".format(claim_book))
|
||||
claim_url = g.doc.select('//a[@class="twelve-days-claim"]/@href').text()
|
||||
claim_url = g.doc.select('//form[@id="free-learning-form"]/@action').text()
|
||||
print("Claim URL: {}".format(claim_url))
|
||||
g.go(claim_url)
|
||||
g.doc.choose_form(id='free-learning-form')
|
||||
g.doc.submit()
|
||||
#g.go(claim_url)
|
||||
g.doc.save('/tmp/free-learning-after-claim.html')
|
||||
g.doc.text_assert('<h1>My eBooks </h1>')
|
||||
print("Claim successful.")
|
||||
|
@ -147,7 +147,7 @@ else:
|
||||
|
||||
print("Found {:d} ebooks.".format(len(all_books)))
|
||||
|
||||
if opts["idx_end"] or opts["count"]:
|
||||
if opts["idx_start"] > 1 or opts["idx_end"] or opts["count"]:
|
||||
# Some range given: Download books
|
||||
idx_start = opts["idx_start"]
|
||||
if idx_start < 1:
|
||||
@ -158,7 +158,7 @@ if opts["idx_end"] or opts["count"]:
|
||||
elif opts["count"]:
|
||||
idx_end = idx_start + opts["count"] - 1
|
||||
else:
|
||||
idx_end = idx_start
|
||||
idx_end = len(all_books)
|
||||
|
||||
if idx_end < idx_start:
|
||||
idx_end = idx_start
|
||||
|
Loading…
x
Reference in New Issue
Block a user