Latets News from the world of Science (physorg.com)

Platform:  mIRC
Published  Mar 18, 2012
Updated  Apr 08, 2012

Screenshots

__________________________________________________________
!! As of Sunday 8th of April 2012 This script has stopped working !!
!! As of Sunday 8th of April 2012 This script has stopped working !!
__________________________________________________________

Howdy all..
For all of you (perhaps not many) who are interested in science, and/or are running a science related chan. I complied a set of RSS feeds from physorg.com.
The original Code was skilfully fashioned using a cocktail of black and white magic during a full moon on the highest peak of the northern plains by Lord Napa the socket wizard of the north.
All I did was copy the original code, and paste it down to add another feed link.. tweaked colours and category heading... and sure I know this whole thing could have been squeezed into one body of code, but .. well you know me.. im not much of a coder, but its a worker. I also added a feed menu list that will be noticed.
Of course feel free to mess about with .. tho perhaps it might be nice to quote napa if your re-posting a modded version.

Anyway the commands are simple enough
!news - will notice the list of feeds.. the rest is self explanatory

will display 3 feeds, you can edit that yourself.. also you can add in any other rss. 2.0 from that site using the same code.. (there seems to be quite a good selection of feeds: http://www.physorg.com/feeds/ )

Enjoy science fans
__________________________________________________________

!! As of Sunday 8th of April 2012 This script has stopped working !!
!! As of Sunday 8th of April 2012 This script has stopped working !!
__________________________________________________________



on *:text:!News:#:{
notice $nick Hi there $nick Here is the list of available news headline feeds: (!phynews = General Physics) - (!qmnews = Quantum Physics) - (!nanonews = Nanotechnology) - (!spacenews = General Space) - (!astronews = Astronomy) - (!chemnews = Chemistry) - (!bionews = Biology) - (!mathnews = Mathematics) - (!technews - Technology)
}

on $*:text:/^!phnews$/iS:#:{
if (!%f) { inc -u5 %f
if ($sock(physics)) sockclose physics
sockopen physics www.physorg.com 80
sockmark physics msg # 0,14 Physics News: 
}
}
on *:sockopen:physics: {
sockwrite -nt physics GET /rss-feed/physics-news/ HTTP/1.1
sockwrite -nt physics Host: $+($sock(physics).addr,$str($crlf,2))
}
on *:sockread:physics: {
var %physics | sockread %physics
if (%phy = 5) { sockclose physics }
if ($regex(%physics,/<title>(.+)<\/title>/)) { inc -u5 %phy
if (%phy isnum 2-4) { hadd -m phy 1 $regml(1) }
}
if ($regex(%physics,/<link>(.+w{3}\.physorg\.com\/\S+)<\/link>/)) { inc -u5 %phyy
if (%phyy isnum 2-4) { $sock(physics).mark $hget(phy,1) 14 @ $regml(1)
}
}
}


on $*:text:/^!qmnews$/iS:#:{
if (!%f) { inc -u5 %f
if ($sock(physics2)) sockclose physics2
sockopen physics2 www.physorg.com 80
sockmark physics2 msg # 0,14 Quantum Physics News: 
}
}
on *:sockopen:physics2: {
sockwrite -nt physics2 GET /rss-feed/physics-news/quantum-physics/ HTTP/1.1
sockwrite -nt physics2 Host: $+($sock(physics2).addr,$str($crlf,2))
}
on *:sockread:physics2: {
var %physics2 | sockread %physics2
if (%phy = 5) { sockclose physics2 }
if ($regex(%physics2,/<title>(.+)<\/title>/)) { inc -u5 %phy
if (%phy isnum 2-4) { hadd -m phy 1 $regml(1) }
}
if ($regex(%physics2,/<link>(.+w{3}\.physorg\.com\/\S+)<\/link>/)) { inc -u5 %phyy
if (%phyy isnum 2-4) { $sock(physics2).mark $hget(phy,1) 14 @ $regml(1)
}
}
}



on $*:text:/^!spacenews$/iS:#:{
if (!%f) { inc -u5 %f
if ($sock(physics3)) sockclose physics3
sockopen physics3 www.physorg.com 80
sockmark physics3 msg # 0,14 Space News: 
}
}
on *:sockopen:physics3: {
sockwrite -nt physics3 GET /rss-feed/space-news/space-exploration/ HTTP/1.1
sockwrite -nt physics3 Host: $+($sock(physics3).addr,$str($crlf,2))
}
on *:sockread:physics3: {
var %physics3 | sockread %physics3
if (%phy = 5) { sockclose physics3 }
if ($regex(%physics3,/<title>(.+)<\/title>/)) { inc -u5 %phy
if (%phy isnum 2-4) { hadd -m phy 1 $regml(1) }
}
if ($regex(%physics3,/<link>(.+w{3}\.physorg\.com\/\S+)<\/link>/)) { inc -u5 %phyy
if (%phyy isnum 2-4) { $sock(physics3).mark $hget(phy,1) 14 @ $regml(1)
}
}
}


