xah

web scraper

xah
Oct 20th, 2016 (edited)
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.24 KB | None | 0 0
  1. #! python3
  2.  
  3. import webbrowser, sys, bs4
  4.  
  5. #logs into CKM Scans
  6.  
  7. from twill.commands import *
  8. go('http://ckmscans.halofight.com/login')
  9.  
  10. fv('1', 'username', 'dummyModder')
  11. fv('1', 'password', 'dummyModderPassword')
  12.  
  13. submit('0')
  14.  
  15. print('What novel would you like to edit? "G" for Gu Fang, "W" for the Little Witch.')
  16. novel = input()
  17.  
  18. soup = BeautifulSoup(HTML)
  19.  
  20. if novel == 'G':
  21.     print('Which chapter? 1-75, numerical only.')
  22.     guChapter = int(input())
  23.  
  24.     if guChapter <= 27:
  25.         webbrowser.open('http://ckmscans.halofight.com/f57-gu-fang-bu-zi-shang-01')
  26.         table = soup.find("table")[5]
  27.  
  28.     elif guChapter > 27:
  29.         if guChapter < 55:
  30.             webbrowser.open('http://ckmscans.halofight.com/f56-gu-fang-bu-zi-shang-02')
  31.  
  32.         else:
  33.             webbrowser.open('http://ckmscans.halofight.com/f59-gu-fang-bu-zi-shang-03')
  34.  
  35.     else:
  36.         print('You will have to restart the programme if you got here. My coding isn\'t good enough to help you if you come up with an error.')
  37.  
  38. elif novel == 'W':
  39.     webbrowser.open('http://ckmscans.halofight.com/f54-the-little-witch-s-sure-fire-techniques-01')
  40.  
  41. else:
  42.     print('We don\'t have such a novel. Please either restart if you would like to reload the script.')
Add Comment
Please, Sign In to add comment