Jump to content

Get text from a web site


Recommended Posts

Hello,

I'm a very new with programming and AutoIT.

I would like get text for a web site and copy it to a Excel file.

By example, on IMDB, I want to copy the title of each episodes to a Excel column and also get the year of airing and put it into another colum.

http://www.imdb.com/title/tt0411008/episodes?season=1&ref_=tt_eps_sn_1

Colum 1              Colum 2

Pilot : Part 1          2005

Pilot : Part 2          2005

Tabula Rasa         2005

I really don't know how to do it. Can you help me out please.

Thank you!

Edited by Duff360
Link to comment
Share on other sites

This should work

(Edit : for these pages)

#Include <Array.au3>

For $n = 1 to 6
  $txt = BinaryToString(InetRead("http://www.imdb.com/title/tt0411008/episodes?season=" & $n & "&ref_=tt_eps_sn_" & $n))
  $items = StringRegExp($txt, '(?s)episodeNumber(.*?)</a>', 3)
  If IsArray($items) Then
    Local $res[UBound($items)][3]
    For $i = 0 to UBound($items)-1
       $res[$i][0] = "s" & $n & ", ep" & $i + 1
       $res[$i][1] = StringRegExpReplace($items[$i], '(?s).*itemprop="name">(.*)', "$1")
       $res[$i][2] = StringRegExpReplace($items[$i], '(?s).*airdate">\D*(\V+).*', "$1")
    Next
    _ArrayDisplay($res, "season " & $n)
  Else
    Msgbox(0,"", "failed")
  EndIf
Next

Using _IE* funcs is another way, longer but more reliable

Edited by mikell
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...