[RESOLVED] How do i gather a list of myspace friend ids?
ok im building a program that will allow me to get a list of myspace friend ids from anypage using the webbrowser control what i need is to know how to get the user ids from any page like say if i goto the online friends page i want to extract all friend ids from that page and put them into a listbox
for example say i click the view all friends link within my program it will take me to my friends list in myspace i want all my friends friend id's in a listbox
any help would be great and ill give you credit for assisting in the program it self
Re: How do i gather a list of myspace friend ids?
The first thing you need to do is read the HTML and see how mySpace encodes the information within the web page. After that, just parse the content and extract the individual IDs. I don't think you'll get a more specific answer than that, as your question is very domain-dependant.
Re: How do i gather a list of myspace friend ids?
ok here is an example
<div id="myfriends_grid">
<ul id="ctl00_ctl00_ctl00_cpMain_cpMain_cpfMainBody_FriendsList_FriendsListUl">
<li><div friendid="380757454" class="friendHelperBox"><div><a href="http://www.myspace.com/dennisdowdy" class="msProfileTextLink" title="Pong Champ">Pong Champ</a></div><span class="msProfileLink friendToolTipBox" friendid="380757454" style="width:90px;"><a href="http://www.myspace.com/dennisdowdy"><img src="http://x.myspacecdn.com/modules/common/static/img/spacer.gif" source="http://c2.ac-images.myspacecdn.com/images02/24/s_57b1b79d975d433baff8a17d8b22001d.jpg" alt="Pong Champ" class="profileimagelink" /><span class="pilRealName">Beer Pong</span></a>
i need it to read friendid="380757454" and add 380757454 to the listbox
Re: How do i gather a list of myspace friend ids?
Here's something that should work. I created a test string, but you of course would use the real data.
Code:
Dim strTestString As String
Const QUOTE = """"
Dim lngEnd As Long
Dim lngStart As Long
strTestString = "blah friendid=" & QUOTE & "380757454" & QUOTE _
& " blahblah friendid=" & QUOTE & "380757455" & QUOTE & " yadayada"
lngStart = -1
Do Until lngStart = 0
lngStart = InStrRev(strTestString, "friendid=" & QUOTE, lngEnd - 1)
If lngStart > 0 Then
lngEnd = InStr(lngStart + 9, strTestString, QUOTE)
Debug.Print Mid$(strTestString, lngStart + 10, lngEnd - lngStart)
End If
Loop
End Sub
Re: How do i gather a list of myspace friend ids?
ok but how do i get the strings? and it has the same friend id in there a few times do i have to get the program to read the page source or is there another way around it? like do i have to get the page source put it into a rich textbox then do the find next thing like in the view source page that comes with internet explorer?
Re: How do i gather a list of myspace friend ids?
ok i got the html into a richtextbox i am using inet to do that i did it this way
vb Code:
DataFrm.Rich1.Text = Inet.OpenURL(Browser.LocationURL)
how do i find the friendid="000000000"
firend ids arnt the same length always so how do i remove the friendid="" and jsut get the friend id number?
Re: How do i gather a list of myspace friend ids?
Please do not bump your threads - 3 of your bump posts have been deleted.
For some of the reasons, see this. People will read your thread (and hopefully reply) when they get the time to do so.
Re: How do i gather a list of myspace friend ids?
Quote:
Originally Posted by
Charlie Stallings
ok i got the html into a richtextbox i am using inet to do that i did it this way
vb Code:
DataFrm.Rich1.Text = Inet.OpenURL(Browser.LocationURL)
how do i find the friendid="000000000"
firend ids arnt the same length always so how do i remove the friendid="" and jsut get the friend id number?
See post #4.
Re: How do i gather a list of myspace friend ids?
is there anyway you could give me an example of how to get it out of the richtextbox? i am so stuck im sorry but as you can tell i been trying this all day long im getting frustrated im not an expert but when i get that done ill be able to finish my application and its killing me i hate to even ask for help
Re: How do i gather a list of myspace friend ids?
If what you have in your richtextbox looks like what you showed in post #3 then just do
Code:
Const QUOTE = """"
Dim lngEnd As Long
Dim lngStart As Long
lngStart = -1
Do Until lngStart = 0
lngStart = InStrRev(DataFrm.Rich1.Text , "friendid=" & QUOTE, lngEnd - 1)
If lngStart > 0 Then
lngEnd = InStr(lngStart + 9, DataFrm.Rich1.Text , QUOTE)
Debug.Print Mid$(DataFrm.Rich1.Text, lngStart + 10, lngEnd - lngStart)
End If
Loop
Re: How do i gather a list of myspace friend ids?
ok that works thanks only thing is it puts it in twice and how do i change the length to match the length of the friendid?
for example
if theres a friendid thats 10 characters long then make it add 10 but if the next one is 15 then make it add 15? could i do that with dim i as integer then add i where the 9 and 10 are?
Re: How do i gather a list of myspace friend ids?
Don't worry about it. The 9 in my code is the length of the string "friendid=" and not the length of the freindid value.
Re: How do i gather a list of myspace friend ids?
when i get the friend ids some of then "'s and other characters like the image below how do i correct that? http://img297.imageshack.us/img297/6778/listt.jpg
Re: How do i gather a list of myspace friend ids?
Create a file that contains the data and then attach it so that I can test with it.
Re: How do i gather a list of myspace friend ids?
Re: How do i gather a list of myspace friend ids?
next to post quick reply press go advanced then go down and press manage attachments
Re: How do i gather a list of myspace friend ids?
ok what do you want me to upload like a html doc?
1 Attachment(s)
Re: How do i gather a list of myspace friend ids?
im not sure but i think i attached a txt file with the page source for myspace
Re: How do i gather a list of myspace friend ids?
Code:
lngStart = 1
Do Until lngStart = 10
lngStart = InStr(lngStart, DataFrm.Rich1.Text, "friendid=" & QUOTE)
lngStart = lngStart + 10
If lngStart > 10 Then
lngEnd = InStr(lngStart, DataFrm.Rich1.Text, QUOTE)
Debug.Print lngStart; Mid$(DataFrm.Rich1.Text, lngStart, lngEnd - lngStart)
lngStart = lngStart + 1
End If
Loop
Re: How do i gather a list of myspace friend ids?
omg it works!!!!!! thank you so much man you have no idea whats your name and website (if you have a site) ill give you credit for the help you provided in my app you have helped so much man i cant thank you enough
Re: [RESOLVED] How do i gather a list of myspace friend ids?
You're welcome. You can use my member name (MartinLiss) and reference VBForums.