Results 1 to 21 of 21

Thread: [RESOLVED] How do i gather a list of myspace friend ids?

  1. #1

    Thread Starter
    Lively Member Charlie Stallings's Avatar
    Join Date
    Nov 2009
    Location
    Virginia
    Posts
    118

    Resolved [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

  2. #2
    Hyperactive Member Lenggries's Avatar
    Join Date
    Sep 2009
    Posts
    353

    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.

  3. #3

    Thread Starter
    Lively Member Charlie Stallings's Avatar
    Join Date
    Nov 2009
    Location
    Virginia
    Posts
    118

    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

  4. #4
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    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

  5. #5

    Thread Starter
    Lively Member Charlie Stallings's Avatar
    Join Date
    Nov 2009
    Location
    Virginia
    Posts
    118

    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?

  6. #6

    Thread Starter
    Lively Member Charlie Stallings's Avatar
    Join Date
    Nov 2009
    Location
    Virginia
    Posts
    118

    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:
    1. 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?

  7. #7
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    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.

  8. #8
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: How do i gather a list of myspace friend ids?

    Quote Originally Posted by Charlie Stallings View Post
    ok i got the html into a richtextbox i am using inet to do that i did it this way

    vb Code:
    1. 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.

  9. #9

    Thread Starter
    Lively Member Charlie Stallings's Avatar
    Join Date
    Nov 2009
    Location
    Virginia
    Posts
    118

    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

  10. #10
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    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

  11. #11

    Thread Starter
    Lively Member Charlie Stallings's Avatar
    Join Date
    Nov 2009
    Location
    Virginia
    Posts
    118

    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?

  12. #12

  13. #13

    Thread Starter
    Lively Member Charlie Stallings's Avatar
    Join Date
    Nov 2009
    Location
    Virginia
    Posts
    118

    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?

  14. #14

  15. #15

    Thread Starter
    Lively Member Charlie Stallings's Avatar
    Join Date
    Nov 2009
    Location
    Virginia
    Posts
    118

    Re: How do i gather a list of myspace friend ids?

    how do i attach a file?

  16. #16
    Junior Member
    Join Date
    Dec 2008
    Posts
    28

    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

  17. #17

    Thread Starter
    Lively Member Charlie Stallings's Avatar
    Join Date
    Nov 2009
    Location
    Virginia
    Posts
    118

    Re: How do i gather a list of myspace friend ids?

    ok what do you want me to upload like a html doc?

  18. #18

    Thread Starter
    Lively Member Charlie Stallings's Avatar
    Join Date
    Nov 2009
    Location
    Virginia
    Posts
    118

    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
    Attached Files Attached Files

  19. #19
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    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

  20. #20

    Thread Starter
    Lively Member Charlie Stallings's Avatar
    Join Date
    Nov 2009
    Location
    Virginia
    Posts
    118

    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

  21. #21

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width