Esempio n. 1
0
 def __send(self, text, url):
     passwd_dict = PasswdUtil.get_passwd_dict()
     browser = LoginController.get_browser()
     try:
         service.send_weibo(text, url, LoginController.mobile_login(browser, passwd_dict[Const.WEIBO_USERNAME], passwd_dict[Const.WEIBO_PASSWD]))
     except Exception as e:
         print e
         browser.quit()
Esempio n. 2
0
def publish_articles():
    url = 'http://www.jianshu.com'
    html = BeautifulSoup(HttpUtil.request(url))
    articles_soup = [ parse_article_soup(article)  for article in html.find(attrs={"class": "article-list thumbnails"}).findAll('li')]
    sorted_articles = sorted(articles_soup, key=lambda articl_soup:articl_soup[0], reverse=True)
    article_body = service.jian_shu_article_retrive(url + sorted_articles[0][1])
    browser = LoginController.get_browser()
    passwd_dict = PasswdUtil.get_passwd_dict()
    send_text = '《%s》 又到每天推荐文章的时候到了,这些都是精选的枕边读物哦,希望大家喜欢@当幸福敲不开门[害羞][害羞][害羞] ' % article_body[0]
    service.send_weibo(send_text, service.txt_to_pic(article_body[1], browser),  LoginController.mobile_login(browser, passwd_dict[Const.WEIBO_USERNAME], passwd_dict[Const.WEIBO_PASSWD]))
Esempio n. 3
0
 def __send(self, text, url):
     passwd_dict = PasswdUtil.get_passwd_dict()
     browser = LoginController.get_browser()
     try:
         service.send_weibo(
             text, url,
             LoginController.mobile_login(browser,
                                          passwd_dict[Const.WEIBO_USERNAME],
                                          passwd_dict[Const.WEIBO_PASSWD]))
     except Exception as e:
         print e
         browser.quit()
Esempio n. 4
0
def publish_articles():
    url = 'http://www.jianshu.com'
    html = BeautifulSoup(HttpUtil.request(url))
    articles_soup = [
        parse_article_soup(article)
        for article in html.find(attrs={
            "class": "article-list thumbnails"
        }).findAll('li')
    ]
    sorted_articles = sorted(articles_soup,
                             key=lambda articl_soup: articl_soup[0],
                             reverse=True)
    article_body = service.jian_shu_article_retrive(url +
                                                    sorted_articles[0][1])
    browser = LoginController.get_browser()
    passwd_dict = PasswdUtil.get_passwd_dict()
    send_text = '《%s》 又到每天推荐文章的时候到了,这些都是精选的枕边读物哦,希望大家喜欢@当幸福敲不开门[害羞][害羞][害羞] ' % article_body[
        0]
    service.send_weibo(
        send_text, service.txt_to_pic(article_body[1], browser),
        LoginController.mobile_login(browser,
                                     passwd_dict[Const.WEIBO_USERNAME],
                                     passwd_dict[Const.WEIBO_PASSWD]))