Skip to main content

gdelt2py

gdelt2py is package to help you download the data from gdelt2 gkg data.

Install

pip install gdelt2py

Usage

  • start_date:

    • The beginning date, in format with '20201020'
    • optional default: '20201020'
  • end_date:

    • The end date, same format
    • optional default: latestdate in gdelt2
  • themes:

    • Currently this package only supports gkg but will support another later.
    • default: 'gkg'
  • out_file:

    • The name of the output file name like "output.csv"
    • default: 'output.csv'
  • data_dir:

    • The data directory for your file downloads
    • default: current directory

Note

  • 20170725 data is missing in gdelt2.
from gdelt2 import Gdelt2

t = Gdelt2()
t.required(themes=["WB_678_DIGITAL_GOVERNMENT"])
t.optional(locations=["#JA#","#CG#","#AG#","#US#"])
t.download_files()

Gdelt2 data format

The Gdelt Global Knowledge Graph (GKG) Data format Codebook v2.1

  • GKGRecordId

    • YYYYMMDDHHMMSS-X
      • Example: The fifth GKG record generated in 3:30AM on February 3, 2015. 20150203033000-5
    • YYYYMMDDHHMMSS-TX
      • 20150203033000-T5 French-language document
  • Date

    • YYYYMMDD (GKG2.0)
    • YYYYMMDDHHMMSS (GKG2.1)
  • SourceIdentifier

    • 1: WEB (The document originates from the open web and the DocumentIdentifier is a fully-qualified URL that can be used to access the document on the web).
    • 2: CITATIONONLY (The document originates from a broadcast, print, or other offline source in which only a textual citation is available for the document. In this case the DocumentIdentifier contains the textual citation for the document).
    • 3: CORE (The document originates from the CORE archive and the DocumentIdentifier contains its DOI, suitable for accessing the original document through the CORE website).
    • 4: DTIC (The document originates from the DTIC archive and the DocumentIdentifier contains its DOI, suitable for accessing the original document through the DTIC website).
    • 5: JSTOR (The document originates from the JSTOR archive and the DocumentIdentifier contains its DOI, suitable for accessing the original document through your JSTOR subscription if your institution subscribes to it).
    • 6: NONTEXTUALSOURCE (The document originates from a textual proxy (such as closed captioning) of a non-textual information source (such as a video) available via a URL and the DocumentIdentifier provides the URL of the non-textual original source. At present, this Collection Identifier is used for processing of the closed captioning streams of the Internet Archive Television News Archive in which each broadcast is available via a URL, but the URL offers access only to the video of the broadcast and does not provide any access to the textual closed captioning used to generate the metadata. This code is used in order to draw a distinction between URL-based textual material (Collection Identifier 1 (WEB) and URL-based non-textual material like the Television News Archive).
  • SourceCommonName

  • DocumentIdentifier

  • V1Counts

    • AFFECT, ARREST, KIDNAP, KILL, PROTEST, SEIZE, or WOUND
    • Count Number
    • Object Type
    • Location Type
    • Location FullName
    • Location CountryCode
    • Location ADM1Code
    • Location Latitude
    • Location Longitude
    • Location FeatureID
  • V2Counts

  • V1Themes

  • V2Themes

  • V1Locations

  • V2Locations

  • V1Persons

  • V2Persons

  • V1_Organizations

  • V2_Organizations

  • Tone

  • V2EnhancedDate

  • GCAM

  • urlImage

  • urlImageRelated

  • urlSocialMediaImageEmbeds

  • urlSocialMediaVideoEmbeds

  • quotations

  • V2AllNames

  • V2Amounts

  • V2TranslationInfo

  • xmlExtras

Release files for gdelt2py 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gdelt2py 0.1.6
File Size Uploaded
gdelt2py-0.1.6.tar.gz 9.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gdelt2py 0.1.6
File Interpreter ABI Platform
gdelt2py-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size:17.2 kB

Release files / gdelt2py-0.1.6.tar.gz

Download URL gdelt2py-0.1.6.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d6ea2fffe2839649847930a5141157d0e6410517f5595f9dbcc971218451ebae
BLAKE2b-256 checksum
How to use checksums
0c071f7f2d712a3f16b0e6380c0d4eabf1b354cb939e30e44761816b1c6021a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Release files / gdelt2py-0.1.6-py3-none-any.whl

Download URL gdelt2py-0.1.6-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fa228f5120b5c5880b62bdf28005521668762db6d5d8db30abe3c82856ee17bc
BLAKE2b-256 checksum
How to use checksums
f9a8dad170dad8482415b693bed460e98ddff4f22517438b36da33254e0aea00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page