Announcement

Collapse
No announcement yet.

My First Script - Google Hot Trends

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    My First Script - Google Hot Trends

    I like the chumby Google Hot Trends app that shows the top 20 Google searches so I took Jon00's World Population script and modified it to work with Google Hot Trends.

    The script only checks the US but can be changed in the URL within the script to show other regions.

    It is far from written well and needs to be cleaned up but works good enough for me.

    IF you modify it, please share.
    IF you run it, please reply here.

    Thanks for the inspiration, Jon00.
    Thanks for making it work Mr. Happy.

    Zip file updated as of October 1, 2012
    Attached Files
    Last edited by Eddiie; October 2, 2012, 03:07 AM.

    #2
    Fixed a bug where the device kept getting recreated.

    Comment


      #3
      Well, Google changed to ATOM format and screwed up my script.

      Need to re-write but think it is over my head.

      I don't know anything about XMLDocument() or imports or manipulating this stuff. Pretty disappointing.

      Comment


        #4
        XML can sometimes be easier than taking apart bits of HTML pages, I don't include myself in the group of people that understands all of it but I know enough to get by. Hopefully you won't mind but this seems to be a script that does what you need;

        Code:
        Imports System.XML
        
        Sub Main(ByVal Parms As Object)
        
        Dim XMLNews As New XmlDocument
        Dim XMLNewsNodeList As XmlNodeList
        Dim XMLNewsNode As XmlNode
        Dim DevStr As String = ""
        Dim DescStr As String = ""
        Dim i As Integer = 1
        
        Dim URLString As string = "http://www.google.com/trends/hottrends/atom/feed?pn=p1"
        
        XMLNews.Load(URLString)
        
        XMLNewsNodeList = XMLNews.SelectNodes("/rss/channel/item")
        
        For Each XMLNewsNode In XMLNewsNodeList
        
        If XMLNewsNode.Item("description").InnerText <> "" Then
        DescStr = " - " & XMLNewsNode.Item("description").InnerText
        Else
        DescStr = "" 
        End If
        
        DevStr = DevStr & i & ". " & XMLNewsNode.Item("title").InnerText & DescStr & "<br>"
        
        i = i + 1 
        
        Next
        
        hs.setdevicestring("Q99", DevStr, True)
        
        End Sub
        I have several scripts laying around on my HD to do various things that are along similar lines (facebook notifications/rss weather/twitter downloads) so it was only really a minor alteration that was needed.

        One thing that needs to be done is to reference the System.XML namespace in your settings.ini file, quite a number of scripts use it so it is probably already referenced but if you get an error then this may be why.

        If you want to learn more then it is worth reading about XPath, I use a program called XPath builder that helps formulate the correct paths to the data you want in an XML file.

        Comment


          #5
          Thank you!!

          zip file updated.

          Played with the formatting a bit and ripped HTMLString from jon00's Speedfan script to put the list in a table, added graphic (put in $\html\images).

          Comment

          Working...
          X