Пример #1
0
def add_status(collection, title, link):
    save_tweeted_link(collection, link, title)
    content = '%s %s' % (title, link)
    if len(content) > 140:
        tlen = len(content) - len(link) - 1
        content = '%s %s' % (title[:tlen], link)
    print content
    post2twi(content)
    post2douban(content)
Пример #2
0
def add_status(collection, title, link):
    save_tweeted_link(collection, link, title)
    content = '%s %s' % (title, link)
    if len(content) > 140:
        tlen = len(content) - len(link) - 1
        content = '%s %s' % (title[:tlen], link)
    print content
    post2twi(content)
    post2douban(content)
Пример #3
0
def add_status(title, link, is_twitter, collection):
    # Twitter changed the 140-character limit in 2016 May
    # https://blog.twitter.com/2016/doing-more-with-140-characters
    if is_twitter == True and \
       (link.find('photo') != -1 or link.find('video') != -1):
        if len(title) > 140:
            title = title[:136] + '...'
        content = '%s %s' % (title, link)
    else:
        content = '%s %s' % (title, link)
        if len(content) > 140:
            tlen = 140 - len(link) - 5
            content = '%s %s' % (title[:tlen] + '...', link)
    post2twi(content)
    # post2douban(content)
    if collection:
        save_tweeted_link(collection, link, title)
Пример #4
0
def add_status(title, link, is_twitter, collection):
    # Twitter changed the 140-character limit in 2016 May
    # https://blog.twitter.com/2016/doing-more-with-140-characters
    # Expand to 280 in Nov 2017 http://bit.ly/2SBG1Yw
    if is_twitter == True and \
       (link.find('photo') != -1 or link.find('video') != -1):
        if len(title) > TWEET_LENLIMIT:
            title = title[:TWEET_LENLIMIT - 2] + '…'.decode('utf-8')
        content = '%s %s' % (title, link)
    else:
        content = '%s %s' % (title, link)
        if len(title) + 1 + TWEET_SHORTURL_LEN > TWEET_LENLIMIT:
            tlen = TWEET_LENLIMIT - TWEET_SHORTURL_LEN - 3
            content = '%s %s' % (title[:tlen] + '…'.decode('utf-8'), link)
    post2twi(content)
    # post2douban(content)
    if collection:
        save_tweeted_link(collection, link, title)