Skip to content

Instantly share code, notes, and snippets.

@rrguntaka
Last active December 3, 2023 07:27
Show Gist options
  • Save rrguntaka/9c7e38f134400d457fccc86e231b3eec to your computer and use it in GitHub Desktop.
Save rrguntaka/9c7e38f134400d457fccc86e231b3eec to your computer and use it in GitHub Desktop.
Scrape Live India Election results - MLA Elections
//https://results.eci.gov.in/
//https://results.eci.gov.in/AcResultGenDecNew2023/partywiseleadresult-742S29.htm
//Navigating to the candidate list, open developer tools window, adn paste the following snippet in Console
jQuery(".custom-table table tbody tr").map(function (params) {
return {
"Constituency": jQuery("td:nth-child(2)", this).text(),
"Name": jQuery("td:nth-child(3)", this).text(),
"Margin": Number(jQuery("td:nth-child(5)", this).text())
}
})
.get().sort(function(a, b) { return a.Margin - b.Margin })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment