本文整理汇总了Python中pydelicious.get_urlposts函数的典型用法代码示例。如果您正苦于以下问题:Python get_urlposts函数的具体用法?Python get_urlposts怎么用?Python get_urlposts使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_urlposts函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initializeUserDict
def initializeUserDict(tag, count = 5):
usr_dict = {}
for most_popular in get_popular(tag = tag)[0 : count]:
for person in get_urlposts(most_popular['href']):
usr = person['user']
usr_dict[usr] = {}
return usr_dict
示例2: initializeUserDict
def initializeUserDict(tag,count=5):
user_dict = {}
all_items = {}
# get the top count' popular posts
for p1 in get_popular(tag=tag)[0:count]:
# find all users who posted this
for p2 in get_urlposts(p1['href']):
user = p2['user']
user_dict.setdefault(user,{})
# get user posts
for i in range(3):
try:
posts = get_userposts(user)
break
except:
print "Failed user "+user+", retrying"
time.sleep(4)
for post in posts:
url = post['href']
user_dict[user][url] = 1.0
all_items[url] = 1
#fill in missing items with 0
[ratings.setdefault(item,0.0) for item in all_items for ratings in user_dict.values()]
return user_dict
示例3: initialize
def initialize(tag,count=5):
user_dict = {}
for p1 in get_popular(tag=tag)[0:count]:
for p2 in get_urlposts(p1['url']):
user = p2['user']
user_dict[user] = {}
return user_dict
示例4: initializeUserDict
def initializeUserDict(tag, count=5):
user_dict = {}
for p1 in tag[0:count]:
for p2 in get_urlposts(p1):
user = p2["user"]
user_dict[user] = {}
return user_dict
示例5: initializeUserDict
def initializeUserDict(tag, count=5):
user_dict = {}
for p1 in get_popular(tag=tag)[0:count]:
for p2 in get_urlposts(p1["url"]):
user = p2["user"]
user_dict[user] = {}
return user_dict
示例6: initializeUserDict
def initializeUserDict(tag ,count = 5):
user_dict = {}
#get the top count popular posts
for p1 in get_popular(tag = tag)[0:count]:
for p2 in get_urlposts(p1['url']):
user = p2['user']
user_dict[user] = {}
return user_dict
示例7: initializeUserDict
def initializeUserDict(tag, count=5):
user_dict={}
# 获取前count个最受欢迎的张
for p1 in get_popular(tag = tag)[0:count]:
for p2 in get_urlposts(p1['href']):
user=p2['user']
user_dict[user] = {}
return user_dict
示例8: initlizeUserDict
def initlizeUserDict(tag, count = 5):
user_dict = {}
#获取所有用户都提交过的链接
for p1 in get_popular(tag=tag)[0:count]:
for p2 in get_urlposts(p1['href']):
user = p2['user']
user_dict[user]={}
return user_dict
示例9: initialize_user_dict
def initialize_user_dict(tag,count=5):
user_dict={}
# Get the top "count" popular posts
for p1 in pydelicious.get_popular(tag=tag)[0:count]:
# Find all users who posted the same post url
for p2 in pydelicious.get_urlposts(p1['url']):
user=p2['user']
user_dict[user]={}
return user_dict
示例10: initializeUserDict
def initializeUserDict(tag, count=30): # 引数に tag と count をとる、count の指定がなければ 5
user_dict = {}
# popular な投稿を 0 から count 番目まで取得
for p1 in get_popular(tag=tag)[0:count]:
# このリンクを投稿したすべてのユーザを取得
for p2 in get_urlposts(p1['href']):
user = p2['user']
user_dict[user] = {}
return user_dict
示例11: initializeUserDict
def initializeUserDict(tag, count=5):
user_dict={}
# отримати рахунок найпопулярніших лінків
for p1 in get_popular(tag=tag)[0:count]:
# знайти всіх користувачів, які зберегли цей лінк
for p2 in get_urlposts(p1['href']):
user=p2['user']
user_dict[user]={}
return user_dict
示例12: initializeUserDict
def initializeUserDict(tag,count=5):
user_dict={}
# count개의 인기 게시물을 얻음
for p1 in get_popular(tag=tag)[0:count]:
# 이 게시물을 올린 모든 사용자를 얻음
for p2 in get_urlposts(p1['href']):
user=p2['user']
user_dict[user]={}
return user_dict
示例13: initializeUserDict
def initializeUserDict(tag, count = 5):
user_dict = {}
# read in top "count" popular posts
for p1 in get_popular(tag = tag)[0:count]:
#find all users who posted this
for p2 in get_urlposts(p1['url']):
user = p2['user']
user_dict[user] = {}
return user_dict
示例14: initializeUserDict
def initializeUserDict(tag, count=5):
user_dict={}
for p1 in get_popular(tag=tag)[0:count]:
# get_urlposts()는 주어진 url에 대한 모든 게시글을 리턴
for p2 in get_urlposts(p1['url']):
# 리턴된 게시글들의 '유저이름'을 가져옴. '유저이름'의 value는 일단 null로 둠
user=p2['user']
user_dict[user]={}
return user_dict
示例15: initializeUserDict
def initializeUserDict(tag,count=2):
user_dict={}
# get the top count' popular posts
for p1 in get_popular(tag=tag)[0:count]:
# find all users who posted this
for p2 in get_urlposts(p1['href']):
user=p2['user']
user_dict[user]={}
return user_dict