Skip to content
Snippets Groups Projects
Commit cdfa5606 authored by Millot Lucas's avatar Millot Lucas
Browse files

1ere version recup image

parent 5cddb550
No related branches found
No related tags found
No related merge requests found
Pipeline #1756 failed
import tweepy
# We import our access keys:
from credentials import *
def twitter_setup():
"""
Utility function to setup the Twitter's API
with an access keys provided in a file credentials.py
:return: the authentified API
"""
# Authentication and access using keys:
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_TOKEN, ACCESS_SECRET)
# Return API with authentication:
api = tweepy.API(auth)
return api
def collect_image_url(txt):
# renvoie les derniers tweets contenant tweet
liste_url=[]
connexion = twitter_setup()
tweets = connexion.search(txt, language="english", rpp=100, count=100)
for tweet in tweets:
liste_url.append(tweet.entities['media'][0]['media_url'])
return liste_url
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment