bhaktanishant's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Members
Active Posts:
18 (0.02 per day)
Joined:
19-November 12
Profile Views:
1,723
Last Active:
User is offline Nov 01 2013 03:24 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   bhaktanishant has not set their status

Posts I've Made

  1. In Topic: how to extract page-URL using BeautifulSoup

    Posted 31 Oct 2013

    View Postwiteboy724, on 31 October 2013 - 12:51 PM, said:

    I'm not sure what you're asking. You specify the URL in your code in your 3rd line. This is what BS loads. So you already have that..

    Maybe you want the rest of the links on the page using something like this:
    from bs4 import BeautifulSoup
    import requests
    
    url = 'dreamincode.net'
    
    r  = requests.get("http://" +url)
    
    data = r.text
    
    soup = BeautifulSoup(data)
    
    for link in soup.find_all('a'):
        print(link.get('href'))
    
    


    But you definitely need the page's URL before you can send that to BS, so it's not really something that needs to be read back from BS afterwards. I have experience with BeautifulSoup, so if you clarify what you need then I may be able to help


    Thanks for your response. You didn't understand my question, i was asking that if u don't know the link (in this case: www.dreamincode.net) that have been souped, then how will you get the link from souped object.
    Anyway i get my problem solved.
    THANKS

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Comments

bhaktanishant has no profile comments yet. Why not say hello?