Skip to content
This repository has been archived by the owner on Feb 21, 2021. It is now read-only.

Commit

Permalink
yiban dev sucks
Browse files Browse the repository at this point in the history
  • Loading branch information
simonsmh committed Sep 25, 2018
1 parent a0f713f commit 88e9acb
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 25 deletions.
17 changes: 10 additions & 7 deletions ybqt.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,17 @@ def runVote(self):
self.pro = self.pro + self.prog
self.prosig.emit(self.pro)
self.wait()

voteget = []
for i in range(0, int(self.vote_control_count)):
try:
self.vote_id = ybvote.vote(
votevote = ybvote.vote(
self.token,
self.puid,
self.group_id
).get(
self.vote_control_count
)["data"]["list"][i]["id"]
)
if not voteget:
voteget = votevote.get(self.vote_control_count)
self.vote_id = voteget[i]["id"]
votego = ybvote.go(
self.token,
self.puid,
Expand Down Expand Up @@ -216,6 +217,7 @@ def runTopic(self):
self.pro = self.pro + self.prog
self.prosig.emit(self.pro)
self.wait()
topicget = []
for i in range(0, int(self.topic_control_count)):
try:
topicgo = ybtopic.topic(
Expand All @@ -224,8 +226,9 @@ def runTopic(self):
self.group_id,
self.channel_id
)
self.article_id = topicgo.get(self.topic_control_count)[
"data"]["list"][i]["id"]
if not topicget:
topicget = topicgo.get(size=self.topic_control_count)
self.article_id = topicget[i]["id"]
if self.topic_up:
try:
response = topicgo.up(self.article_id)
Expand Down
36 changes: 19 additions & 17 deletions ybtopic.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,25 @@ def add(self, title, content):
获取话题 <- 正则
'''

def get(self, size=0, Sections_id=-1, need_notice=0, my=0):

payload = {
'channel_id': self.channel_id,
'puid': self.puid,
'group_id': self.group_id,
'page': 0,
'size': size,
'orderby': 'updateTime',
'Sections_id': Sections_id,
'need_notice': need_notice,
'my': my
}

Get_Topic = r.post(BASEURL + 'forum/article/listAjax',
cookies=self.token, data=payload, timeout=10)
return Get_Topic.json()
def get(self, size=0, page=0, Sections_id=-1, need_notice=0, my=0):
tmp = []
for i in range(1, size//10 + 1): # Extend json list to control size
payload = {
'channel_id': self.channel_id,
'puid': self.puid,
'group_id': self.group_id,
'page': i, # Should be 0 originally, work as disable page parse
'size': 10, # Stick to 10 by stupid dev working yiban
'orderby': 'updateTime',
'Sections_id': Sections_id,
'need_notice': need_notice,
'my': my
}

Get_Topic = r.post(BASEURL + 'forum/article/listAjax',
cookies=self.token, data=payload, timeout=10)
tmp.extend(Get_Topic.json()["data"]["list"])
return tmp # Return larger list, the overflowing lists could be droped by function.

'''
获取评论
Expand Down
2 changes: 1 addition & 1 deletion ybvote.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def get(self, size=10, page=0, status=1, sort=1, time=0):

Get_Vote = r.post(BASEURL + 'vote/index/getVoteList',
cookies=self.token, data=payload, timeout=10)
return Get_Vote.json()
return Get_Vote.json()["data"]["list"]


class go:
Expand Down

0 comments on commit 88e9acb

Please sign in to comment.