瀏覽單個文章
kenchen_1226
Advance Member
 

加入日期: Jun 2010
文章: 333
我試著寫一個 script
就是參考他內建的 script,
中文的大概只有 開眼電影比較多資料
yahoo movie 太少
找個 toy story 都沒有


我想只要稍微研究過 HTTP GET POST 大概就會知道了
或是用 wireshark 去抓封包

有的網站是用get,
開眼 是用 POST

所以就用 script 裡面的
PostPage()

先去開眼網站 輸入 inception ,
抓封包,知道他是這樣傳的


POST /search/search.cfm HTTP/1.1
Host: search.atmovies.com.tw
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-tw,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: UTF-8,*
Keep-Alive: 115
Connection: keep-alive
Referer: http://search.atmovies.com.tw/search/search.cfm
Content-Type: application/x-www-form-urlencoded
Content-Length: 96

type=all&search_term=inception&search=%E9%80%81%E5%87%BA%E6%9F%A5%E8%A9%A2&action=home&fr=search


再來就是測試 script,

先假設 要找 inception

Page.Text := PostPage('http://search.atmovies.com.tw/search/search.cfm','type=all' + '&search_term=inception' + '&search=%E9%80%81%E5%87%BA%E6%9F%A5%E8%A9%A2' + '&action=home' + '&fr=search');


結果發現
這個 PostPage
傳給 server 的內容似乎會讓 server 不想回傳
抓ant movie 送給server 的封包
跟正常的封包內容不太一樣
如下
POST /search/search.cfm HTTP/1.0
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 96
Host: search.atmovies.com.tw
Accept: text/html, */*
User-Agent: Mozilla/5.0 (compatible; Ant Movie Catalog using Indy Library)

type=all&search_term=inception&search=%E9%80%81%E5%87%BA%E6%9F%A5%E8%A9%A2&action=home&fr=search


就是比較少
可能是 server 檢查比較多

所以用 script 來抓開眼網 可能不行了
唉,那這就麻煩了

只能用英文介紹電影了


剛剛也抓了 ant movie source
發現好像是 pascal 檔案
可能是用 dephi 寫的吧
舊 2011-04-22, 03:45 PM #9
回應時引用此文章
kenchen_1226離線中