Advertisement
Conquistadork

MangaUpdates Randomize Python Script Updated

Sep 27th, 2015
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.49 KB | None | 0 0
  1. #!/usr/bin/env python2
  2. import os, random, urllib, webbrowser
  3.  
  4. baselink = "https://www.mangaupdates.com/series.html?id="
  5.  
  6. #Add a hash in front of genres you want to include
  7. #There are a million Categories, just add a new line for Categories that you want to include/exclude
  8.  
  9. #For example, you want only random Fantasy manga that won an award
  10. #Things I Don't Like = Only hash """genre=Fantasy""",
  11. #Things I like = """category=Award-Winning+Work""",
  12. #Remove hash from elseif statements
  13.  
  14. #The triple quotes means it searches the HTML of the MU page
  15.  
  16. Things_I_dont_like = [
  17.     "You specified an invalid series id.",
  18.  
  19.     "You must login to see Hentai related images.",
  20.     " dj ",
  21.     """>Novel""",
  22.     """>Manhwa""",
  23.     #""">Oneshot""",
  24.     #"""category=Award-Winning+Work""",
  25.     #"""category=Award-Nominated+Work""",
  26.     """genre=Yaoi""",
  27.     """genre=Josei""",
  28.     """genre=Harem""",
  29.     """genre=Sports""",
  30.     """genre=Shoujo""",
  31.     """genre=Shotacon""",
  32.     """genre=Shoujo+Ai""",
  33.     """genre=Shounen+Ai""",
  34.     """genre=Yuri""",
  35.     """genre=Doujinshi""",
  36.     """genre=Ecchi""",
  37.     """genre=Gender+Bender""",
  38.     """genre=Hentai""",
  39.     #"""genre=Seinen""",
  40.     #"""genre=Shounen""",
  41.     #"""genre=Lolicon""",
  42.     #"""genre=Action""",
  43.     #"""genre=Adventure""",
  44.     #"""genre=Horror""",
  45.     #"""genre=Mature""",
  46.     #"""genre=Mystery""",
  47.     #"""genre=Romance""",
  48.     #"""genre=Sci-fi""",
  49.     #"""genre=Smut""",
  50.     #"""genre=Supernatural""",
  51.     #"""genre=Adult""",
  52.     #"""genre=Comedy""",
  53.     #"""genre=Drama""",
  54.     #"""genre=Fantasy""",
  55.     #"""genre=Historical""",
  56.     #"""genre=Martial Arts""",
  57.     #"""genre=Mecha""",
  58.     #"""genre=Psychological""",
  59.     #"""genre=School+Life""",
  60.     #"""genre=Slice+of+Life""",
  61.     #"""genre=Tragedy""",
  62.     """<div class="sCat"><b>Completely Scanlated?</b></div>\n<div class="sContent" >No\n</div>""",
  63.     """<u>Report Inappropriate Content</u></a>]</div>\n<div class="sContent" >N/A\n</div>""",
  64. ]
  65.  
  66. #Criteria you want to include anyway, if they show up for Things I Don't Like
  67. #Things_I_like = [
  68.     #"""category=Award-Winning+Work""",
  69.      #"""category=Award-Nominated+Work""",
  70.  
  71. #]
  72.  
  73. valid = False
  74. while not valid:
  75.     num = random.randint(1,109400)
  76.     link = "%s%d" % (baselink, num)
  77.     urllib.urlretrieve(link, "temp.html")
  78.     page = open("temp.html").read()
  79.  
  80.  
  81.     if any(thing in page for thing in Things_I_dont_like):
  82.         print (link, "Nope.")
  83.     #elif not any(thing in page for thing in Things_I_like):
  84.         #print (link, "Nope.")
  85.     else:
  86.         webbrowser.open(link)
  87.         os.remove("temp.html")
  88.         valid = True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement