Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: node app.js
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,20 @@
<p align="center"><img alt="Runrate" height="50%" width="50%" src="https://user-images.githubusercontent.com/54352598/121649660-68709780-cab6-11eb-9bbc-d62307c3a13c.png" /></p>
<br>
<p align="center">
<img alt="Development under progress...!" height="50%" width="60%" src="https://user-images.githubusercontent.com/54352598/121655838-893beb80-cabc-11eb-99a3-c189dfc131cb.gif"/>
<!-- <img alt="Development under progress...!" height="50%" width="60%" src="https://user-images.githubusercontent.com/54352598/121655838-893beb80-cabc-11eb-99a3-c189dfc131cb.gif"/> -->
</p>
<br>
<!--
## Meet our team

- [@ShreyNigam](https://www.github.com/shrey6162)
- [@ManavJain](https://github.com/manavj23)
- [@ViditVikramSingh](https://github.com/vidsingh)

--!>

---------------------------------------------------------------------------------------------------------------------------------




Binary file added Screen Shots/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screen Shots/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screen Shots/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screen Shots/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screen Shots/5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screen Shots/6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const cool = require('cool-ascii-faces');
var express = require("express");
var bodyParser = require("body-parser");
var request = require("request")
var app = express();

app.set("view engine","ejs");
app.use(express.static("public"));

const results = require("./models/Results")
const home = require("./models/Home")
const scheduleOf = require("./models/ScheduleOf")
const tournamentResults = require("./models/Tournaments/TournamentResults")
const recentTournaments = require("./models/Tournaments/RecentTournament")
const tournamentInfo = require("./models/Tournaments/TournamentInfo")
const tournamentStandings = require("./models/Tournaments/TournamentStandings")
const tournamentLeaders = require("./models/Tournaments/TournamentLeaders")
const playerInfo = require("./models/PlayerInfo")
const matchInfo = require("./models/Matches/MatchInfo")
const matchProbabilities = require("./models/Matches/MatchProbabilities")
const matchLineups = require("./models/Matches/MatchLineups")
var apiKey = "vzgmsgqxenvnt7xcfw9qu2rb";

app.get("/",home)
app.get("/results",results)
app.get("/scheduleOf-:id",scheduleOf)
app.get("/playerInfo-:id",playerInfo)
app.get("/recentTournaments",recentTournaments)
app.get("/tournamentInfo-:id",tournamentInfo)
app.get("/tournamentStandings-:id",tournamentStandings)
app.get("/tournamentLeaders-:id",tournamentLeaders)
app.get("/tournamentResults-:id",tournamentResults)
app.get("/match-:id",matchInfo)
app.get("/matchProbabilities-:id",matchProbabilities)
app.get("/lineups-:id",matchLineups)

var port = process.env.PORT || 3000

app.listen(port,function(){
console.log("Cricbuzz server started for " + port)
})
25 changes: 25 additions & 0 deletions models/Home.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
var request = require('request')
var apiKey = "vzgmsgqxenvnt7xcfw9qu2rb"
var Dates = new Date()
var date = Dates.getDate()
var month = Dates.getMonth() + 1
if(month < 10){
month = "0" + month
}
if(date < 10){
date = "0" + date
}
var year = Dates.getFullYear()
home = (req,res)=>{
var dailySchedule = "http://api.sportradar.us/cricket-t2/en/schedules/" + year + "-" + month + "-" + date + "/schedule.json?api_key=" + apiKey
request(dailySchedule,(err,response,body)=>{
if(!err && response.statusCode == 200){
dataSchedule = JSON.parse(body)
res.render("home",{ schedule : dataSchedule.sport_events })
}else{
console.log(err)
res.render("index")
}
})
}
module.exports = home
17 changes: 17 additions & 0 deletions models/Matches/MatchInfo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
var request = require('request')
var apiKey = "vzgmsgqxenvnt7xcfw9qu2rb"

mInfo = (req,res) => {
var matchInfo = "http://api.sportradar.us/cricket-t2/en/matches/" + req.params.id + "/timeline.json?api_key=" + apiKey
request(matchInfo,function(err,response,body){
if(!err && response.statusCode == 200){
parsedMatchInfo = JSON.parse(body)
res.render("Matches/matchInfo", { matchInfo : parsedMatchInfo})
}
else{
console.log(err)
res.render("index")
}
})
}
module.exports = mInfo
16 changes: 16 additions & 0 deletions models/Matches/MatchLineups.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
var request = require('request')
var apiKey = "vzgmsgqxenvnt7xcfw9qu2rb"

mLineups = (req,res)=>{
var lineups = "http://api.sportradar.us/cricket-t2/en/matches/" + req.params.id + "/lineups.json?api_key=" + apiKey
request(lineups,(err,response,body)=>{
if(!err && response.statusCode == 200){
parsedData = JSON.parse(body)
res.render("Matches/matchLineups",{ data : parsedData })
}else{
console.log(err)
res.render("index")
}
})
}
module.exports = mLineups
16 changes: 16 additions & 0 deletions models/Matches/MatchProbabilities.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
var request = require('request')
var apiKey = "vzgmsgqxenvnt7xcfw9qu2rb"

mProbabilities = (req,res) => {
probabilities = "http://api.sportradar.us/cricket-t2/en/matches/" + req.params.id +"/probabilities.json?api_key=" + apiKey
request(probabilities,function(err,response,body){
if(!err && response.statusCode === 200){
parsedProbabilities = JSON.parse(body)
res.render("Matches/matchProbabilities",{ data : parsedProbabilities })
}else{
console.log(err)
res.render("index")
}
})
}
module.exports = mProbabilities
19 changes: 19 additions & 0 deletions models/PlayerInfo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
var request = require('request')
var apiKey = "vzgmsgqxenvnt7xcfw9qu2rb"

pInfo = (req,res) => {
var playerInfo = "http://api.sportradar.us/cricket-t2/en/players/";
playerInfo += req.params.id + "/profile.json?api_key=" + apiKey;
console.log(playerInfo)
request(playerInfo,function(err,response,body){
if(!err && response.statusCode == 200){
parsedPlayerInfo = JSON.parse(body)
res.render("playerInfo",{ playerInfo : parsedPlayerInfo})
}
else{
console.log(err)
res.render("index")
}
})
}
module.exports = pInfo
27 changes: 27 additions & 0 deletions models/Results.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
var request = require('request')
var apiKey = "vzgmsgqxenvnt7xcfw9qu2rb"
var Dates = new Date()
var date = Dates.getDate()
var month = Dates.getMonth() + 1
if(month < 10){
month = "0" + month
}
var year = Dates.getFullYear()
var DateIs = Dates.getDate()
DateIs -= 1
if(DateIs < 10){
DateIs = "0" + DateIs
}
result = (req,res)=>{
var dailyResults = "http://api.sportradar.us/cricket-t2/en/schedules/" + year + "-" + month + "-" + DateIs + "/results.json?api_key=" + apiKey
request(dailyResults,(err,response,body)=>{
if(!err && response.statusCode == 200){
dataResults = JSON.parse(body)
res.render("results",{ results : dataResults.results })
}else{
console.log(err)
res.render("index")
}
})
}
module.exports = result
15 changes: 15 additions & 0 deletions models/ScheduleOf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var request = require('request')
var apiKey = "vzgmsgqxenvnt7xcfw9qu2rb"
schedule = (req,res)=>{
schedule = "http://api.sportradar.us/cricket-t2/en/teams/" + req.params.id + "/schedule.json?api_key=" + apiKey
request(schedule,function(err,response,body){
if(!err && response.statusCode == 200){
data = JSON.parse(body)
res.render("schedule",{ data : data })
}else{
console.log(err)
res.render("index")
}
})
}
module.exports = schedule
17 changes: 17 additions & 0 deletions models/Tournaments/RecentTournament.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
var request = require('request')
var apiKey = "vzgmsgqxenvnt7xcfw9qu2rb"
recent = (req,res)=>{
var tournamentList = "http://api.sportradar.us/cricket-t2/en/tournaments.json?api_key="
tournamentList += apiKey;
request(tournamentList,function(error,response,body){
if(!error && response.statusCode == 200){
parsedList = JSON.parse(body)
res.render("Tournaments/tournaments", { list : parsedList})
}
else{
console.log(error)
res.render("index")
}
})
}
module.exports = recent
19 changes: 19 additions & 0 deletions models/Tournaments/TournamentInfo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
var request = require('request')
var apiKey = "vzgmsgqxenvnt7xcfw9qu2rb"

tInfo = (req,res) => {
var tournamentInfo = "http://api.sportradar.us/cricket-t2/en/tournaments/";
tournamentInfo += req.params.id + "/schedule.json?api_key=";
tournamentInfo += apiKey
request(tournamentInfo, function(error,response,body){
if(!error && response.statusCode == 200){
parsedInfo = JSON.parse(body)
res.render("Tournaments/tournamentInfo", { info : parsedInfo})
}
else{
console.log(error)
res.render("index")
}
})
}
module.exports = tInfo
16 changes: 16 additions & 0 deletions models/Tournaments/TournamentLeaders.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
var request = require('request')
var apiKey = "vzgmsgqxenvnt7xcfw9qu2rb"
tLeaders = (req,res)=>{
var link = "http://api.sportradar.us/cricket-t2/en/tournaments/" + req.params.id + "/leaders.json?api_key=" + apiKey
console.log(link)
request(link,(err,response,body)=>{
if(!err && response.statusCode == 200){
parsedData = JSON.parse(body)
res.render("Tournaments/tournamentLeaders",{ data : parsedData })
}else{
console.log(err)
res.render("index")
}
})
}
module.exports = tLeaders
15 changes: 15 additions & 0 deletions models/Tournaments/TournamentResults.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var request = require('request')
var apiKey = "vzgmsgqxenvnt7xcfw9qu2rb"
tournamentResults = (req,res)=>{
var results = "http://api.sportradar.us/cricket-t2/en/tournaments/" + req.params.id + "/results.json?api_key=" + apiKey
request(results,(err,response,body)=>{
if(!err && response.statusCode == 200){
var parsedData = JSON.parse(body)
res.render("Tournaments/tournamentResults",{ data : parsedData })
}else{
console.log(err)
res.render("index")
}
})
}
module.exports = tournamentResults
20 changes: 20 additions & 0 deletions models/Tournaments/TournamentStandings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
var request = require('request')
var apiKey = "vzgmsgqxenvnt7xcfw9qu2rb"

tStandings = (req,res) => {
url = "http://api.sportradar.us/cricket-t2/en/tournaments/";
url += req.params.id;
url += "/standings.json?api_key=";
url += apiKey;
request(url,function(err,response,body){
if(!err && response.statusCode == 200){
parsedStandings = JSON.parse(body)
res.render("Tournaments/tournamentStandings", { standings : parsedStandings})
}
else{
console.log(err)
res.render("index")
}
})
}
module.exports = tStandings
15 changes: 15 additions & 0 deletions node_modules/.bin/cool-face

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/cool-face.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions node_modules/.bin/cool-face.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions node_modules/.bin/is-ci

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/is-ci.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading