Coder Social home page Coder Social logo

twitter_scraper-1's Introduction

Twitter Scraper

Scraping twitter content from twitter streaming API, in python3.

このレポジトリは,Marsam-Ma-zz/twitter_scraperを日本語リプライ収集用に独自改良したものです.

ChatBot,クソリプ収集目的等にご利用ください.

環境

  • Twitter Streaming API
  • Python 3.6+

使い方

Set up

  1. Twitter API tokens を入手
  2. config.yml.default をコピーして config.yml を作成.
  3. config.yml に 1. で入手した自分の tokens をそれぞれ記入.
  4. pip install -r requirments.txt

実行

screenコマンド等を用いると便利です.

python twitter.py

corpus/ja_YYYYMMDD_HHMMSS.txtに保存されます.

また,このスクリプトは問題が発生する限り半永久的に収集しますのでご注意ください.

出力

(例) 実際には日本語

Line number Sentences
1 誕生日おめでとう!
2 ありがとう!
3 おはようー
4 おは!

それぞれ Line number(1,2),(3,4) がそれぞれ独立した会話のペアになっており,
奇数行が発言,偶数行がそれに対する返信となっています.

フィルター

stream.filterを用いて監視を行います.

trackに指定した文字列により,指定の検索ワードでストリーミングが行えます. デフォルトでは,

track=['私','あなた','俺','ー','する','です','ます','けど','何','@', '#', '#', '。', ',', '!','?','…', '.', '!','?', ',', ':', ':', '』', ')', ')', '...']

という適当な文字列を指定しています.

さらに自分でフィルターを改良することができます.
詳しくは公式ガイドを参照ください.

twitter_scraper-1's People

Contributors

muemulag avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.