forked from erpushpendrasingh/Deccan-Herald-Clone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sports.js
358 lines (355 loc) · 22.5 KB
/
sports.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
let spot = [
{
source: { id: null, name: "YouTube" },
author: null,
title: "Follow the training session LIVE - FC Barcelona",
description: null,
url: "https://www.youtube.com/supported_browsers?next_url=https:%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dx3HNeToXj2Y",
urlToImage:
"https://c.ndtvimg.com/2022-07/6h28sk5g_virat-kohli-afp_625x300_18_July_22.jpg?im=FaceCrop,algorithm=dnn,width=1200,height=675",
publishedAt: "2022-08-27T07:58:09Z",
content: "Your browser isnt supported anymore. Update it to get the best YouTube experience and our latest features. Learn more\r\nRemind me later",
},
{
source: { id: null, name: "NDTV News" },
author: "Vishesh Roy",
title: '"Was Trying To Fake My Intensity": Virat Kohli Opens Up On Recent Struggles - NDTV Sports',
description:
'India batter Virat Kohli has opened up on why he needed to have a break and how he was feeling mentally down, and was trying to "fake" his intensity.',
url: "https://sports.ndtv.com/asia-cup-2022/otherwise-things-can-get-unhealthy-virat-kohli-on-taking-break-ahead-of-asia-cup-3291213",
urlToImage:
"https://c.ndtvimg.com/2022-07/6h28sk5g_virat-kohli-afp_625x300_18_July_22.jpg?im=FaceCrop,algorithm=dnn,width=1200,height=675",
publishedAt: "2022-08-27T06:04:06Z",
content: "Star India batter Virat Kohli has not scored an international ton for more than 1,000 days and the talk surrounding his form is continuing to rise by the minute. The batter was not able to even regis… [+2920 chars]",
},
{
source: { id: null, name: "YouTube" },
author: null,
title: "'Delighted': Neeraj Chopra does it again; becomes first Indian to win Diamond League title - Hindustan Times",
description:
"Olympic gold medallist Neeraj Chopra won the javelin throw competition at the Lausanne Diamond League. He became the first Indian to clinch the prestigious t...",
url: "https://www.youtube.com/watch?v=KDKg3Omk2l8",
urlToImage: "https://i.ytimg.com/vi/KDKg3Omk2l8/hqdefault.jpg",
publishedAt: "2022-08-27T04:58:47Z",
content: null,
},
{
source: { id: null, name: "NDTV News" },
author: "NDTV Sports Desk",
title: "BWF World Championships, Men's Doubles Semi-Final Highlights: Chirag Shetty And Satwiksairaj Rankire.. - NDTV Sports",
description:
"BWF World Championships, Men's Doubles Semi-Final Highlights:Chirag Shetty and Satwiksairaj Rankireddy won a bronze medal at the ongoing BWF World Championships on Saturday.",
url: "https://sports.ndtv.com/badminton/bwf-world-championships-mens-doubles-semi-final-live-3290968",
urlToImage:
"https://c.ndtvimg.com/2022-05/asfa332g_chirag-shetty-satwiksairaj-rankireddy-afp_625x300_19_May_22.jpg?im=FeatureCrop,algorithm=dnn,width=1200,height=675",
publishedAt: "2022-08-27T04:45:00Z",
content: "BWF World Championships, Men's Doubles Semi-Final Highlights: Chirag Shetty and Satwiksairaj Rankireddy won a bronze medal at the ongoing BWF World Championships on Saturday. The duo ended up losing … [+2957 chars]",
},
{
source: { id: null, name: "Livemint" },
author: "Sounak Mukhopadhyay",
title: "Virat Kohli all set to become first Indian player to… | Mint - Mint",
description:
"All eyes will be on Virat Kohli to get back into form with a game-winning shot during the India vs Pakistan match in Asia Cup 2022 on August 28.",
url: "https://www.livemint.com/news/india/virat-kohli-all-set-to-become-first-indian-player-to-11661570414491.html",
urlToImage:
"https://images.livemint.com/img/2022/08/27/600x338/AFP_1JJ5U1_1566464512957_1661573076483_1661573076483.jpg",
publishedAt: "2022-08-27T04:09:18Z",
content: "When India takes the field to play archrivals Pakistan in Dubai on August 28 to open their Asia Cup 2022 campaign, Virat Kohli will play for his country in his 100th T20I match and become the only In… [+3155 chars]",
},
{
source: { id: null, name: "The Hard Tackle" },
author: "Keshav Awasty",
title: "Predicted Manchester United lineup against Southampton: Casemiro set for debut; Ronaldo to return - The Hard Tackle",
description:
"Cristiano Ronaldo is set to return, while Casemiro will make his Manchester United debut against Southampton on Saturday. #Casemiro #EriktenHag #ManchesterUnited",
url: "http://www.thehardtackle.com/news/2022/08/27/predicted-manchester-united-lineup-against-southampton-casemiro-set-for-debut-ronaldo-to-return/",
urlToImage:
"http://www.thehardtackle.com/wp-content/uploads/2018/07/Uruguay-v-Portugal-Round-of-16-2018-FIFA-World-Cup-Russia-1530683398-600x315.jpg",
publishedAt: "2022-08-27T03:56:40Z",
content: "Cristiano Ronaldo is set to return, while Casemiro will make his Manchester United debut against Southampton on Saturday.\r\nManchester United will aim to kick-start a positive run of results when they… [+2770 chars]",
},
{
source: { id: null, name: "NDTV News" },
author: "Vedant Yadav",
title: "Watch: Hong Kong Players Dance To 'Kaala Chashma' After Asia Cup Qualification - NDTV Sports",
description:
"After the match, the Hong Kong players could be seen dancing to the hit song 'Kala Chashma' from the movie 'Baar Baar Dekho'",
url: "https://sports.ndtv.com/asia-cup-2022/hong-kong-players-dance-to-kaala-chashma-after-asia-cup-qualification-watch-3290991",
urlToImage:
"https://c.ndtvimg.com/2022-08/4of5bdrg_hong-kong-twitter-_625x300_27_August_22.jpg",
publishedAt: "2022-08-27T03:23:52Z",
content: "Hong Kong qualified for Asia Cup 2022 with a comprehensive eight-wicket win over the United Arab Emirates earlier this week. Hong Kong will join seven-time champions India and Pakistan in Group A. Th… [+1423 chars]",
},
{
source: { id: null, name: "Tennis World USA" },
author: "Claudiu Pop",
title: "Roger Federer posts retirement-like words, fans “almost had a heart attack” - Tennis World USA",
description:
"Tennis – Hear what are Roger Federer’s words of deep reflection.",
url: "https://www.tennisworldusa.org/tennis/news/Roger_Federer/119456/roger-federer-posts-retirementlike-words-fans-almost-had-a-heart-attack/",
urlToImage:
"https://www.tennisworldusa.org/imgb/121557/roger-federer-posts-retirementlike-words-fans-almost-had-a-heart-attack.webp",
publishedAt: "2022-08-27T03:00:30Z",
content: "Roger Federer panicked his fans with his newest social media post, which looked like a retirement announcement at the first glance. The video, however, was not a retirement announcement but a promoti… [+1683 chars]",
},
{
source: { id: null, name: "Hindustan Times" },
author: "HT Sports Desk",
title: "Watch: 'Batao kaun hai?': Rohit grills reporters over tweets on ‘personal life’ - Hindustan Times",
description:
"Rohit Sharma and Yuzvendra Chahal could be heard enquiring the reporters over tweets and reports about the players' personal lives.",
url: "https://www.hindustantimes.com/cricket/watch-batao-kaun-hai-kya-daala-tha-rohit-sharma-yuzvendra-chahal-grill-reporters-on-tweets-reports-about-players-personal-life-101661567726978.html",
urlToImage:
"https://images.hindustantimes.com/img/2022/08/27/1600x900/Collage_Maker-27-Aug-2022-08.26-AM_1661568970790_1661568979632_1661568979632.jpg",
publishedAt: "2022-08-27T02:57:37Z",
content: "Team India will take on Pakistan in an electrifying clash in the men's Asia Cup 2022 on Sunday night (August 28). The two teams will be meeting for the first time since the T20 World Cup last year, w… [+1836 chars]",
},
{
source: { id: null, name: "Cricbuzz" },
author: null,
title: "Want to have a winning culture at Afghanistan: Trott | Cricbuzz.com - Cricbuzz - Cricbuzz",
description:
"The Afghanistan head coach opened up on the mentality in the side, the importance of Rashid, Nabi's game-reading skills and a lot more in this exclusive chat",
url: "https://www.cricbuzz.com/cricket-news/123615/want-to-have-a-winning-culture-at-afghanistan-trott-cricbuzzcom",
urlToImage:
"//m.cricbuzz.com/a/img/v1/600x400/i1/c241444/can-afghanistan-upset-the-apple-cart-at-the-asia-cup.jpg",
publishedAt: "2022-08-27T02:52:54Z",
content: "Afghanistan head coach Jonathan Trott played down the home advantage that his team have in UAE at the Asia Cup, talked up the game-reading skills of his captain Mohammad Nabi and the need for Rashid … [+3856 chars]",
},
{
source: { id: "espn-cric-info", name: "ESPN Cric Info" },
author: "Sidharth Monga",
title: "Suryakumar Yadav: Behind square, one step ahead of bowlers - ESPNcricinfo",
description:
"His T20 batting in the last three years has been a perfect mix of flair and functionality",
url: "https://www.espncricinfo.com/story/asia-cup-2022-suryakumar-yadav-behind-square-one-step-ahead-of-bowlers-1330884",
urlToImage:
"https://img1.hscicdn.com/image/upload/f_auto/lsci/db/PICTURES/CMS/343700/343778.6.jpg",
publishedAt: "2022-08-27T02:41:50Z",
content: "His T20 batting in the last three years has been a perfect mix of flair and functionality \r\nSuryakumar Yadav is ready in a power position with a high back lift early, but executes shots deliciously l… [+5616 chars]",
},
{
source: { id: null, name: "Hindustan Times" },
author: "HT Sports Desk",
title: "'They think Virat doesn't instil fear anymore because...' - Shadab on Kohli - Hindustan Times",
description:
"Shadab Khan had a rather blunt remark on Virat Kohli as he interacted with reporters ahead of the clash against India in the Asia Cup on Sunday.",
url: "https://www.hindustantimes.com/cricket/watch-they-think-virat-doesn-t-instil-fear-anymore-because-shadab-khan-s-no-nonsense-remark-on-out-of-form-kohli-ahead-of-asia-cup-2022-101661564460483.html",
urlToImage:
"https://images.hindustantimes.com/img/2022/08/27/1600x900/Collage_Maker-27-Aug-2022-07.43-AM_1661566363695_1661566369754_1661566369754.jpg",
publishedAt: "2022-08-27T02:14:18Z",
content: "Team India will return to action in the shortest format of the game on Sunday night (August 28) when it takes on Pakistan in a blockbuster Asia Cup 2022 clash. The two teams renew their rivalry in me… [+2097 chars]",
},
{
source: { id: null, name: "Cricketaddictor.com" },
author: "More by Vicky Singh",
title: "Sri Lanka vs Afghanistan Dream11 Prediction, Fantasy Cricket Tips, Dream11 Team, Playing XI, Pitch Report, Injury Update- Asia Cup 2022 - Cricket Addictor",
description:
"Sri Lanka vs Afghanistan Dream11 Prediction, Fantasy Cricket Tips, Dream11 Team, Playing XI, Pitch Report, Injury Update- Asia Cup 2022",
url: "https://cricketaddictor.com/fantasy-cricket/sri-lanka-vs-afghanistan-dream11-prediction-fantasy-cricket-tips-dream11-team-playing-xi-pitch-report-injury-update-asia-cup-2022/",
urlToImage:
"https://i0.wp.com/cricketaddictor.com/wp-content/uploads/2022/08/Asia-Cup-2022.jpg",
publishedAt: "2022-08-27T02:07:58Z",
content: "Sri Lanka vs Afghanistan Dream11 Prediction, Fantasy Cricket Tips, Dream11 Team, Playing XI, Pitch Report, Injury Update of Asia Cup 2022 match between Sri Lanka and Afghanistan.\r\nSri Lanka vs Afghan… [+5111 chars]",
},
{
source: { id: null, name: "Cricketaddictor.com" },
author: "https://www.facebook.com/CricAddictors/",
title: "IND vs PAK Asia Cup 2022 Match Live T20, Match Date, Match Time, India Playing XI, Pakistan Playing XI, Squads, Live Streaming In India, Live Telecast In India- When and Where To Watch India vs Pakistan Live In Your Country? - Cricket Addictor",
description:
"IND vs PAK Asia Cup 2022 Match Live T20, Match Date, Match Time, India Playing XI, Pakistan Playing XI, Squads, Live Streaming In India, Live Telecast In India- When and Where To Watch India vs Pakistan Live In Your Country?",
url: "https://cricketaddictor.com/asia-cup-2022/ind-vs-pak-asia-cup-2022-match-live-t20-match-date-match-time-india-playing-xi-pakistan-playing-xi-squads-live-streaming-in-india-live-telecast-in-india-when-and-where-to-watch-india-vs-pakist/",
urlToImage:
"https://i0.wp.com/cricketaddictor.com/wp-content/uploads/2022/08/Rohit-Sharma-Babar-Azam-.jpg",
publishedAt: "2022-08-27T02:00:29Z",
content: "IND vs PAK Asia Cup 2022 Match Live T20, Match Date, Match Time, India Playing XI, Pakistan Playing XI, Squads, Live Streaming In India, Live Telecast In India- When and Where To Watch India vs Pakis… [+4720 chars]",
},
{
source: { id: "google-news", name: "Google News" },
author: null,
title: "Adrian Mannarino Races Into First Final Since 2020 - ATP Tour",
description: null,
url: "https://news.google.com/__i/rss/rd/articles/CBMiRWh0dHBzOi8vd3d3LmF0cHRvdXIuY29tL2VuL25ld3MvbWFubmFyaW5vLWJvdGljLXdpbnN0b24tc2FsZW0tMjAyMi1zZtIBAA?oc=5",
urlToImage: null,
publishedAt: "2022-08-27T01:21:57Z",
content: null,
},
{
source: { id: "google-news", name: "Google News" },
author: null,
title: "The Battle For World No. 1 At The US Open Could Come Down To This... - ATP Tour",
description: null,
url: "https://news.google.com/__i/rss/rd/articles/CBMiSmh0dHBzOi8vd3d3LmF0cHRvdXIuY29tL2VuL25ld3MvdXMtb3Blbi0yMDIyLXdvcmxkLW5vLTEtYmF0dGxlLWtleS1tYXRjaGVz0gEA?oc=5",
urlToImage: null,
publishedAt: "2022-08-27T01:06:33Z",
content: null,
},
{
source: { id: null, name: "The Times" },
author: "Richard Tanner",
title: "Jürgen Klopp wants new midfielder in reversal of Liverpool transfer policy - The Times",
description:
"Jürgen Klopp has admitted that Liverpool do need a new midfielder, but insisted that they would not be forced into a panic buy after their underwhelming start t",
url: "https://www.thetimes.co.uk/article/juergen-klopp-wants-new-midfielder-in-reversal-of-liverpool-transfer-policy-0h9t3pfb3",
urlToImage:
"https://www.thetimes.co.uk/imageserver/image/%2Fmethode%2Ftimes%2Fprod%2Fweb%2Fbin%2Fb08c852a-2577-11ed-83fa-560ae4fda953.jpg?crop=1445%2C813%2C209%2C55&resize=1200",
publishedAt: "2022-08-26T23:01:00Z",
content: "Jürgen Klopp has admitted that Liverpool do need a new midfielder, but insisted that they would not be forced into a panic buy after their underwhelming start to the season.\r\nKlopp, who revealed that… [+553 chars]",
},
{
source: { id: null, name: "SB Nation" },
author: "David Pasztor",
title: "Chelsea, Leicester reach ‘verbal agreement’ over Wesley Fofana transfer - We Ain't Got No History",
description: "It’s happening!",
url: "https://weaintgotnohistory.sbnation.com/chelsea-fc-transfer-rumours-news/2022/8/26/23323910/chelsea-leicester-city-reach-verbal-agreement-over-wesley-fofana-transfer-reports",
urlToImage:
"https://cdn.vox-cdn.com/thumbor/5s7X0exQdFAsyKTxvYZ46kk9RIM=/0x237:4026x2345/fit-in/1200x630/cdn.vox-cdn.com/uploads/chorus_asset/file/23973905/1320165992.jpg",
publishedAt: "2022-08-26T20:32:15Z",
content: "The saga of Wesley Fofana hey, that rhymes! looks to have turned the corner towards the home stretch, with Chelsea and Leicester City reportedly reaching a verbal agreement over a transfer fee. Presu… [+1112 chars]",
},
{
source: { id: "espn-cric-info", name: "ESPN Cric Info" },
author: "Vithushan Ehantharajah",
title: "Ben Stokes scripts his moment before ceding centre stage to Ben Foakes - ESPNcricinfo",
description:
"England wicketkeeper follows his captain's lead to play significant innings",
url: "https://www.espncricinfo.com/story/eng-vs-sa-2nd-test-2nd-day-ben-stokes-scripts-his-moment-before-ceding-centre-stage-to-ben-foakes-1330928",
urlToImage:
"https://img1.hscicdn.com/image/upload/f_auto/lsci/db/PICTURES/CMS/344800/344806.6.jpg",
publishedAt: "2022-08-26T20:16:33Z",
content: "Stuart Broad steals back the limelight, just when it seems he's being shunted out of it",
},
{
source: { id: null, name: "ESPN India" },
author: "Rob Dawson",
title: "Man United's €90 million Antony bid rejected by Ajax as player asks for move - sources - ESPN India",
description:
"Manchester United are considering whether to make an improved bid for Antony after Ajax rejected their €90 million offer, sources have told ESPN.",
url: "https://www.espn.in/football/soccer-transfers/story/4730356/man-united-90-million-antony-bid-rejected-by-ajax-sources",
urlToImage:
"https://a.espncdn.com/combiner/i?img=%2Fphoto%2F2022%2F0826%2Fr1053324_1296x729_16%2D9.jpg",
publishedAt: "2022-08-26T19:34:11Z",
content: "Manchester United are considering whether to make an improved bid for Antony after seeing a 90 million offer rejected by Ajax on Friday, sources have told ESPN.\r\nUnited increased their bid after a 80… [+2214 chars]",
},
];
let fet = async () => {
let url = `https://newsapi.org/v2/top-headlines?country=in&category=sports&sportName=football&apiKey=d1b0b64f769b4651bf7def99d13378ab&pageSize=50`;
let res = await fetch(url);
let data = await res.json();
console.log(data.articles);
// append(data.articles);
};
append = (data) => {
let main = document.getElementById("sports");
main.innerHTML = null;
for (let i = 0; i < data.length; i++) {
let div = document.createElement("div");
if (
i === 1 ||
i === 7 ||
i === 11 ||
i === 17 ||
i === 21 ||
i === 27 ||
i === 31
) {
let div1 = document.createElement("div");
div1.setAttribute("id", "sub");
let div2 = document.createElement("div");
div2.setAttribute("id", "sub");
let div3 = document.createElement("div");
div3.setAttribute("id", "sub");
let img = document.createElement("img");
let img1 = document.createElement("img");
let img2 = document.createElement("img");
let content = document.createElement("h3");
let content1 = document.createElement("h3");
let content2 = document.createElement("h3");
img.src = data[i].urlToImage;
content.innerText = data[i].title;
img1.src = data[i + 1].urlToImage;
content1.innerText = data[i + 1].title;
i = i + 1;
img2.src = data[i + 1].urlToImage;
content2.innerText = data[i + 1].title;
i = i + 1;
div1.append(img, content);
div2.append(img1, content1);
div3.append(img2, content2);
div.append(div1, div2, div3);
main.append(div);
} else {
let img = document.createElement("img");
img.src = data[i].urlToImage;
let des = document.createElement("h3");
// des.innerText=el.description;
let content = document.createElement("h3");
content.innerText = data[i].title;
div.append(img, content, des);
main.append(div);
}
}
};
append(spot);
fet();
let cricket = async () => {
let url = ` https://newsdata.io/api/1/news?apikey=pub_10652959f353157463c020e23132a896a6261&q=cricket`;
let res = await fetch(url);
let data = await res.json();
crick(data.results);
};
crick = (data) => {
let main = document.getElementById("crick");
main.innerHTML = null;
data.forEach((el) => {
let div = document.createElement("div");
let img = document.createElement("img");
img.src = `https://wallpaperaccess.com/full/1088580.jpg`;
let p = document.createElement("p");
p.innerText = el.title;
div.append(img, p);
main.append(div);
});
};
cricket();
let foot = async () => {
let url = `https://newsdata.io/api/1/news?apikey=pub_10652959f353157463c020e23132a896a6261&q=football`;
let res = await fetch(url);
let data = await res.json();
football(data.results);
};
football = (data) => {
let main = document.getElementById("football2");
main.innerHTML = null;
data.forEach((el) => {
let div = document.createElement("div");
let img = document.createElement("img");
img.src = `https://images.indianexpress.com/2022/06/india-Football-pic-credit-aiff.jpg`;
let p = document.createElement("p");
p.innerText = el.title;
div.append(img, p);
main.append(div);
});
};
foot();
let ten = async () => {
let url = `https://newsdata.io/api/1/news?apikey=pub_10652959f353157463c020e23132a896a6261&q=tennis`;
let res = await fetch(url);
let data = await res.json();
tennis(data.results);
};
tennis = (data) => {
let main = document.getElementById("ten");
main.innerHTML = null;
data.forEach((el) => {
let div = document.createElement("div");
let img = document.createElement("img");
img.src = `https://media.istockphoto.com/photos/closeup-of-black-modern-rackets-with-light-green-ball-lying-on-tennis-picture-id1184203343?k=20&m=1184203343&s=612x612&w=0&h=mAe9a7Jvu07AGHc2jRuTme9bTI9bWpiRI_UQq4NPb0w=`;
let p = document.createElement("p");
p.innerText = el.title;
div.append(img, p);
main.append(div);
});
};
ten();