on $*:text:/^!technews$/iS:#:{
if (!%f) { inc -u5 %f
if ($sock(physics4)) sockclose physics4
sockopen physics4 www.physorg.com 80
sockmark physics4 msg # 0,14 Technology News: 
}
}
on *:sockopen:physics4: {
sockwrite -nt physics4 GET /rss-feed/technology-news/ HTTP/1.1
sockwrite -nt physics4 Host: $+($sock(physics4).addr,$str($crlf,2))
}
on *:sockread:physics4: {
var %physics4 | sockread %physics4
if (%phy = 5) { sockclose physics4 }
if ($regex(%physics4,/<title>(.+)<\/title>/)) { inc -u5 %phy
if (%phy isnum 2-4) { hadd -m phy 1 $regml(1) }
}
if ($regex(%physics4,/<link>(.+w{3}\.physorg\.com\/\S+)<\/link>/)) { inc -u5 %phyy
if (%phyy isnum 2-4) { $sock(physics4).mark $hget(phy,1) 14 @ $regml(1)
}
}
}



on $*:text:/^!chemnews$/iS:#:{
if (!%f) { inc -u5 %f
if ($sock(physics5)) sockclose physics5
sockopen physics5 www.physorg.com 80
sockmark physics5 msg # 0,14 Chemistry News: 
}
}
on *:sockopen:physics5: {
sockwrite -nt physics5 GET /rss-feed/chemistry-news/ HTTP/1.1
sockwrite -nt physics5 Host: $+($sock(physics5).addr,$str($crlf,2))
}
on *:sockread:physics5: {
var %physics5 | sockread %physics5
if (%phy = 5) { sockclose physics5 }
if ($regex(%physics5,/<title>(.+)<\/title>/)) { inc -u5 %phy
if (%phy isnum 2-4) { hadd -m phy 1 $regml(1) }
}
if ($regex(%physics5,/<link>(.+w{3}\.physorg\.com\/\S+)<\/link>/)) { inc -u5 %phyy
if (%phyy isnum 2-4) { $sock(physics5).mark $hget(phy,1) 14 @ $regml(1)
}
}
}


on $*:text:/^!bionews$/iS:#:{
if (!%f) { inc -u5 %f
if ($sock(physics6)) sockclose physics6
sockopen physics6 www.physorg.com 80
sockmark physics6 msg # 0,14 Biology News: 
}
}
on *:sockopen:physics6: {
sockwrite -nt physics6 GET /rss-feed/biology-news/ HTTP/1.1
sockwrite -nt physics6 Host: $+($sock(physics6).addr,$str($crlf,2))
}
on *:sockread:physics6: {
var %physics6 | sockread %physics6
if (%phy = 5) { sockclose physics6 }
if ($regex(%physics6,/<title>(.+)<\/title>/)) { inc -u5 %phy
if (%phy isnum 2-4) { hadd -m phy 1 $regml(1) }
}
if ($regex(%physics6,/<link>(.+w{3}\.physorg\.com\/\S+)<\/link>/)) { inc -u5 %phyy
if (%phyy isnum 2-4) { $sock(physics6).mark $hget(phy,1) 14 @ $regml(1)
}
}
}


on $*:text:/^!mathnews$/iS:#:{
if (!%f) { inc -u5 %f
if ($sock(physics7)) sockclose physics7
sockopen physics7 www.physorg.com 80
sockmark physics7 msg # 0,14 Mathematics News: 

}
}
on *:sockopen:physics7: {
sockwrite -nt physics7 GET /rss-feed/science-news/mathematics/ HTTP/1.1
sockwrite -nt physics7 Host: $+($sock(physics7).addr,$str($crlf,2))
}
on *:sockread:physics7: {
var %physics7 | sockread %physics7
if (%phy = 5) { sockclose physics7 }
if ($regex(%physics7,/<title>(.+)<\/title>/)) { inc -u5 %phy
if (%phy isnum 2-4) { hadd -m phy 1 $regml(1) }
}
if ($regex(%physics7,/<link>(.+w{3}\.physorg\.com\/\S+)<\/link>/)) { inc -u5 %phyy
if (%phyy isnum 2-4) { $sock(physics7).mark $hget(phy,1) 14 @ $regml(1)
}
}
}


