ConsultingJoe Posted December 21, 2006 Posted December 21, 2006 (edited) the link is "http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=9048423" and I wan to get the 9048423 out of it but its in the entire source, any ideas? Thanks Edit: I dono what flags to use or the pattern Edited December 21, 2006 by CyberZeroCool Check out ConsultingJoe.com
Thatsgreat2345 Posted December 21, 2006 Posted December 21, 2006 (edited) smoke_ns udf just grabbed the ending, and then just got every possible character popped it in an with a bunch of Ors(|) and then yeah ahhaha easy way for me #include <array.au3> $sURL = "http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=23423423423423423423" Dim $szProtocol, $szDomain, $szPath, $szFile $TestPath = _URLSplit($sURL, $szProtocol, $szDomain, $szPath, $szFile) $reg = StringRegExp($TestPath[4],"(\w|\.|\?|\&|\d)+\=(\d+)$",1) _ArrayDisplay($reg, 'Demo _UrlSplit()') Func _URLSplit($szUrl, ByRef $szProtocol, ByRef $szDomain, ByRef $szPath, ByRef $szFile) Local $sSREPattern = '^(?s)(?i)(http|ftp|https|file)://(.*?/|.*$)(.*/){0,}(.*)$' Local $aUrlSRE = StringRegExp($szUrl, $sSREPattern, 2) If Not IsArray($aUrlSRE) Or UBound($aUrlSRE) - 1 <> 4 Then Return SetError(1, 0, 0) If StringRight($aUrlSRE[2], 1) = '/' Then $aUrlSRE[2] = StringTrimRight($aUrlSRE[2], 1) $aUrlSRE[3] = '/' & $aUrlSRE[3] EndIf $szProtocol = $aUrlSRE[1] $szDomain = $aUrlSRE[2] $szPath = $aUrlSRE[3] $szFile = $aUrlSRE[4] Return $aUrlSRE EndFunc ;==>_URLSplit Edited December 21, 2006 by Thatsgreat2345
ConsultingJoe Posted December 21, 2006 Author Posted December 21, 2006 smoke_ns udf just grabbed the ending, and then just got every possible character popped it in an with a bunch of Ors(|) and then yeah ahhaha easy way for me #include <array.au3> $sURL = "http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=23423423423423423423" Dim $szProtocol, $szDomain, $szPath, $szFile $TestPath = _URLSplit($sURL, $szProtocol, $szDomain, $szPath, $szFile) $reg = StringRegExp($TestPath[4],"(\w|\.|\?|\&|\d)+\=(\d+)$",1) _ArrayDisplay($reg, 'Demo _UrlSplit()') Func _URLSplit($szUrl, ByRef $szProtocol, ByRef $szDomain, ByRef $szPath, ByRef $szFile) Local $sSREPattern = '^(?s)(?i)(http|ftp|https|file)://(.*?/|.*$)(.*/){0,}(.*)$' Local $aUrlSRE = StringRegExp($szUrl, $sSREPattern, 2) If Not IsArray($aUrlSRE) Or UBound($aUrlSRE) - 1 <> 4 Then Return SetError(1, 0, 0) If StringRight($aUrlSRE[2], 1) = '/' Then $aUrlSRE[2] = StringTrimRight($aUrlSRE[2], 1) $aUrlSRE[3] = '/' & $aUrlSRE[3] EndIf $szProtocol = $aUrlSRE[1] $szDomain = $aUrlSRE[2] $szPath = $aUrlSRE[3] $szFile = $aUrlSRE[4] Return $aUrlSRE EndFunc ;==>_URLSplitThanks but will this work for multiple ids in the source? Check out ConsultingJoe.com
Thatsgreat2345 Posted December 21, 2006 Posted December 21, 2006 (edited) are you going to make the entire string reg exp sample the source? woops i cant read xD hold on Edited December 21, 2006 by Thatsgreat2345
ConsultingJoe Posted December 21, 2006 Author Posted December 21, 2006 are you going to make the entire string reg exp sample the source?woops i cant read xD hold onyeah so the string would be:<div class="clear"> </div> <div class="left w100"> <a href="http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=94243940&MyToken=256da639-f26d-4ac0-933d-be20fa5859e8" id="ctl00_Main_ctl00_FriendSpace1_FriendRepeater_ctl08_friendLink">Dave King</a><br> <a href="http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=94243940&MyToken=256da639-f26d-4ac0-933d-be20fa5859e8" id="ctl00_Main_ctl00_FriendSpace1_FriendRepeater_ctl08_friendImageLink"><img src="http://x.myspace.com/images/no_pic.gif" alt=""></a><br> <div id="UserDataNode8" class="DataPoint=OnlineNow;UserID=94243940;" align="center"><img src="http://i.myspace.com/site/images/clear.gif" border="0" height="20" width="80"></div> </div> <div class="left w100"> <a href="http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=7892788&MyToken=256da639-f26d-4ac0-933d-be20fa5859e8" id="ctl00_Main_ctl00_FriendSpace1_FriendRepeater_ctl09_friendLink">Tiffany</a><br> <a href="http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=7892788&MyToken=256da639-f26d-4ac0-933d-be20fa5859e8" id="ctl00_Main_ctl00_FriendSpace1_FriendRepeater_ctl09_friendImageLink"><img src="http://myspace-613.vo.llnwd.net/01474/31/60/1474470613_s.jpg" alt=""></a><br> <div id="UserDataNode9" class="DataPoint=OnlineNow;UserID=7892788;" align="center"><img src="http://i.myspace.com/site/images/clear.gif" border="0" height="20" width="80"></div> </div> <div class="left w100"> <a href="http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=80822949&MyToken=256da639-f26d-4ac0-933d-be20fa5859e8" id="ctl00_Main_ctl00_FriendSpace1_FriendRepeater_ctl10_friendLink">HopeIsEmo.com</a><br> <a href="http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=80822949&MyToken=256da639-f26d-4ac0-933d-be20fa5859e8" id="ctl00_Main_ctl00_FriendSpace1_FriendRepeater_ctl10_friendImageLink"><img src="http://myspace-293.vo.llnwd.net/00824/39/25/824875293_s.jpg" alt=""></a><br> <div id="UserDataNode10" class="DataPoint=OnlineNow;UserID=80822949;" align="center"><img src="http://i.myspace.com/site/images/clear.gif" border="0" height="20" width="80"></div> </div> <div class="left w100"> <a href="http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=57788321&MyToken=256da639-f26d-4ac0-933d-be20fa5859e8" id="ctl00_Main_ctl00_FriendSpace1_FriendRepeater_ctl11_friendLink">posh suicide</a><br> <a href="http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=57788321&MyToken=256da639-f26d-4ac0-933d-be20fa5859e8" id="ctl00_Main_ctl00_FriendSpace1_FriendRepeater_ctl11_friendImageLink">and I need to get just the id numbers like:80822949577883217892788 Check out ConsultingJoe.com
Thatsgreat2345 Posted December 21, 2006 Posted December 21, 2006 Your going to have to find a way to remove doubles #include <array.au3> #include <Inet.au3> Global $counter, $Numbers[42] $sURL = _INetGetSource("http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=9048423") $reg = StringRegExp($sURL,"&friendid=(\d+)",3) _ArrayDisplay($reg,'')
theguy0000 Posted December 21, 2006 Posted December 21, 2006 Your going to have to find a way to remove doubles #include <array.au3> #include <Inet.au3> Global $counter, $Numbers[42] $sURL = _INetGetSource("http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=9048423") $reg = StringRegExp($sURL,"&friendid=(\d+)",3) _ArrayDisplay($reg,'')just for a bit of foolproof might wanna change &friendid=(\d+) to [&?]friendid=(\d+) The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
ConsultingJoe Posted December 21, 2006 Author Posted December 21, 2006 just for a bit of foolproof might wanna change &friendid=(\d+) to [&?]friendid=(\d+)Thanks, it worked but is there a faster way? Check out ConsultingJoe.com
theguy0000 Posted December 21, 2006 Posted December 21, 2006 Thanks, it worked but is there a faster way?probably not. that's one BIG web page there. The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
Moderators SmOke_N Posted December 22, 2006 Moderators Posted December 22, 2006 This may be too simple, but this wouldn't work? #include <array.au3> #include <string.au3> $sString = FileRead('Whatever or use InetGetSource') $aArray = _StringBetween($sString, 'friendid\=', '\&', -1, 1) _ArrayDisplay($aArray, '')(#include <array.au3> and _ArrayDisplay() only used for showing the result) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
ConsultingJoe Posted December 22, 2006 Author Posted December 22, 2006 this did work but it just took too long Global $counter, $Numbers[42] $sURL = _INetGetSource("http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=9048423") $reg = StringRegExp($sURL,"[&?]friendid=(\d+)",3) _ArrayDisplay($reg,'') Check out ConsultingJoe.com
Thatsgreat2345 Posted December 22, 2006 Posted December 22, 2006 as i said you must figure out a way to find duplicates haha which i found out to be quite difficult , which just gave me an idea , u first take the first string say in a file, do a stringinstr, and then get the length and trim nevermind hahah ive yet to figure a way to get rid of duplicates
ConsultingJoe Posted December 22, 2006 Author Posted December 22, 2006 as i said you must figure out a way to find duplicates haha which i found out to be quite difficult , which just gave me an idea , u first take the first string say in a file, do a stringinstr, and then get the length and trim nevermind hahah ive yet to figure a way to get rid of duplicatesLOL its cool. I just wanted to make some Myspace UDFs, friend finder, and messangers Check out ConsultingJoe.com
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now