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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Amarujala/scraper/spiders/amarUjala.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ def parse_item(self,response):
item['title']=Selector(response).xpath('//meta[@name="twitter:title"]/@content').extract()
item['des']=Selector(response).xpath('//meta[@name="twitter:description"]/@content').extract()
item['key']=Selector(response).xpath('//meta[@name="keywords"]/@content').extract()
item['imageUrl']=Selector(response).xpath('//meta[@name="twitter:image"]/@content').extract()
item['imageUrl']=Selector(response).xpath('//meta[@property="og:image"]/@content').extract()
date_info=Selector(response).xpath('//span/@datetime').extract()
item['date_published']=datetime.strptime(date_info[0],"%Y-%m-%d %H:%M:%S")
yield item

yield item
12 changes: 8 additions & 4 deletions Jansatta/jansatta1.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
from lxml import html
import time

# List to store all article-urls from each page
urls = []

for i in xrange(315) :
for i in xrange(1,315) :
page = requests.get("http://www.jansatta.com/latest-news/page/"+str(i)+"/?s=news")
time.sleep(5)
tree = html.fromstring(page.content)
article_urls = tree.xpath('//div[@class="newslistbx"]/h3/a/@href')
for j in article_urls:
# Each article url is appended in a global list urls[]
urls.append(j)


#Now request is being send to each article page and required data is scraped
for k in urls:
page = requests.get(k)
tree = html.fromstring(page.content)
Expand All @@ -20,8 +23,9 @@
page_url = k
date_time = tree.xpath('//meta [@itemprop="dateModified"]/@content')
keyword = tree.xpath('//meta [@name="keywords"]/@content ')

#collection.insert({"url":page_url, "title":title})

# Data will be inserted in mongodb
# collection.insert({"url":page_url, "title":title})
print(title)
time.sleep(5)

Expand Down
3 changes: 1 addition & 2 deletions Livehindustan/HNC/spiders/HNC_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ def parse_item(self, response):
item['summary'] = Selector(response).xpath('//meta[@name="description"]/@content').extract()
item['description'] = Selector(response).xpath('//meta[@name="twitter:description"]/@content').extract()
item['keywords'] = Selector(response).xpath('//meta[@name="keywords"]/@content').extract()
dt = Selector(response).xpath('//span[@class="story_float_rigth"]/font/text()').extract()
item['date_time'] = dt[1]
item['date_time'] = Selector(response).xpath('//meta[@name="article:published_time"]/@content').extract()
item['image_url'] = Selector(response).xpath('//meta[@property="og:image"]/@content').extract()


Expand Down