steverob / aurs Goto Github PK
View Code? Open in Web Editor NEWAnna University Results Scrapper App
Anna University Results Scrapper App
Context
#TODO new comment
def generate_reg_nos
reg=@start
while reg!=@ending+1
@reg_nos << reg
reg+=1
end
end
def process_url
@url.gsub!(File.extname(@url),".aspx")
end
public
def scrape
puts @reg_nos.inspect
puts @url
@reg_nos.each do |reg_no|
url=@url+"?htno="+reg_no.to_s
puts url
doc=Nokogiri::HTML(open(url))
puts doc
cells=doc.css("td")
puts cells
Auto-opened by DebTrakr
Context
#FIXME comment
def initialize(url,start,ending)
@url=url
@start=start.to_i
@ending=ending.to_i
@count=0
@reg_nos=Array.new
@results=Hash.new
generate_reg_nos
process_url
end
protected
def generate_reg_nos
Auto-opened by DebTrakr
Context
#TODO we need some docs for this
class ChennaiResults
attr_accessor :results
def initialize(url,start,ending)
@url=url
@start=start.to_i
@ending=ending.to_i
Auto-opened by DebTrakr
Context
#FIXME its a total and complete mess!
cells.length.times do |i|
if cells[i].text==" Hall Ticket No "
next
elsif cells[i-1].text==" Hall Ticket No "
next
elsif cells[i-1].text==" Course "
next
elsif cells[i].text==" Name "
@results[reg_no][:name]=cells[i+1].text
next
elsif cells[i].text==" Course " || cells[i].text=~ /B.E.(.*)/ || cells[i].text=="Marks Details" || cells[i].text=="Subject" || cells[i].text=="Grade" || cells[i].text=="Status"
next
elsif cells[i].text=="PASS" || cells[i].text=="RA" || cells[i].text=="A"|| cells[i].text=="B"|| cells[i].text=="C"|| cells[i].text=="D"|| cells[i].text=="E"|| cells[i].text=="S"|| cells[i].text=="U"|| cells[i].text=~ /WH(.*)/ || cells[i].text=="AB"|| cells[i].text=="W"|| cells[i].text=="SA" || cells[i].text=="SE"|| cells[i].text=="A.B"|| cells[i].text=="I"|| cells[i].text=="WD"|| cells[i].text==" "|| cells[i].text=="BRK"
next
elsif cells[i+1].text==" Course "
next
else
@results[reg_no][:grades][cells[i].text]={:grade=>cells[i+1].text,:result=>cells[i+2].text}
end
end
if @results[reg_no][:name].nil?
@results.delete(reg_no)
end
@count+=1
puts @results[reg_no]
end
end
end
Auto-opened by DebTrakr
Context
#FIXME its a total complete mess!
cells.length.times do |i|
if cells[i].text==" Hall Ticket No "
next
elsif cells[i-1].text==" Hall Ticket No "
next
elsif cells[i-1].text==" Course "
next
elsif cells[i].text==" Name "
@results[reg_no][:name]=cells[i+1].text
next
elsif cells[i].text==" Course " || cells[i].text=~ /B.E.(.*)/ || cells[i].text=="Marks Details" || cells[i].text=="Subject" || cells[i].text=="Grade" || cells[i].text=="Status"
next
elsif cells[i].text=="PASS" || cells[i].text=="RA" || cells[i].text=="A"|| cells[i].text=="B"|| cells[i].text=="C"|| cells[i].text=="D"|| cells[i].text=="E"|| cells[i].text=="S"|| cells[i].text=="U"|| cells[i].text=~ /WH(.*)/ || cells[i].text=="AB"|| cells[i].text=="W"|| cells[i].text=="SA" || cells[i].text=="SE"|| cells[i].text=="A.B"|| cells[i].text=="I"|| cells[i].text=="WD"|| cells[i].text==" "|| cells[i].text=="BRK"
next
elsif cells[i+1].text==" Course "
next
else
@results[reg_no][:grades][cells[i].text]={:grade=>cells[i+1].text,:result=>cells[i+2].text}
end
end
if @results[reg_no][:name].nil?
@results.delete(reg_no)
end
@count+=1
puts @results[reg_no]
end
end
end
Auto-opened by DebTrakr
Context
#FIXME its total messs!
cells.length.times do |i|
if cells[i].text==" Hall Ticket No "
next
elsif cells[i-1].text==" Hall Ticket No "
next
elsif cells[i-1].text==" Course "
next
elsif cells[i].text==" Name "
@results[reg_no][:name]=cells[i+1].text
next
elsif cells[i].text==" Course " || cells[i].text=~ /B.E.(.*)/ || cells[i].text=="Marks Details" || cells[i].text=="Subject" || cells[i].text=="Grade" || cells[i].text=="Status"
next
elsif cells[i].text=="PASS" || cells[i].text=="RA" || cells[i].text=="A"|| cells[i].text=="B"|| cells[i].text=="C"|| cells[i].text=="D"|| cells[i].text=="E"|| cells[i].text=="S"|| cells[i].text=="U"|| cells[i].text=~ /WH(.*)/ || cells[i].text=="AB"|| cells[i].text=="W"|| cells[i].text=="SA" || cells[i].text=="SE"|| cells[i].text=="A.B"|| cells[i].text=="I"|| cells[i].text=="WD"|| cells[i].text==" "|| cells[i].text=="BRK"
next
elsif cells[i+1].text==" Course "
next
else
@results[reg_no][:grades][cells[i].text]={:grade=>cells[i+1].text,:result=>cells[i+2].text}
end
end
if @results[reg_no][:name].nil?
@results.delete(reg_no)
end
@count+=1
puts @results[reg_no]
end
end
end
Auto-opened by DebTrakr
Context
#FIXME this is too compelx man!
elsif t.text=='Name'
@results[reg_no][:name]=data[i+1].text
elsif t.text=="PASS" || t.text=="RA" || t.text=="A"|| t.text=="B"|| t.text=="C"|| t.text=="D"|| t.text=="E"|| t.text=="S"|| t.text=="U"|| t.text=~ /WH(.*)/ || t.text=="AB"|| t.text=="W"|| t.text=="SA" || t.text=="SE"|| t.text=="A.B"|| t.text=="I"|| t.text=="WD"|| t.text==" "|| t.text=="BRK"|| t.text==""
next
else
@results[reg_no][:grades][data[i].text]={:grade=>data[i+1].text,:result=>data[i+2].text}
end
end
if @results[reg_no][:name].nil?
@results.delete(reg_no)
end
@count+=1
end
end
end
Auto-opened by DebTrakr
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.