Login Register


[Ideas?] Reading raw HTML with Ruby filter_list
Author
Message
[Ideas?] Reading raw HTML with Ruby #1
I figured out how to do this a few days ago and I'm not sure what to do with it. Printing a page's worth of HTML to the console is impractical because it gets cut off usually about half way due to the number of lines exceeding the limit. I also thought about trying to find a single element buried in the page; like the name and URL of the last thread in coding, par example, but I have to use one hell of a long .include?() method.

If you guys have any ideas on what I could do with this, let me know.

(if you're interested, the code is here.)
It's often the outcasts, the iconoclasts ... those who have the least to lose because they
don't have much in the first place, who feel the new currents and ride them the farthest.

Reply

RE: [Ideas?] Reading raw HTML with Ruby #2
Parse the memberlist from this forum or something, and save it to a file. Not sure what kind of suggestions you are looking for?

Reply

RE: [Ideas?] Reading raw HTML with Ruby #3
(04-18-2015, 06:47 PM)0xDEAD10CC Wrote: Parse the memberlist from this forum or something, and save it to a file. Not sure what kind of suggestions you are looking for?

I'm still getting nokogiri (Ruby's XML/HAML reader) figured out and I've gotten a few ideas in the process, thanks though.
It's often the outcasts, the iconoclasts ... those who have the least to lose because they
don't have much in the first place, who feel the new currents and ride them the farthest.

Reply

RE: [Ideas?] Reading raw HTML with Ruby #4
(04-18-2015, 06:47 PM)0xDEAD10CC Wrote: Parse the memberlist from this forum or something, and save it to a file. Not sure what kind of suggestions you are looking for?

Code:
from BeautifulSoup import BeautifulSoup import urllib2 page = urllib2.urlopen('https://sinister.ly/index.php') soup = BeautifulSoup(page) y = '' for x in soup.html.body.findAll('tr'): y = x.findAll('td') if y and 'users active in the past 60 minutes' in y[0].text: break unlist = '' for x in y: unlist = str(x) soup = BeautifulSoup(unlist) print 'Online Users:' count = 0 for x in soup.findAll('a'): count += 1 for z in x.findAll('span'): print str(count) + ' > ' + str(z.text) raw_input('\nPress anything to exit...')

[+] 1 user Likes Eclipse's post
Reply

RE: [Ideas?] Reading raw HTML with Ruby #5
Nice, not sure how that would look in ruby, I don't really use Python as much anymore either.

Reply







Users browsing this thread: