mirror of
https://github.com/nova-r/fediplug.git
synced 2025-01-22 16:46:55 +01:00
Merge branch 'master' of git://github.com/bbonf/fediplay into bbonf-master
This commit is contained in:
commit
6fd3e94a4b
1 changed files with 5 additions and 1 deletions
|
@ -13,6 +13,8 @@ from fediplay.queue import Queue
|
|||
|
||||
Mastodon = mastodon.Mastodon
|
||||
|
||||
LISTEN_TO_HASHTAG = 'fediplay'
|
||||
|
||||
|
||||
def api_base_url(instance):
|
||||
'''Create an API base url from an instance name.'''
|
||||
|
@ -41,7 +43,7 @@ class StreamListener(mastodon.StreamListener):
|
|||
return
|
||||
|
||||
tags = extract_tags(status)
|
||||
if 'fediplay' in tags:
|
||||
if LISTEN_TO_HASHTAG in tags:
|
||||
links = extract_links(status)
|
||||
for link in links:
|
||||
try:
|
||||
|
@ -83,6 +85,8 @@ def stream(instance, users, client_id, client_secret, access_token, cache_dir='.
|
|||
users = [normalize_username(user, instance) for user in users]
|
||||
listener = StreamListener(Queue(cache_dir), instance, users)
|
||||
click.echo('==> Streaming from {}'.format(instance))
|
||||
for t in client.timeline_hashtag(LISTEN_TO_HASHTAG, limit=1):
|
||||
listener.on_update(t)
|
||||
client.stream_user(listener)
|
||||
|
||||
def extract_tags(toot):
|
||||
|
|
Loading…
Reference in a new issue