Browse Source

Modify and add some functions

master
Sven Slootweg 9 years ago
parent
commit
db38973a69
  1. 17
      webshotslib.py

17
webshotslib.py

@ -16,7 +16,18 @@ def get_user_listings(url):
return matches
def get_users(url):
def get_users(url, allow_quotes):
contents = urllib.urlopen(url).read()
matches = re.findall('http:\/\/community\.webshots\.com\/user\/([^/\'"]+)', contents)
return [value for value in matches if value != "my"]
if allow_quotes == True:
matches = re.findall('http:\/\/community\.webshots\.com\/user\/([^/]+)', contents)
else:
matches = re.findall('http:\/\/community\.webshots\.com\/user\/([^/\'"]+)', contents)
count = contents.count("http://community.webshots.com/user/")
return [value for value in matches if value != "my"], count
def search_query(query):
query = urllib.quote(query.ljust(3, "%") + "%")
return get_users("http://www.webshots.com/explore/member?action=userSearch&username=%s" % query, True)
Loading…
Cancel
Save