Search code examples
pythongdelt

Sending a parameter to GDELT API is not returning the expected result


I'm trying to connect to Gdelt Doc API and so far I can send all the query parameters except for one of them. Before I get to the problem I want you to see the code.

So if you call this method it will send a request to gdelt API (Doc API) and return the list of web sites that given search word appears on it. It has many filters one of which is Domain.

When I enter a Domain for example:cnn.com , it won't return only the websites from that domain which is the expected behaivior.

Has anyone, any experience with this?


Solution

  • domain and station should be passed directly after the query parameter for example check this Url.

    https://api.gdeltproject.org/api/v2/doc/doc?query=Volkswagen%20domain:cnn.com&mode=artlist&repeat3:%22Volkswagen%22
    

    if you want to search for more than one domain you have to use (domain:FIRST DOMAIN%20OR%20domain:SECOND DOMAIN)

    check this example:

    https://api.gdeltproject.org/api/v2/doc/doc?query=Volkswagen%20(domain:bloomberg.com%20OR%20domain:cnn.com)&mode=artlist&repeat3:%22Volkswagen%22