Advertisement
Guest User

AniDB Random Pre-2000 Subbed may or may not work

a guest
May 10th, 2017
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.77 KB | None | 0 0
  1. #!/usr/bin/env python2
  2. import os, random, urllib, webbrowser
  3.  
  4. baselink = "http://anidb.net/perl-bin/animedb.pl?show=anime&aid="
  5.  
  6. #The triple quotes means it searches the HTML of the page (right click, view page source)
  7.  
  8. #As of April 12th 2017, it looks like there are 13111 entries on AniDB
  9.  
  10. Things_I_dont_like = [
  11.     #""">complete</a>"""
  12.     """>no group</a>"""
  13.     """class="tagname">novel<"""
  14.     """class="tagname">virtual reality""",
  15.     """itemprop="startDate" content="2017"""
  16.     """itemprop="startDate" content="2016"""
  17.     """itemprop="startDate" content="2015"""
  18.     """itemprop="startDate" content="2014"""
  19.     """itemprop="startDate" content="2013"""
  20.     """itemprop="startDate" content="2012"""
  21.     """itemprop="startDate" content="2011"""
  22.     """itemprop="startDate" content="2010"""
  23.     """itemprop="startDate" content="2009"""
  24.     """itemprop="startDate" content="2008"""
  25.     """itemprop="startDate" content="2007"""
  26.     """itemprop="startDate" content="2006"""
  27.     """itemprop="startDate" content="2005"""
  28.     """itemprop="startDate" content="2004"""
  29.     """itemprop="startDate" content="2003"""
  30.     """itemprop="startDate" content="2002"""
  31.     """itemprop="startDate" content="2001"""
  32.     """itemprop="startDate" content="2000"""
  33. ]
  34.  
  35. #Criteria you want to include anyway, if they show up for Things I Don't Like
  36. #Things_I_like = [
  37.    
  38. #]
  39.  
  40. valid = False
  41. while not valid:
  42.     num = random.randint(1,13111)
  43.     link = "%s%d" % (baselink, num)
  44.     urllib.urlretrieve(link, "temp.html")
  45.     page = open("temp.html").read()
  46.  
  47.  
  48.     if any(thing in page for thing in Things_I_dont_like):
  49.         print (link, "Nope.")
  50.     #elif not any(thing in page for thing in Things_I_like):
  51.         #print (link, "Nope.")
  52.     else:
  53.         webbrowser.open(link)
  54.         os.remove("temp.html")
  55.         valid = True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement