HTML 문서 내용을 읽어 오려는데 막혀있습니다..

망치의 이미지

http://www.livescore.com/default.dll?page=home

위 페이지에 공개되있는 정보를 주기적으로 읽어오고 싶은데 이래저래 막아놨더군요. wget 이나 php 소켓을 이용해 읽어오거나 해봤는데 실패했습니다..

좋은 수 없을까요? :?

File attachments: 
첨부파일 크기
Image icon na.gif20.37 KB
kfmes의 이미지

파이썬이나 자바로 웹페이지의 HTML을 읽어올수 있는데,
그것도 막아놓은건가요?

python

import urllib
import time
import re

tagfind = re.compile(r'<[^>]*>')
striptags = lambda x: tagfind.sub('', x)


class AppURLopener(urllib.FancyURLopener):
        def __init__(self, *args):
                self.version = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)"
                apply(urllib.FancyURLopener.__init__, (self,) + args)
fy = AppURLopener()



def read():
        #url = 'http://www.livescore.com/default.dll?page=home'
        url = 'http://www.libescore.com/default.dll/stop?page=home&sid=0602Bu'

        try:
                result = fy.open(url)
        except:
                return 'error'
        data = result.read()



        return data


if __name__ == '__main__':
        print read()

----------------------------------------

Prentice의 이미지

wget "http://www.libescore.com/default.dll/stop?page=home&sid=0602Gu" --referer="http://www.livescore.com/default.dll?page=home" --user-agent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)"

referer와 user agent를 변조하시면 wget로도 가능합니다.

다운로드할 URL을 알기 위한 단계가 한 단계 더 필요하겠지만요.

puaxx의 이미지

한번더 해보시길...익스로 볼수 있으면 대부분 긁어오는거 가능합니다.
쿠키나 리퍼러 에이전트 좀 신경써서 체크해 보세요.

망치의 이미지

wget 으로 다시 시도해봤는데 역시 마찬가지입니다..
curl 이용해서 한번 시도해봐야겠습니다.

댓글 첨부 파일: 
첨부파일 크기
Image icon 0바이트

---------------------------------------
http://www.waitfor.com/
http://www.textmud.com/

쿠크다스의 이미지

w3m -dump http://www.livescore.com/default.dll?page=home

w3m -dump_both http://www.livescore.com/default.dll?page=home > hmm
을 해서,
hmm파일을 보니,
Content-Encoding: deflate라고 하는군요.

과자가 아닙니다.
cuckoo dozen, 즉.12마리의 뻐꾸기란 뜻입니다.

익명 사용자의 이미지

대충 살펴보니..
php 로 하더라도 몇단계 거쳐야 할 듯 합니다.
마치 브라우저가 하듯이 말이죠.

저의 예를 들어보면(쿠키는 계속 변할듯. 아래에서 화살표 다음이 서버로부터의 응답임.)
1. GET /default.dll?page=home
-->
HTTP/1.1 200 OK
<body bgcolor="#000000" onLoad="JavaScript:document.check.submit();"><form name="check" method="post" action="/default.dll?page=home"><input type="hidden" name="sid" value="0602Hu"></form></body></html>

2. 위의 응답에 대해
POST /default.dll?page=home HTTP/1.1
Referer: http://www.livescore.com/default.dll?page=home
Cookie: SID0602=0602Hu
Content-Type: application/x-www-form-urlencoded
Content-Length: 10

sid=0602Hu

-->
HTTP/1.1 100 Continue

HTTP/1.1 302 Moved Temporarily
Set-Cookie: SID0602=0602Hu116; path=/; expires=Sun, 05 Mar 2006 05:37:35 GMT
Location: /default.dll?page=home

3. 위의 서버응답에 대해
GET /default.dll?page=home HTTP/1.1
Host: www.livescore.com
Referer: http://www.livescore.com/default.dll?page=home
Cookie: SID0602=0602Hu116

-->

HTTP/1.1 200 OK

Content-Length: 49904

<!DOCTYPE HTML ..어쩌구저쩌구..

망치의 이미지

blacknue 님 감사.. 힌트덕에 해결했습니다.

---------------------------------------
http://www.waitfor.com/
http://www.textmud.com/

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.