Skip to content

Commit

Permalink
完善搜索关键词找不到验证滑块的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
linkin committed Aug 15, 2019
1 parent b6451ec commit ef8cb75
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 10 deletions.
48 changes: 45 additions & 3 deletions component/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -1646,9 +1646,10 @@ def follow_followings_of_user(self,uid,
no_weitt=False,
count=COUNT_FOLLOWING,
ALL=True,
MDB=False,
):
user = TTUser(uid)
followings = user.get_followings(count=count,ALL=ALL)
followings = user.get_followings(count=count,ALL=ALL,MDB=MDB)
uids = [i.get('user_id') for i in followings]
self.follow_users(uids,
skip_no_fans=skip_no_fans,
Expand All @@ -1665,13 +1666,54 @@ def unfollow_followings_of_user(self,uid,
no_weitt=False,
count=COUNT_FOLLOWING,
ALL=True,
MDB=False,
):
user = TTUser(uid)
followings = user.get_followings(count=count, ALL=ALL)
followings = user.get_followings(count=count, ALL=ALL,MDB=MDB)
uids = [i['user_id'] for i in followings if i.get('user_id')]
self.unfollow_users(uids,
only_no_fans=only_no_fans,
only_no_followings=only_no_followings,
no_articles=no_articles,
no_videos=no_videos,
no_weitt=no_weitt)
no_weitt=no_weitt)

def follow_fans_of_user(self,uid,
skip_no_fans=False,
skip_no_followings=False,
no_articles=False,
no_videos=False,
no_weitt=False,
count=COUNT_FOLLOWING,
ALL=True,
MDB=False,
):
user = TTUser(uid)
fans = user.get_fans(count=count,ALL=ALL,MDB=MDB)
uids = [i.get('user_id') for i in fans]
self.follow_users(uids,
skip_no_fans=skip_no_fans,
skip_no_followings=skip_no_followings,
no_articles=no_articles,
no_videos=no_videos,
no_weitt=no_weitt)

def unfollow_fans_of_user(self,uid,
only_no_fans=False,
only_no_followings=False,
no_articles=False,
no_videos=False,
no_weitt=False,
count=COUNT_FOLLOWING,
ALL=True,
MDB=False,
):
user = TTUser(uid)
fans = user.get_fans(count=count, ALL=ALL,MDB=MDB)
uids = [i['user_id'] for i in fans if i.get('user_id')]
self.unfollow_users(uids,
only_no_fans=only_no_fans,
only_no_followings=only_no_followings,
no_articles=no_articles,
no_videos=no_videos,
no_weitt=no_weitt)
Binary file added img/big.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/big_s.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/block.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/block_s.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added log/log.txt
Empty file.
2 changes: 1 addition & 1 deletion settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
URL_USER_RELATION = URL_HOST +'/c/user/relation/{id}/'
URL_ARTICLE_ITEM = 'https://www.toutiao.com/a{item_id}/'
URL_LOGIN_HOME = 'https://sso.toutiao.com/'
URL_SEARCH_TEST = 'https://www.toutiao.com/search/?keyword='
URL_SEARCH_TEST = 'https://www.toutiao.com/search/?keyword=pylinc'
URL_TTH = 'https://mp.toutiao.com/profile_v3/index'
URL_TTH_COMMENTS = 'https://mp.toutiao.com/profile_v3/weitoutiao/comment'
URL_PGC_IMG_PREFIX = 'https://p3.pstatp.com/list/'
Expand Down
16 changes: 10 additions & 6 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
# def ass(res):
# print(res)
#
# if __name__ == '__main__':
# a = TTBot()
# account = a.account
# news_spider = a.news_spider
# uids = ['50502346173', '4377795668', '3640241275','70105485318','97658287933']
if __name__ == '__main__':
a = TTBot()
account = a.account
u = TTUser('50502346173')
news_spider = a.news_spider
uids = ['50502346173', '4377795668', '3640241275','70105485318','97658287933']
account.follow_fans_of_user('65445676041',count=200,ALL=False)
# print(a.search(f'古天乐',USER=True,strict=True))
# print(account.wenda_analysis())
# print(account.delete_article('6602141020383609358'))
# print(account.unstore_media('6711635660941296132'))
Expand All @@ -29,6 +32,7 @@
# print(account.delete_wenda_draft('6711665324736905475'))
# print(account.post_reply('thisisatest','6689315272605565452','6689386720494043147','86931246069'))
# print(account.unfollow_followings_of_user('4377795668',count=20,ALL=False))

# print(account.unfollow_users(uids))
# news_spider.get_recommend_news(last_time='2019-07-07 10:50:00',MDB=1)
# a.search('Gucci',MDB=1,USER=True)
Expand Down Expand Up @@ -77,7 +81,7 @@
# u.get_followings(ALL=True,MDB=1)
# a.login()
# a.login_helper.stop()
# a.search('Java',MDB=1)

# a.get_regimen_news(MDB=1, ALL=True)
# account.unfollow_user('92961638858')
# account.get_posted_articles(MDB=1)
Expand Down

0 comments on commit ef8cb75

Please sign in to comment.