on $*:text:/^!astronews$/iS:#:{
if (!%f) { inc -u5 %f
if ($sock(physics8)) sockclose physics8
sockopen physics8 www.physorg.com 80
sockmark physics8 msg # 0,14 Astronomy News: 
}
}
on *:sockopen:physics8: {
sockwrite -nt physics8 GET /rss-feed/space-news/astronomy/ HTTP/1.1
sockwrite -nt physics8 Host: $+($sock(physics8).addr,$str($crlf,2))
}
on *:sockread:physics8: {
var %physics8 | sockread %physics8
if (%phy = 5) { sockclose physics8 }
if ($regex(%physics8,/<title>(.+)<\/title>/)) { inc -u5 %phy
if (%phy isnum 2-4) { hadd -m phy 1 $regml(1) }
}
if ($regex(%physics8,/<link>(.+w{3}\.physorg\.com\/\S+)<\/link>/)) { inc -u5 %phyy
if (%phyy isnum 2-4) { $sock(physics8).mark $hget(phy,1) 14 @ $regml(1)
}
}
}


on $*:text:/^!nanonews$/iS:#:{
if (!%f) { inc -u5 %f
if ($sock(physics9)) sockclose physics9
sockopen physics9 www.physorg.com 80
sockmark physics9 msg # 0,14 NanoTechology News 
}
}
on *:sockopen:physics9: {
sockwrite -nt physics9 GET /rss-feed/nanotech-news/ HTTP/1.1
sockwrite -nt physics9 Host: $+($sock(physics9).addr,$str($crlf,2))
}
on *:sockread:physics9: {
var %physics9 | sockread %physics9
if (%phy = 5) { sockclose physics9 }
if ($regex(%physics9,/<title>(.+)<\/title>/)) { inc -u5 %phy
if (%phy isnum 2-4) { hadd -m phy 1 $regml(1) }
}
if ($regex(%physics9,/<link>(.+w{3}\.physorg\.com\/\S+)<\/link>/)) { inc -u5 %phyy
if (%phyy isnum 2-4) { $sock(physics9).mark $hget(phy,1) 14 @ $regml(1)
}
}
}


Cheers Napa

Comments

Sign in to comment.
RIcko   -  Jul 01, 2012
Such a great snippet must get back to live
 Respond  
Pangaea   -  Apr 15, 2012
oh i think it would be alot of work for you and time to remix your script.. I really think its the links or something that needs to be changed on the originally posted one.

i recently upgraded to firefox10 ... and when putting in links to an example of one of the rss feed pages it strips the www. ... and as a test i also tried the same in ie8.. ie also strips the www out, but leaves the http in.. this is odd since i defiantly remember ie not doing that before.. i thought FF10 was doing it since the upgrade. So.. this is a wild guess, perhaps i must strip all the www. out of the script.. Ill give it a try.

Also what dose the "80" after each root link mean?
Also perhaps the problem is with these parts "HTTP/1.1"
perhaps phyorg have upgraded from 1.1? As i said earlier I have emailed physorg to ask about that very thing.. but ive been waiting for almost a week. no reply.. Ill try mail them again and see if they can shed some light on what went wrong... i just dont really expect a reply tho since its not exactly in relation to physics :/

Ive run debug mode on it.. nothing shows up to indicate what the problem might be
There is nothing displayed in status window to indicate what the problem is.

Ive had a few others look/try it too with no success. and they dont see why its not working.
Ive spent the best part of a week on and off, on my own trying and trying to get this working again.. no idea whatsoever.. like as i said if i AT LEAST knew what the problem is i could then "attempt" to fix it myself.. but everything is much much more harder since i dont even know the "why" yet.. never mind the "how" to fix part.

I did not change the code in anyway before it stopped working, in fact wasnt even working on the bot at all that weekend... I checked my pc for the usually things.. malware, viruses.. etc and to the best of my ability it seems clean enough. So i doubt the code was hacked or modified in anyway. Yet all the said the links seem exactly the same.. the html layout looks the same on the site. I wish i had taken a screenshot of rss pages and a screenshot of all the source page codes of each rss link so i would at least have something to compare with it. I might have then been able to see where the problem or change is.

Anyway, ill keep emailing mailing physorg, right now they seem to be my only hope of getting this working again.

regards
 Respond  
irchainscriptz   -  Apr 15, 2012
No it was meant to show you how to get urls and that RSS feeds are not limited on IRC. I'll have a gander at it and see what I come up with.
 Respond  
Pangaea   -  Apr 15, 2012
ah nice.. tho that is specific to the hawkee forum?... did u post that in here by accident?
nice one tho

regarding the news script itself.. i tried lots of things, cant get it working anymore.. also tried a bunch of irc scripting chans.. nobody seems to want to help. Its a pitty i only got a few weeks out of this.. .. even tho we only had it working for a short time its sorely missed. I cant find any other rss or socket solution.
I even tried mailing physorg to ask if they changed the html in some way... didnt get a reply.

