Example #1
0
 def foucs_friend(self, url, webdriver):
     webdriver.get(url)
     webdriver.implicitly_wait(10)
     nums = FriendHomePage.get_friend_info(webdriver)
     foucs_nums = nums[0]
     fans_num = nums[1]
     if foucs_nums/fans_num > 0.5:
         FriendHomePage.focus_action(webdriver)
         time.sleep(3)
     else:
         print '不符合要求,不于关注'
 def __get_weiboer_info(self, weibo):
     try:
         print('访问:'),
         print(weibo.author_url)
         self.browser.get(weibo.author_url)
         time.sleep(4)
         info = FriendHomePage.get_friend_info(self.browser)
         fans_info = FansInfo()
         fans_info.focus_num = info[0]
         fans_info.fans_num = info[1]
         fans_info.weibo_num = info[2]
         weibo.author_info = fans_info
         pass
     except Exception as e:
         pass
Example #3
0
            comment = WeiboPageCommon.comment_parse(comment_list[0])
            url = comment[0]
            return url

    def focuos(self, webdriver):
        TopFrameAction.homeAction(webdriver)
        focus_box = webdriver.find_element_by_id('Pl_Core_T8CustomTriColumn__3')
        focus_box.find_element_by_link_text("关注").click()

if __name__ == '__main__':
    weibo = LoginController('13951640490', 'gongyong505.')
    weibo.login()
    time.sleep(5)
    weibo.browser.get('http://weibo.com/545352510')
    time.sleep(3)
    FriendHomePage.focus_action(weibo.browser)
    FocusPage.next_page_action(weibo.browser)
    f = FollowShipControl()
    f.fouces_friend_of_comment(weibo.browser)
    weibo_list = WeiboPageCommon.get_all_weibo(weibo.browser)
    time.sleep(3)
    for weibo_driver in weibo_list:
        wei = WeiboPageCommon.weibo_parse(weibo_driver)
        if wei.comment_num > 0:
            WeiboPageCommon.comment_action(weibo_driver)
            comment_list = WeiboPageCommon.comment_list(weibo_driver)
            comment = WeiboPageCommon.comment_parse(comment_list[0])
            url = comment[0]
            weibo.browser.get(url)
            FriendHomePage.focus_action(weibo.browser)
            break