Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

Показать сообщение отдельно

Аватара для Creat0R

Must AutoIt


Сообщения: 3054
Благодарности: 1009

Профиль | Сайт | Отправить PM | Цитировать


Цитата Medic84:
Имя фильма поправил на »
Цитата Medic84:
Так как не определялось »
А у меня наоборот с твоим методом не определяется . Попробуй так:

Код: Выделить весь код
(?si).*?<h1.*?class=moviename-big.*?>(.*?)</h1>.*
Цитата Medic84:
Осталось самое сложное »
Код: Выделить весь код
#include <IE.au3>

$sURL = "http://www.kinopoisk.ru/level/1/film/89515"

$sURL = InputBox("Kinopoisk.ru Informer", "Введите ссылку на фильм для получения информации:", $sURL, "", 350, 200)
If @error Then Exit

$oIE = _IECreate($sURL, 0, 0)
$sSource = _IEDocReadHTML($oIE)
_IEQuit($oIE)

$sName = _GetSourceProperty($sSource, '', '(?si).*?<h1.*?class=moviename-big.*?>(.*?)</h1>.*')
$sOrigin_Name = _GetSourceProperty($sSource, '', '(?si).*?<span style="color:.*? font-size:.*?">(.*?)</span>.*')
$sSlogan = _GetSourceProperty($sSource, 'слоган')
$sBudget = _GetSourceProperty($sSource, 'бюджет')
$sYear = _GetSourceProperty($sSource, 'год')
$sCountry = _GetSourceProperty($sSource, 'страна')
$sWorld_Primier = _GetSourceProperty($sSource, 'премьера (мир)')
$sRF_Primier = _GetSourceProperty($sSource, 'премьера (РФ)')
$sDirector = _GetSourceProperty($sSource, 'режиссер')
$sWorld_Collect = _GetSourceProperty($sSource, 'сборы в мире')
$sTime = _GetSourceProperty($sSource, 'время')
$sJaners = _GetSourceProperty($sSource, 'жанр')
$sRaiting = _GetSourceProperty($sSource, '', '(?si).*?<A class=continue style=".*?" href=".*?">(.*?)<SPAN.*?>.*?</SPAN></A>.*')
$sIMDB_Raiting = _GetSourceProperty($sSource, '', '(?si).*?<DIV style=".*?">IMDB: (.*?)</DIV>.*')
$sDescription = _GetSourceProperty($sSource, '', '(?si).*?<span class=_reachbanner_.*?>(.*?)</span>.*')
$sActors = _GetSourceProperty($sSource, '', '(?si).*?В главных ролях:.*?<A class=all href=".*?">(.*?)\.\.\.</A></TD></TR>.*')
$sActors = StringRegExpReplace($sActors, '(\n\r)+|\A\s+|\s+$', '')

$sInfo = StringFormat( _
    "Имя:\t\t\t%s\n" & _
    "Оригин. Имя:\t\t\t%s\n" & _
    "Слоган:\t\t\t%s\n" & _
    "Бюджет:\t\t\t%s\n" & _
    "Год:\t\t\t%s\n" & _
    "Страна:\t\t\t%s\n" & _
    "Режиссер:\t\t%s\n" & _
    "Премьера (Мир):\t\t%s\n" & _
    "Сборы в мире:\t\t%s\n" & _
    "Премьера (РФ):\t\t%s\n" & _
    "Время:\t\t\t%s\n" & _
    "Жанр:\t\t\t%s\n" & _
    "Рейтинг:\t\t\t%s\n" & _
    "Рейтинг IMDB:\t\t%s\n\n" & _
    "[В главных ролях]:\n%s\n\n" & _
    "[Описание]:\n%s\n\n", _
    $sName, $sOrigin_Name, $sSlogan, $sBudget, $sYear, $sCountry, $sDirector, $sWorld_Primier, _
    $sWorld_Collect, $sRF_Primier, $sTime, $sJaners, $sRaiting, $sIMDB_Raiting, $sActors, $sDescription)

MsgBox(64, 'Kinopoisk.ru Info', $sInfo)

;Функция для получения подстроки по заданному pattern
Func _GetSourceProperty($sSource, $sName, $sPattern = '', $iGetArr=0)
    Local $s_Pattern = _
        '(?si).*?<TD class=type>%s</TD>.*?<TD(?: class=.*?|)>' & _
        '(?:<A(?: class=.*?|) href=".*?">|)(.*?)(?:</A>|)</TD></TR>.*'

    If $sPattern <> '' Then $s_Pattern = $sPattern
    If $sName <> '' Then $s_Pattern = StringFormat($s_Pattern, "\Q" & $sName & "\E")

    If $iGetArr = 0 Then
        Local $sRet = StringRegExpReplace($sSource, $s_Pattern, '\1')
        If @extended = 0 Then Return SetError(1, 0, "N/A")
    Else
        Return StringRegExp($sSource, $s_Pattern, 3)
    EndIf

    $sRet = _ContentReplaceTags($sRet, 2)
    $sRet = StringRegExpReplace($sRet, '«+|»+', '"')

    Return $sRet
EndFunc

Func _ContentReplaceTags($sString, $iCorrect=-1)
    Local $aTags_Arr[8][2] = [[7], _
        ['&qu' & 'ot;', '"'], ['&a' & 'mp;', '&'], ['&' & '#39;', "'"], _
        ['&ap' & 'os;', "'"], ['&g' & 't;', '>'], ['&l' & 't;', '<'], ['&nb' & 'sp;', ' ']]

    Local $sReplStr = '\\n'
    If $iCorrect = 2 Then $sReplStr = @CRLF

    Local $sRet_Content = StringRegExpReplace($sString, '(?i)<(/|)br(/| /|)>|\n|\r|\r\n', $sReplStr)
    $sRet_Content = StringRegExpReplace($sRet_Content, '(?si)<(/|).*?>|<hr(/| /|)>', '')
    ;$sRet_Content = StringRegExpReplace($sRet_Content, '(?si)<(/|)[abiu]( .*?|)>|<hr(/| /|)>', '')

    For $i = 1 To $aTags_Arr[0][0]
        $sRet_Content = StringReplace($sRet_Content, $aTags_Arr[$i][0], $aTags_Arr[$i][1])
    Next

    If $iCorrect = 1 Then Return $sRet_Content

    Local $iCheckSpanPos = StringInStr($sRet_Content, '</s>')
    If $iCheckSpanPos > 0 Then $sRet_Content = StringTrimLeft($sRet_Content, $iCheckSpanPos)

    Return $sRet_Content
EndFunc

-------
“Сделай так просто, как возможно, но не проще этого.”... “Ты никогда не решишь проблему, если будешь думать так же, как те, кто её создал.”

Альберт Эйнштейн

P.S «Не оказываю техподдержку через ПМ/ICQ, и по email - для этого есть форум. ©»

http://creator-lab.ucoz.ru/Images/Icons/autoit_icon.png Русское сообщество AutoIt | http://creator-lab.ucoz.ru/Images/Ic...eator_icon.png CreatoR's Lab | http://creator-lab.ucoz.ru/Images/Icons/oac_icon.png Opera AC Community


Отправлено: 16:12, 19-08-2009 | #14