GithubHelp home page GithubHelp logo

vendz / dailyhunt-api Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 2.0 36 KB

An unofficial API to fetch DailyHunt news with python

Home Page: dailyhunt-api.vercel.app

License: MIT License

Python 99.57% Procfile 0.43%
dailyhunt api flask-api dailyhunt-api news-api

dailyhunt-api's Introduction

DailyHunt API (DEPRECATED)

This API is capable of fetching news contents from various sources as gathered by DailyHunt.


News Categories

This API supports category wise news. Here is a complete list of all categories.

  1. Science
  2. Technology
  3. India
  4. automobile
  5. entertainment
  6. sports
  7. world
  8. lifestyle
  9. employment
  10. religion
  11. football
  12. movie

Usage

see all the available categories

https://dailyhunt.vandit.cf/categories

Example - https://dailyhunt.vandit.cf/categories


see all the available languages

https://dailyhunt.vandit.cf/languages

Example - https://dailyhunt.vandit.cf/languages


Make a request specifying the category of news you want

https://dailyhunt.vandit.cf/dailyhunt?category=<your-category>

Example - https://dailyhunt.vandit.cf/dailyhunt?category=technology


Make a request specifying the language of news you want

https://dailyhunt.vandit.cf/dailyhunt?category=<your-category>&language=<your-language>

Example - https://dailyhunt.vandit.cf/dailyhunt?category=technology&lang=hindi


Make a request specifying items you want in on page

https://dailyhunt.vandit.cf/dailyhunt?category=<your-category>&items=<your-items>

Example - https://dailyhunt.vandit.cf/dailyhunt?category=technology&lang=hindi&items=30


Parameters

  • Optional Parameters

    • Language
    • Items
  • Compulsory Parameters

    • Category

Default values of the parameters:

Language = english
items = 10

Response Format

The response JSON Object looks something like this -

{
  category: "world",
  count: 10,
  data: [
  { 
    PublishedTime: "2021-06-09 09:08:32",
    content: "Damascus [Syria], June 9 (ANI): A fresh Israeli missiles strike targeted military sites in Syria on Tuesday night, Syrian media reported. The Syrian army said it shot down some missiles fired by Israel, Syria's state news agency SANA reported The Syrian air defences were triggered by the attack as people in the capital of Damascus saw Syrian air defence missiles being fired into the sky.SANA said the Israeli attack was launched from inside the Lebanese airspace, as Israeli warplanes usually attack Syria from Lebanon.Some people in the northwestern province of Latakia and the central province of Homs told Xinhua that they also witnessed an Israel i attack.",
    imageUrl: "http://assets-news-bcdn.dailyhunt.in/cmd/resize/400x400_80/fetchdata16/images/90/31/ee/9031ee1a88a2295db9640fd2d0d0b09efc41829f5bb1657f448321b004016b22.jpg",
    publisherStory: "https://www.aninews.in/news/world/middle-east/destroyed-missiles-fired-by-israel-says-syria20210609053541",
    title: "Destroyed missiles fired by Israel, says Syria",
    url: "http://dhunt.in/gYtlp",
    viewCount: "667"
  },
  {
    PublishedTime: "2021-06-09 09:08:32",
    content: "Washington [US], June 9 (ANI): US Senate on Tuesday passed bipartisan legislation aimed at countering China's growing influence by investing over USD 200 billion in American technology, science and research. The final vote was 68-32. Independent Senator Bernie Sanders of Vermont was the only member of the Democratic caucus to vote against the bill. Nineteen Senate Republicans joined Democrats voting in favour of the bill, CNN reported. The bill still needs to pass the House before going to President Joe Biden's desk. The sweeping legislation -- called the US Innovation and Competition Act -- aims to confront China 's influence on multiple fronts and "will supercharge American innovation and preserve our competitive edge for generations to come," said Majority Leader Chuck Schumer who co-wrote the bill. Schumer described the vote as a necessary step to keep America in the game against countries such as China , and a significant legislative accomplishment after months of behind-the-scenes talks.",
    imageUrl: "http://assets-news-bcdn.dailyhunt.in/cmd/resize/400x400_80/fetchdata16/images/31/35/3d/31353d4a7e3353606d2b81bc5258618986b6b5306b84babba81dd579b7ae9491.jpg",
    publisherStory: "https://www.aninews.in/news/world/us/us-senate-passes-bipartisan-bill-to-counter-chinas-growing-economic-influence20210609051334",
    title: "US Senate passes bipartisan bill to counter China's growing economic influence",
    url: "http://dhunt.in/gYlT2",
    viewCount: "5.1k"
  },
],
  "success": true
}

Setup

Install all dependencies listed in requirements.txt file.

  1. To install all dependencies run -

    $ sudo -H pip3 install -r requirements.txt
  2. Start the server

    $ python app.py

This API was used to build a News app


You can fork the repo and deploy on VPS, Heroku or Vercel :)

Deploy to Vercel


⭐ the Repo in case you liked it :)

Made with ❤️ in India

dailyhunt-api's People

Contributors

vendz avatar

Stargazers

 avatar  avatar

Watchers

 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.