Mining Twitter with Python : 2 - Collecting data from Twitter

preview_player
Показать описание
In order to interact with the Twitter APIs, we need a Python client that implements the different calls to the APIs itself.

We will use Tweepy in these tutorials and see how to build our application in multiple parts to collects data from our own Twitter timeline and other users timeline.
-----

------

----

----
Schedule: New educational videos every week
-----
-----

-----
Learn Something New:
------
-----
Learn Something New:
------
Рекомендации по теме
Комментарии
Автор

I was going to start over, I just got a little busy in the last day or so. I see you have another tutorial "Python Web Scraping Tutorial 17 – Twitter API" I was thinking of try that one first to see how it goes. Either way, I will go over this one again. I want to get it right and see where I went wrong.

drewconroy
Автор

if you're having problems with setting up environment variables, set the keys as strings
consumer_key = " "
consumer_secret = " "
access_token = " "
access_token_secret = " "

add your keys between the quotes without leaving spaces.
that should work

samuelkyama
Автор

Your code was extremely helpful. I was able to collect Tweets from both my own and another person's home timeline. Do you have a github where you keep all your twitter scraping codes?

JoyceYLee
Автор

For me its giving error: Twitter environment variable not set
although i have set all the four variables. i'm using ubuntu. please help

ksdivya
Автор

Hi, I am currently doing a research which requires getting old tweets(older than a year). I have tried to find the code for it for a month now but have been unsuccessful.
Could you please help me!

nitigyahanda
Автор

Hi: I am really enjoying your videos but when I went to run the code for the first time I am getting the following error: tweepy.error.TweepError: {"errors":[{"code":215, "message":"Bad Authentication data."}]}. I tried looking it up but I am not having any luck so far. I am using Windows 10 pro by the way. Your thoughts?

drewconroy
Автор

I checked everything and now I keep getting the error message: TWITTER_* environment variables not set
I tried adding the 4 keys in each of these ways:

set
echo

I checked the environment variables and made sure the path was set to the file storing Tweepy.
I also made sure the file path was set for the file folder with twitter_client.py and
twitter_get_home_timeline.py in in the CMD. I know its not recommended but maybe hard coding the
keys in the twitter_client.py thoughts?

drewconroy
Автор

I am going to start over and go step by step, creating a new app as well. I will let you know what happens, thanks again for the help.

drewconroy
Автор

Okay, I tried using Tweepy again. This is after totally clearing out my computer and reinstalling windows 10 pro. I have
been going to do that for others reason for awhile. Not that it would make any difference but you never know. I still got the
same error message. Since then I decided to generate new keys and will try that again.

I tried the python power tools from your latest video "Python Web Scraping Tutorial 17 – Twitter API"
I followed along and created the files then set my twitter keys, the new keys I just generated. I received another error this time.
It looks like it has something to do with the twitter_access_secret. I checked everything but I am going to try it again later.

Here is the error message:

Traceback (most recent call last):
File "twitter1.py", line 8, in <module>
access_secret =
File "C:\Users\Drews\AppData\Local\Continuum\Anaconda3\lib\os.py", line 669, in __getitem__
raise KeyError(key) from None
KeyError: 'TWITTER_ACCESS_SECRET'

drewconroy
Автор

How do I get number of images count present in the Twitter home timeline

parthsonagara
Автор

could you help me please I have problem, it doesn't retrieve any tweetI added these variables to system variables in environmental variables window TWITTER_CONSUMER_KEY 
 TWITTER_CONSUMER_SECRET 
 TWITTER_ACCESS_TOKEN 
 TWITTER_ACCESS_TOKEN_SECRET  and I copied the keys of my twitter application as values for those variables and then  I pressed ok and I closed the window.then I open two python files and I wrote exactly your codesbut when I run the statement that you wrote in cmd, nothing retrieved to me

sarassa
Автор

I just thought of something in regards to my error I mentioned below: tweepy.error.TweepError: {"errors":[{"code":215, "message":"Bad Authentication data."}]} It looks like a Tweepy error, So, I am thinking maybe just using another library instead??

drewconroy
Автор

Hi Sir, Thank you for the video. Also Can you please help me how to get the tweets of other user?

ksdivya
Автор

I did hard code it and tried to run python twitter_get_home_timeline.py in the CMD to check it.
It came back with that error again: TWITTER_* environment variables not set

drewconroy
Автор

I would suggest picking up the pace. The first ten minutes could have been condensed into 2.

marcholman
Автор

Hi Sukhvinder Sir.

How do I define the variables in command prompt.

Regards

akhilesh
Автор

how to set TWITTER_ Environment variable? :)

vinsmokearifka
Автор

Sir your video not very clear, just want know can be acess data from twitter without create API

roopamsrivastava
Автор

if__name__ == '__main__':


SyntaxError: invalid syntax
Plz

mahajoe
Автор

grazie all'aiuto di *CYBER_NEWTON001* su instagram il mio account sospeso è tornato è molto eccellente👍👍👍

muncle
visit shbcf.ru