I dont suppose anyone on hawkee can fix this? or even tell me why is stopped working?

regards
 Respond  
irchainscriptz   -  Apr 15, 2012
Here's a look at what I mean

 Respond  
irchainscriptz   -  Apr 15, 2012
They work great on any chat server, depending how the code is done, for instance a good friend of mine uses tinyurl to get the feeds. here's an example

Code
 


The creator of this is err0r from TG007.net
 Respond  
Pangaea   -  Apr 08, 2012
I should probably point out this is not working anymore whatsoever.
Didnt edit it in anyway.. i just woke up and its not working. Got others to try load it .. same thing. I myself reloaded it, rebooted..the bot..etc etc still a no go.
Have the sockets expired on this already? Its a shame i got about a month out of it.
Dam you RSS feeds.. dam you to hell and back.
Yet another perfectly working rss feed, suddenly decides to stop working, and yet again im now left with no rss solution.

Its beyond a joke now,, it really is
Im starting to think rss and irc was never going to work, at least not properly.. and certainly not for any substantial length of time.

Not saying its any fault of napa's ... I assume the sockets are old now.. but its just the same old story time and time again with anything to do with rss or sockets.

/me is not a happy camper this morning.
I suppose i should make a note of that in the snippet text up top here too.
 Respond  
Lucius   -  Mar 26, 2012
liked and rated 8.

it's a 10 for usefulness
it's a 9 for coding (difficult to follow but exceptional as usual from NAPA)
and a 7 for editability.

If you could set the colours and the style to your own preferences then it would be 10 overall.

I've wanted something like this for ages now, but sockets never locked for me.
 Respond  
Pangaea   -  Mar 21, 2012
ah, right :) but to be honest napa made the original code too... kudos to him for both i suppose
 Respond  
Aucun50   -  Mar 21, 2012
I was talking about Napa's code being hard to edit, not yours. While his is smaller, that doesn't mean it's better or more efficient. Everyone has their own take on coding, your snippet can work just the same and for editing I would prefer it over Napa's honestly. Not to say his is bad, but I think most would find it difficult to change ;)
 Respond  
Pangaea   -  Mar 19, 2012
Thanks Nappa.. another fantastic cleanup.. god you make it look so easy.

Aucun50.. yes I know how painful it must be to look at my code, and yes I made lots of mistakes in it, which took me even more time to look through it to see where the mistake was. Napas version is so much better and more efficient , however the problem with napas is I wouldn't have a clue how to modify his at all. For example if I wanted to add or take out a feed on my code i would just delete or copy/paste another one down and edit a few things, but with napas the whole thing is integrated into one body of code. In addition if I only wanted one feed to return 2 results but another one to return 3.. or if I wanted the "start of return line category heading" to be in a different colour to the others.. i could quite easily modify my own code to do that.. but napas, despite it being a far superior piece of code, ide be totally stuck how to even start to workout how to make changes like that.
I need something flexible in the sense that its simple enough for me to edit in the future. Unfortunately because of my non existent coding skills, when it comes to running scripts on my bot I usually choose the most simplest & crudest scripts no matter how messy and un-efficient they are so at least I can edit it. In short what i mean is, i choose flexibility over efficiency.. (but i must stress I only think like that simply because i cant read or code anything complicated like napa did.)
For me to be up at the level of napa on others on this forum would require me to go back to university to do a degree in programming, which much as ide love to do, im at the age and stage of my life that I dont have time or ability (in terms of taking on such a heavy weight and academic discipline ). I know folks that have gone to college to study programming and they drop out after a few years because its too tough.. and they are far more academicly minded then me, so what hope have I got.

folks thanks for the suggestions, napa thanks once again for making the code far more smaller and efficient, and of course for the initial help with the original code.

regards
pan

EDIT: perhaps this computer hardware analergy might click with you. My code would be like an oldish slow desktop pc, one i can up grade or modify with relative ease. Napa code is like a super modern laptop.. works better, smaller, quieter, faster.. but much harder (at least for me) to modify or upgrade.
:D
 Respond  
Aucun50   -  Mar 19, 2012
Seems like it would be easy, when editing, to make a mistake with all of those )'s then never be able to figure it out after.
 Respond  
napa182   -  Mar 18, 2012
Odd way to go about it adding so many sockets that is.. You should have just used one socket to check for the news you are looking for on that one site. It wouldn't be hard to do...

What I mean is you can find away to make it do it in one socket instead of making 9 sockets.. Here is just one way keep in mind I haven't coded in msl in some time...

Code
 
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.