15.3: Setting up a Twitter app - Twitter Bot Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 ก.ค. 2024
  • This video covers how to set up a Twitter app for a bot. How do you sign up and get keys? How do you authenticate with Twitter in a node.js app using the Twit node package? What is Oauth?
    All examples: github.com/shiffman/Video-Les...
    Twit package: github.com/ttezel/twit
    Contact: / shiffman
    Next video:
    • 15.4: Twitter API Basi...
    Learn JavaScript basics:
    • Start learning here!
    Learn Processing basics:
    th-cam.com/users/shiffman...
    More about data and APIs:
    • 10: Working with data ...
    Help us caption & translate this video!
    amara.org/v/Qbtq/
    📄 Code of Conduct: github.com/CodingTrain/Code-o...

ความคิดเห็น • 125

  • @MattKander
    @MattKander 7 ปีที่แล้ว +57

    This is the single best series of tutorials i've seen. Thank you so much for all the time and effort you put into these. They're helping me learn immensely.

  • @louissmith4024
    @louissmith4024 7 ปีที่แล้ว +19

    I like how you apologize for your 'sidetrack mumbles,' but sometimes they actually have some pretty good information in them lol

  • @mateenshaikh5608
    @mateenshaikh5608 7 ปีที่แล้ว +11

    i never get bored watching daniels videos like twice or thirce.... big thumbs up

  • @Dave-is6ih
    @Dave-is6ih 7 ปีที่แล้ว +1

    The way you teach keeps the viewer interested and entertained, I love it. This is my first video that i've watched but Subscribed! Keep up the good work!

  • @abdulkadirosman2816
    @abdulkadirosman2816 6 ปีที่แล้ว +4

    The last bit about security was great and appreciated! Thanks!

  • @pintaridergaming
    @pintaridergaming 6 ปีที่แล้ว +11

    update as of july 2018, you have to apply in order to be able to make apps, just fyi for anyone trying to follow this.

  • @MONUKUMAR-jk8xl
    @MONUKUMAR-jk8xl 6 ปีที่แล้ว +1

    Hey Daniel, You are too funny and so is your teaching style. Keep it up.

  • @sadabmm
    @sadabmm 6 ปีที่แล้ว

    Good explanation with such amazing energy! Great work!

  • @RabbiVole42
    @RabbiVole42 4 ปีที่แล้ว +3

    people may have beaten me to this, but! if you're trying to do this in 2020, it still works- broadly- but you have to actually apply for a developer account and API access via dev.twitter.com or whatever. it's a fairly breezy process; you just briefly describe what you want to use it for and exactly what twitter functions you intend to use. some of the menus look different, but everything related to node.js and twit seem to still be sound.
    *that said*, i have yet to receive anything saying i was 'approved' for API access but have still been able to make tweets with the methods in this series about half an hour after i applied. i don't know how restrictive this system actually is; maybe automating interactions with other accounts requires oversight and approval but you're allowed to post into the void from the jump? who knows. good luck!

  • @JMSTipsAndTricks
    @JMSTipsAndTricks 7 ปีที่แล้ว

    Cheers man, you crack me up. These videos are all awesome and super approachable for learning code. Just a little aside from this comment though... the phrase "maybe you're not even watching this anymore" never actually applies unless the people you've made this video for are only the ones who left earlier... Anyway, back from the aside to the comment .... Keep up the great work!

  • @Dumpstermuffin1
    @Dumpstermuffin1 6 ปีที่แล้ว

    thank you for this video, i understand API's a lot better after watching this. In class i was totally confused

  • @thibautevrard939
    @thibautevrard939 7 ปีที่แล้ว +2

    Thank you for that tutorial Daniel, You are so helpfull!

  • @yessirge
    @yessirge 5 ปีที่แล้ว +1

    Please actually revisit this tutorial! It's so helpful

  • @esparda07
    @esparda07 7 ปีที่แล้ว

    Subscribed!
    You are a very good teacher.
    Thank you.

  • @forgoroe
    @forgoroe 6 ปีที่แล้ว

    Great video, great addendum! Appreciated

  • @vineet5678
    @vineet5678 5 ปีที่แล้ว

    this is helpful , you are a great teacher

  • @oxmodius
    @oxmodius 6 ปีที่แล้ว

    Your videos are so good.

  • @masterflamaster6377
    @masterflamaster6377 7 ปีที่แล้ว +2

    woooooooaaahh.... its the first time i see him programming in js without p5!

  • @masha5444
    @masha5444 4 ปีที่แล้ว +3

    So, in 2019 you have to apply and get approved to make a bot app. This is what I put in my description if anyone needs it: "I'm a web development student following the "15.3: Setting up a Twitter app - Twitter Bot Tutorial" video on TH-cam from The Coding Train channel. My goal is to make a Twitter bot and practice using npm and working with APIs."
    and for specifics:
    "I will use get a request so my bot will have an ability to search by hashtags and retweet them. Will retweet tweets with hashtags such as "cuteparrots".
    And for a second spec: "Will use post command so my bot will have a tweet and retweet functionality to post tweets and pictures of mainly birds and parrots and fun facts. No direct messages functionality.". For the last 2 questions, I said no.

    • @thenicksterd2334
      @thenicksterd2334 4 ปีที่แล้ว

      Thank you!

    • @sarveshkarki
      @sarveshkarki 4 ปีที่แล้ว

      I am getting "Server error - application not submitted
      Invalid data received, could not process request"
      Is there any solution to this problem ?
      Can I change my input and re-apply ?

  • @calvinlee4358
    @calvinlee4358 7 ปีที่แล้ว +2

    You are the best!

  • @prvs8
    @prvs8 8 ปีที่แล้ว

    thank you very much!!

  • @kirthanathomas264
    @kirthanathomas264 5 ปีที่แล้ว +1

    Hey, great video!! Would you also make a tutorial on making a slack-bot as well, please?

  • @NickNaumovich
    @NickNaumovich 7 ปีที่แล้ว

    I love his ADD, reminds me of myself.

  • @krzysztofjuszczak906
    @krzysztofjuszczak906 6 ปีที่แล้ว

    For this documentation hopefully tutorials and lots of information ;) 5:17

  • @Mhmdshoeb
    @Mhmdshoeb 6 ปีที่แล้ว

    Thanks for making this series, I am building my first app through all the information and knowledge you share, how much time on an avg does twitter take to verify my account???
    its been 2-3 days i am waiting for their authentication.

  • @adrianoldchannel2494
    @adrianoldchannel2494 6 ปีที่แล้ว

    Nice

  • @itsmeshaner
    @itsmeshaner 8 ปีที่แล้ว

    Awesome video! Let's say I wanted to set up all the Oauth keys so that I could have a friend download my program and run it using his own account, while keeping my information secret. How could I do that?

  • @magicknicksthunder
    @magicknicksthunder 7 ปีที่แล้ว

    Very Very Very Very Very Gud

  • @DroidTsuenik9
    @DroidTsuenik9 5 ปีที่แล้ว +2

    Instead of that config.js file, you could store your keys in the environmental variables and access them from there. I think it's a better way doing it like this because otherwise you would need to document what the config file stores in it.

    • @TheCodingTrain
      @TheCodingTrain  5 ปีที่แล้ว +3

      Yes! I am going to show this in a future video!

  • @RealSoundNow
    @RealSoundNow 8 ปีที่แล้ว +3

    I laughed, I cried, I learned ..

  • @SreekantShenoy
    @SreekantShenoy 6 ปีที่แล้ว +2

    To fix this error, Just reinstall package (npm install twit --save)
    throw err;
    ^
    Error: Cannot find module '/Users/mac/bot.js'
    at Function.Module._resolveFilename (module.js:325:15)
    at Function.Module._load (module.js:276:25)
    at Function.Module.runMain (module.js:441:10)
    at startup (node.js:139:18)
    at node.js:968:3

  • @bwbs7410
    @bwbs7410 ปีที่แล้ว

    Twitter has changed its access to the API. From my understanding, they are not currently offering essential access but you can apply for elevated access. I applied and I guess I will wait and see

  • @animepcrocks
    @animepcrocks 6 ปีที่แล้ว

    3:25 That laugh though...

  • @hitta750
    @hitta750 6 ปีที่แล้ว

    there is a timeout_ms under the authentication keys now?

  • @theotherbabies
    @theotherbabies 5 ปีที่แล้ว

    I cannot get my terminal to display text 'The bot is starting' although it does not give me an error code.

  • @olserra
    @olserra 5 ปีที่แล้ว

    I am trying here to run the code with the new command var T = new Twit(config); but terminal returns an error for me. I installed some extensions on Visual Studio Code, restarted it, but still not working. Any sugestions?

  • @loukask.9111
    @loukask.9111 7 ปีที่แล้ว +14

    best is, that he finds it interesting to be hacked :D

    • @blasttrash
      @blasttrash 6 ปีที่แล้ว

      It sure is. :D :P

  • @xmrelasticbandx
    @xmrelasticbandx 7 ปีที่แล้ว

    MVP

  • @parulatreya5063
    @parulatreya5063 7 ปีที่แล้ว

    I'm getting this error when I try to open the javascript file (bot.js in your case)
    module.js:471
    throw err;
    ^
    Error: Cannot find module 'K:
    ode2\hello.js'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:393:7)
    at startup (bootstrap_node.js:150:9)
    at bootstrap_node.js:508:3

  • @parulatreya5063
    @parulatreya5063 7 ปีที่แล้ว

    I saved a text file as bot.js but can't read it in windows cmd? Any thoughts?

  • @sarveshkarki
    @sarveshkarki 4 ปีที่แล้ว +1

    I am getting "Server error - application not submitted
    Invalid data received, could not process request"
    Is there any solution to this problem ?

  • @jordanmiguel8501
    @jordanmiguel8501 8 ปีที่แล้ว +2

    Hi Dan, Loving your videos. I've been following your steps along, however Ive ran into a problem now. When I try to run the node bot.js in terminal, I get this error message - module.js:327
    throw err;
    ^
    Error: Cannot find module '/Users/mac/bot.js'
    at Function.Module._resolveFilename (module.js:325:15)
    at Function.Module._load (module.js:276:25)
    at Function.Module.runMain (module.js:441:10)
    at startup (node.js:139:18)
    at node.js:968:3
    Any idea? I've looked all over the net for almost 2 hours! Thanks

    • @misterhtmlcss
      @misterhtmlcss 7 ปีที่แล้ว +1

      Hey @jordan you need to tell us way way more to get help. That's like saying 'It won't start!" and we are all like, what won't start? A car? Your computer? Your toothbrush? What kind of toothbrush? You have an electric brush? And it doesn't start? That's so weird! You are weird! ....and then we all lose interest. Now I'm sure you solved your problem by now, but I just thought the lesson of how to share your issue may still be unresolved, so hopefully the next time you have a problem you'll be very descriptive e.g. OS, what stage this error happened, what versions of NodeJS, the tool being installed, etc. All these things are the minimums for us to be able to help you. Good luck and enjoy the course, I know I certainly am :))

    • @rayane4975
      @rayane4975 7 ปีที่แล้ว +1

      Hi, sorry I'm a year late, Try --in the command line-- to go to the same directory where your bote.js is located then type: node bote.js

  • @codeforest9027
    @codeforest9027 4 ปีที่แล้ว

    Dan, I'm wondering what would this be like in ES6. Instead of var Twit would we use class Twit? Do you have an updated tutorial?

    • @darcy4487
      @darcy4487 4 ปีที่แล้ว

      I'm only just starting myself but I watched a vid yesterday that might have some hints th-cam.com/video/jpV1B2N4IxY/w-d-xo.html

  • @bruvno
    @bruvno 8 ปีที่แล้ว +3

    I'm gonna write a bot to comment all your videos with a "Big tank you Daniel".....

    • @TheCodingTrain
      @TheCodingTrain  8 ปีที่แล้ว

      +bruzz pixel Haha! (thanks for watching)

  • @akshitbhatia694
    @akshitbhatia694 7 ปีที่แล้ว +1

    Hi,
    I have entered my consumer_key and other authentication information from the development page as explained but yet when ever i run my js file, the error comes which reads like ' Twit config must include `consumer_key` when using user auth.'
    Kindly assist me with a possible solution.

    • @cyberguide_in
      @cyberguide_in 6 ปีที่แล้ว

      Any luck? Same problem here. Someone would like to help us.

  • @duvvipydiraju4183
    @duvvipydiraju4183 3 ปีที่แล้ว

    Please share about iptv

  • @yourgaurdianangel
    @yourgaurdianangel 6 ปีที่แล้ว

    anyone else having issues in the first few minutes of the video? i feel like its very simple issue regarding path but ive tried this on both my mac and pc and i cant get the node bot.js command to show the console log call. i noticed that his "terminal" is showing his path or folder hes in but in my terminal it shows my name like this "firstnamelastname-- -bash --80X24" i just dont understand why i cant navigate or figure out how to use my terminal properly

  • @artemmelkumov7621
    @artemmelkumov7621 8 ปีที่แล้ว

    Daniel, thank you for your videos! But i' ve got a problem, when i try to get a tweet. Console write this
    { errors: [ { code: 32, message: 'Could not authenticate you.' } ] }
    What can i do?

    • @TheCodingTrain
      @TheCodingTrain  8 ปีที่แล้ว

      +Артем Мелкумов Check to make sure your API keys are correct.

    • @artemmelkumov7621
      @artemmelkumov7621 8 ปีที่แล้ว

      They are correct. I checked several times. I don't know what's wrong with it!

  • @jofrescaricaciottoli1442
    @jofrescaricaciottoli1442 7 ปีที่แล้ว

    Someone knows how to instal p5.js on windows??? plase helppp

  • @tranthimai4377
    @tranthimai4377 6 ปีที่แล้ว

    good

  • @saradaqiq1613
    @saradaqiq1613 7 ปีที่แล้ว

    How can use twitter data (tweets) to respond to a user in messenger bot?
    I love your videos. I made a twitter just to follow along with this.

    • @TheCodingTrain
      @TheCodingTrain  7 ปีที่แล้ว

      Do you mean Facebook messenger? I haven't looked it its API yet, but I'd like to sometime!

    • @saradaqiq1613
      @saradaqiq1613 7 ปีที่แล้ว

      yeah. That would be awesome!
      Also, how can I get all tweets from a particular user? in the example, you searched a word. How would I write the T.get(...)? thanks

  • @noob_player_in_the_field
    @noob_player_in_the_field 5 ปีที่แล้ว +1

    do I need a developer account of twitter for this to work?

    • @TheCodingTrain
      @TheCodingTrain  5 ปีที่แล้ว +2

      Twitter has changed their developer rules so a lot of this doesn't apply anymore, I am going to try to make updated ones soon!

  • @mahmuttekyildiz
    @mahmuttekyildiz 2 ปีที่แล้ว +1

    I'm just watching this video, and everything has changed on twitter now :) , where can I find the updated tutorial?

  • @abhishekprasad6691
    @abhishekprasad6691 6 ปีที่แล้ว

    6:38 At this moment he knew....... He f*cked up...

  • @Vyath2
    @Vyath2 6 ปีที่แล้ว

    If you can't use google voice to create another phone number to authorize your app - just create an app on your main twitter account (that has your personal number) and use the following script to authorize your bot to use that app credentials: github.com/aparrish/example-twitter-bot-node/blob/master/get_tokens.js

  • @kennyl7542
    @kennyl7542 8 ปีที่แล้ว

    Hi Dan, say I want to create a website to display projects like SmartRockets or simulation programs running on your book site, what's more videos have you not yet taught for me to do so? By the way, thanks again for all the great videos you have done, and it just came to my mind that if there is rating for the richest people in the world in terms of their video value, I will definitely rate you Number 1 :)

    • @TheCodingTrain
      @TheCodingTrain  8 ปีที่แล้ว

      +Kenny L Take a look at this wiki page! github.com/processing/p5.js/wiki/Embedding-p5.js

    • @kennyl7542
      @kennyl7542 8 ปีที่แล้ว

      Thanks a lot Dan

    • @adamkidman2645
      @adamkidman2645 7 ปีที่แล้ว

      botchief plus.google.com/u/0/115747088185550025111/posts/h2Rjp6DTp1x

  • @joshcruz3184
    @joshcruz3184 6 ปีที่แล้ว +4

    Cant find the "Manage Your Apps" link? Go to apps.twitter.com

    • @andrewk71
      @andrewk71 5 ปีที่แล้ว

      He should pin this!

  • @angelbythewings
    @angelbythewings 6 ปีที่แล้ว

    got subscription on lynda just to find out there is such an awesome stuff for free on youtube

  • @shamsagel
    @shamsagel 6 ปีที่แล้ว

    hey,
    i am having this error "ReferenceError: require is not defined" do you know what is the reason of it ?

  • @sankamohottala6778
    @sankamohottala6778 4 ปีที่แล้ว

    started doing but now i have to have a developer account and have to wait until authentication..

  • @elmfilmsinc
    @elmfilmsinc 8 ปีที่แล้ว +1

    Yep, I'm with some others here. Can't go any further with your vids. Stuck here. When I try the node bot.js command I get the following:
    SyntaxError: Unexpected token ILLEGAL
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:513:28)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.runMain (module.js:575:10)
    at run (bootstrap_node.js:352:7)
    at startup (bootstrap_node.js:144:9)
    at bootstrap_node.js:467:3
    And trying to go the next step of npm start gives me:
    Failed to parse json
    npm ERR! Unexpected token '“' at 7:5
    npm ERR! “start”: “node bot.js”,
    npm ERR! ^
    npm ERR! File: /Users/drivenamewithheld/Documents/Node/Gracebot/package.json
    npm ERR! Failed to parse package.json data.
    npm ERR! package.json must be actual JSON, not just JavaScript.
    npm ERR!
    Also, worth mentioning that loading up Twit did NOT create the "dependencies" in the package like it does in your demo. I had to type those in by hand which I've checked and triple-checked in case I put something wrong in. Those are:
    ],
    "author": "",
    "license": "ISC”,
    “dependencies”: {
    “twit”: “^2.2.4”
    }

    • @matthewsanetra
      @matthewsanetra 7 ปีที่แล้ว

      You are using the wrong ". Copy an existing one from the JSON you showed at the end of your comment.

  • @jankobosch5667
    @jankobosch5667 8 ปีที่แล้ว

    I get this error: Can't find variable: require Have any tips on what might cause this?

    • @TheCodingTrain
      @TheCodingTrain  8 ปีที่แล้ว

      +Janko Bosch This is likely some weird syntax error (comma, semi-colon, parentheses, etc. out of place.)

  • @ThabangBosaka
    @ThabangBosaka 7 ปีที่แล้ว

    good day, how come i am having this error Error: Twit config must include `consumer_key` when using user auth., i have all my keys and tokens and veried from dev.twitter.com but still i get that error what could be the cause of this?

    • @ThabangBosaka
      @ThabangBosaka 7 ปีที่แล้ว

      i just moved the tokens and keys back to Twit({}) then it started to work

    • @anushgopalakrishnan
      @anushgopalakrishnan 4 ปีที่แล้ว

      @@ThabangBosaka I know I'm three years late but you probably didn't comment out the var T = new Twit() line in your code before running it

  • @nalux
    @nalux 6 ปีที่แล้ว

    Maybe this should be updated to reflect twitters changes as of july 2018. Now an application is requiered to setup a dev account @twitter

    • @TheCodingTrain
      @TheCodingTrain  6 ปีที่แล้ว +1

      Yes, I'll have to revisit these videos, oy.

    • @abdulsalphan
      @abdulsalphan 2 ปีที่แล้ว

      @@TheCodingTrain has this been revisited?

  • @NgaNguyen-ju1hu
    @NgaNguyen-ju1hu 6 ปีที่แล้ว

    Hay qua!

  • @buzzmj99
    @buzzmj99 5 ปีที่แล้ว

    Since July 2018 you need to have a verified twitter developer account.
    You need to apply for it and hope to get the permission to use the dev tools ...

    • @TheCodingTrain
      @TheCodingTrain  5 ปีที่แล้ว +1

      Alas, yes, I need to revisit these tutorials. .

  • @dr.mikeybee
    @dr.mikeybee 4 ปีที่แล้ว

    Try printing T to see errors.

  • @eotikurac
    @eotikurac 8 ปีที่แล้ว

    isn't there a way for you to make a twitter account for all of us where our bots would post pictures all into that one account?

    • @TheCodingTrain
      @TheCodingTrain  8 ปีที่แล้ว +2

      +BaconKwagga Thanks for the comment. That's an interesting idea, certainly possible. But at the moment I think it would be too much trouble to maintain and support.

    • @abdulmansyur7775
      @abdulmansyur7775 7 ปีที่แล้ว

      Your coourseеeе doesn't wоrk аt mе tо gеt Twitter, nevеrtheless i found aa grеater oneeеe hack. twitter.com/eb01863c092a0cbca/status/789420521322524672 15 3 Sеtting up a Twitter apр Twitteeeer Bot Тutоrial

  • @slashcaret1046
    @slashcaret1046 5 ปีที่แล้ว

    The process to apply for developers Account and to create an app
    is slightly hectic now.

  • @anantwag19
    @anantwag19 8 ปีที่แล้ว

    Interesting body language :-)

  • @funnydev6472
    @funnydev6472 6 ปีที่แล้ว

    hihihihi

  • @yessirge
    @yessirge 5 ปีที่แล้ว

    too bad it doesn't work exaxtly like that anymore :(

  • @NgaNguyen-ju1hu
    @NgaNguyen-ju1hu 6 ปีที่แล้ว

    hay

  • @FordExplorer-rm6ew
    @FordExplorer-rm6ew 4 ปีที่แล้ว

    Npm install Twitter
    Npm install twit
    Have things changed since this was released?

  • @k4qdex
    @k4qdex 5 ปีที่แล้ว

    what kind of drugs is this guy on? random laughs lol

  • @NgaNguyen-ju1hu
    @NgaNguyen-ju1hu 6 ปีที่แล้ว

    em

  • @NgaNguyen-ju1hu
    @NgaNguyen-ju1hu 6 ปีที่แล้ว

    hi

  • @tradilife
    @tradilife 4 ปีที่แล้ว +2

    i am 4 yr too late

  • @AlVerGmz
    @AlVerGmz 7 ปีที่แล้ว

    var is so... 2015 :')

  • @yerramillirohith5720
    @yerramillirohith5720 7 ปีที่แล้ว

    u got a son?

  • @tranthimai4377
    @tranthimai4377 6 ปีที่แล้ว

    jfb

  • @landon3139
    @landon3139 5 ปีที่แล้ว

    I like the vids but you drag them out to much

  • @Souljacker7
    @Souljacker7 7 ปีที่แล้ว

    DUDE! CALM DOWN!

  • @funnydev6472
    @funnydev6472 6 ปีที่แล้ว

    hi