Пример #1
0
def update_subscribed_count():
    for site in sites:
        updated_count = update_subscribed(site)
        if isinstance(updated_count, int):
            print("Updating stats for " + site["name"] + ": " + str(updated_count))
            stat = db_models.SocialStat()
            stat.name = site["name"]
            stat.subscribed_count = updated_count
            db.session.add(stat)
    db.session.commit()
Пример #2
0
def get_channel_info(client, **kwargs):
    response = client.channels().list(**kwargs).execute()

    statistics = response["items"][0]["statistics"]
    updated_count = statistics["subscriberCount"].encode("ascii")
    print("Updating stats for Youtube: " + str(updated_count))

    stat = db_models.SocialStat()
    stat.name = "Youtube"
    stat.subscribed_count = updated_count
    db.session.add(stat)
    db.session.commit()