Giter Site home page Giter Site logo

dhammo2 / geotwittermining Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 2.0 61 KB

This code utilises the twitter API to obtain information on a given geographical region. The code has two main functionalities: obtaining the top 50 trends in a given region (single run), or listening on the twitter API to obtain tweets as they are posted (continuous run).

License: GNU Affero General Public License v3.0

Python 90.76% TSQL 9.24%
woeid twitter-api twitter geographic-data-science data-mining flickr-api

geotwittermining's Introduction

geoTwitterMining

Description

This code utilises the twitter API to obtain information on a given geographical region. The code has two main functionalities: obtaining the top 50 trends in a given region (single run - designed to run on a cronjob at 5 minute intervals as this is how long trends stay stagnant for), and listening on the twitter API to obtain tweets as they are posted (continuous run).

The code also links with the Flickr API to identify the geographic bounding boxes (longitude and latitude pairs) of a given WOEID.

Requirements

Setup

  1. Download all files in the ./code/ sub-directory of this repository.
  2. Run the geoTwitterMining.sql file to create the appropriate MySQL database.
  3. Edit the credentials.json file, replacing the empty quotes with your authentication details.
  4. Open the command prompt and move to the relevant directory.
  5. Enter the following command
python start-mining.py --locationID <1> --request <2> --credJSON <3>

where:

  • locationID (<1>) is the WOEID for the region of interest. A full list of which can be viewed in woeidList.json and an updated list obtained by calling woeidList = IdentifyWOEIDLocations(api).
  • request (<2>) is a choice of trends to obtain the current top 50 trends for the specified locationID or stream to listen on the API and save tweets as they become available.
  • credJSON (<3>) is the filepath/name of the credentials JSON file.

For example, to listen for tweets from London UK you would call the following:

python start-mining.py --locationID 44418 --request stream --credJSON credentials.json

Citing This Code

Please accredit this code by citing the following in your references.

@phdthesis{hammocks_2019, title={Horizon Scanning Through Computer-Automated Information Prioritisation}, author={Hammocks, Daniel}, year={2019}}

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.