This repository was archived by the owner on Nov 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 212
Times of India news scraper #261
Merged
powerexploit
merged 2 commits into
powerexploit:master
from
rutujadhanawade:times_of_india
Sep 18, 2020
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
## Scraping Times of India | ||
|
||
Scraping times of india top headlines in four domains : Flash news, News in Bulletin, Entertainment, Latest news. | ||
using REquests and Beautiful Soup Modules. | ||
|
||
Link for Website - "http://timesofindia.indiatimes.com/" | ||
|
||
 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import requests | ||
import datetime | ||
from bs4 import BeautifulSoup | ||
|
||
url = "http://timesofindia.indiatimes.com/" | ||
|
||
# Use requests library to get html from artist's page | ||
response = requests.get(url) | ||
# Make the html soup object | ||
soup = BeautifulSoup(response.content, 'html.parser') | ||
|
||
print("\t!!!**The Times of India**!!!") | ||
today = datetime.date.today() | ||
print(today.strftime('\tThe date %d, %b %Y')) | ||
|
||
# scrping times of India in four domains: | ||
print("\n\t\t****Flash news****") | ||
for div in soup.findAll('div', attrs={'id':'featuredstory'}): | ||
for a in div.findAll('a'): | ||
print(a.text) | ||
|
||
print("\n\t\t**** News in Bulletin ****") | ||
for div in soup.findAll('div', attrs={'class':'top-story'}): | ||
for a in div.findAll('li'): | ||
print (a.text) | ||
|
||
|
||
print("\n\t\t**** Entertainment ****\t") | ||
for div in soup.findAll('div', attrs={'class':'entrmnt-wdgt-outer'}): | ||
for a in div.findAll('li'): | ||
print(a.text) | ||
|
||
|
||
print("\n\t\t**** Latest News ****\t\n") | ||
for div in soup.findAll('div', attrs={'id':'lateststories'}): | ||
for a in div.findAll('li'): | ||
print(a.text) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.