Jump to content

Splitting A String.


AwAke
 Share

Recommended Posts

So atm im using;

$oTR = _IETagnameGetCollection($oIE, "TR")
For $oLink In $oTr
   $result = _IEPropertyGet($oLink, "innertext")
   MsgBox(0, "", $result)
Next

Which returns, as an example, "Video > MoviesTheGolden.Compass.2007.Eng.DVDscr.Divx-LTT02-01 2008706.29 MIB223115")

----------------------------------------|---Catagory---|------------------------------Name------------------------------------|----Size----|Se|-Le-|

So I would basically like to split the string so that it only returns the SE part, '223'. A further problem is that it doesnt come as a consistent length and can range from 1 digit to 5+.

All help is appreciated,

Thanks in advance.

Link to comment
Share on other sites

So atm im using;

$oTR = _IETagnameGetCollection($oIE, "TR")
For $oLink In $oTr
   $result = _IEPropertyGet($oLink, "innertext")
   MsgBox(0, "", $result)
Next

Which returns, as an example, "Video > MoviesTheGolden.Compass.2007.Eng.DVDscr.Divx-LTT02-01 2008706.29 MIB223115")

----------------------------------------|---Catagory---|------------------------------Name------------------------------------|----Size----|Se|-Le-|

So I would basically like to split the string so that it only returns the SE part, '223'. A further problem is that it doesnt come as a consistent length and can range from 1 digit to 5+.

All help is appreciated,

Thanks in advance.

Are you sure the TR does not contain individual TD elements for those parts? If so, you might address that TD element by index and get only what you want.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

They could contain anything other then the <TR> block but that is good to have to narrow the search down, but you need something else inside that block to search in order to get the information you are seeking

0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

Link to comment
Share on other sites

I see, I tried it however it just return empty strings all the time. My code atm is;

#include <IE.au3>
$oIE = _IECreate("http://thepiratebay.org/search/The Golden Compass/0/99/0")
$oTR = _IETagnameGetCollection($oIE, "TD", 1)
MsgBox(0, "", $oTR)

Ive also tried incrimenting the index upto 7.

If I remove the index, and put it into a for loop it returns the value I need at the 5th index.

Edited by AwAke
Link to comment
Share on other sites

For example because I don't know what site your using you have to check

$result = _IEPropertyGet($oLink, "outerhtml")

This will tell you what there is in more detail, you could even select what you want from this if you want to because you have more certain aspects coming into play on this one

0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

Link to comment
Share on other sites

I see, however I believe the above example, when working will do exactly what I need.

Im stumped on why it doesnt return anything if I specify an index :/ but when putting into a for loop and no index it works :|

Link to comment
Share on other sites

Hopefully this will help you out

#include <IE.au3>

$oIE = _IECreate("http://thepiratebay.org/search/The Golden Compass/0/99/0")

$oTr = _IETagnameGetCollection($oIE, "TR")
For $oTrs In $oTr
    $oTd = _IETagnameGetCollection($oTrs, "TD")
    For $oTds In $oTd
        $result = _IEPropertyGet($oTds, "outerhtml")
        MsgBox(0, "", $result)
    Next
Next

0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

Link to comment
Share on other sites

Here is what you want with your definition of SE

#include <IE.au3>

$oIE = _IECreate("http://thepiratebay.org/search/The Golden Compass/0/99/0")

$oTr = _IETagnameGetCollection($oIE, "TR")
For $oTrs In $oTr
    $oTd = _IETagnameGetCollection($oTrs, "TD")
    Local $testing = 0
    For $oTds In $oTd
        $testing = $testing + 1
        $result = _IEPropertyGet($oTds, "outertext")
        If $testing = 7 Then MsgBox(0, "", $result)
    Next
Next

0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

Link to comment
Share on other sites

I've let my-self modifying your code:

#include <IE.au3>

$testing = 0
$oIE = _IECreate("http://thepiratebay.org/search/The Golden Compass/0/99/0")
$oTDs = _IETagnameGetCollection($oIE, 'TD')


For $oTD In $oTDs

    $testing += 1
    If Not Mod($testing, 5) And $testing Then
        ConsoleWrite($oTD.outerText & @CRLF)
        $testing = -2
    EndIf
Next
Link to comment
Share on other sites

lol

Forgive me, I though he wants the size part:

#include <IE.au3>

$testing = 0
$oIE = _IECreate("http://thepiratebay.org/search/The Golden Compass/0/99/0")
$oTDs = _IETagnameGetCollection($oIE, 'TD')


For $oTD In $oTDs

    $testing += 1
    If Not Mod($testing, 6) And $testing Then
        ConsoleWrite($oTD.outerText & @CRLF)
        $testing = -1
    EndIf
Next
Link to comment
Share on other sites

why not do this the easy way and instead of -1 why not add one to the testing like so:

#include <IE.au3>

$oIE = _IECreate("http://thepiratebay.org/search/The Golden Compass/0/99/0")
$oTDs = _IETagnameGetCollection($oIE, 'TD')

$testing = 1
For $oTD In $oTDs
    $testing += 1
    If Not Mod($testing, 7) And $testing Then 
        ConsoleWrite($oTD.outerText & @CRLF)
    EndIf
Next

Your doing far less computing, lol. Except you would have to change the 6 to a 7 because there are 7 elements inside there. That way he can easily change it. Better yet you could setup a variable if you want to and ask him during the execution what he wants and get it for him

0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

Link to comment
Share on other sites

#include <string.au3>

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("GET", "http://thepiratebay.org/search/The%20Golden%20Compass/0/99/0", False)
$oHTTP.Send()

$Ret = _StringBetween($oHTTP.ResponseText, "<td class=""vertTh"">", "</tr>")
For $i = 0 To UBound($Ret) -1
    $RetSE = _StringBetween($Ret[$i], "<td align=""right"">", "</td>")
    ConsoleWrite($RetSE[1] & @CRLF)
Next

# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

#include <string.au3>

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("GET", "http://thepiratebay.org/search/The%20Golden%20Compass/0/99/0", False)
$oHTTP.Send()

$Ret = _StringBetween($oHTTP.ResponseText, "<td class=""vertTh"">", "</tr>")
For $i = 0 To UBound($Ret) -1
    $RetSE = _StringBetween($Ret[$i], "<td align=""right"">", "</td>")
    ConsoleWrite($RetSE[1] & @CRLF)
Next
I must say nice code there just one thing is that he can read only 3 of the 7 table marks. Not to say this is bad or anything but people want a overview of everything even if it isn't Awaken because I use that to. However this is very speedie for Awaken remark on finding seed because you actually went into the IE.au3 file and selectively choose to create and find the string instead of having the selected function do it.

0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

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...