Skip to content Skip to sidebar Skip to footer

Using Lxml With Html, Requests, And Etree, It Gives Links, But Wont Let Me Search Links For Specific Text

I am trying to pull specific data out of the link provided below. When I run the code, it gives me all of the href links as expected, but when I try further testing for the same st

Solution 1:

BeautifulSoup based solution

from bs4 import BeautifulSoup
import requests

page = requests.get('https://ea.gr8people.com/index.gp?method=cappportal.showPortalSearch&sysLayoutID=123').content

soup = BeautifulSoup(page, 'html.parser')
links = soup.find_all('a')
links = [a for a in links if a.attrs.get('href') and'opportunityid'in a.attrs.get('href')]
print('-- opportunities --')
for idx, link inenumerate(links):
    print('{}) {}'.format(idx, link))

Output

-- opportunities --
0) <ahref="index.gp?method=cappportal.showJob&amp;layoutid=2092&amp;inp1541=&amp;inp1375=154761&amp;opportunityid=154761">
                                        2D Capture Artist - 6 month contract
                                    </a>
1) <ahref="index.gp?method=cappportal.showJob&amp;layoutid=2092&amp;inp1541=&amp;inp1375=154426&amp;opportunityid=154426">
                                        Accounting Supervisor
                                    </a>
2) <ahref="index.gp?method=cappportal.showJob&amp;layoutid=2092&amp;inp1541=&amp;inp1375=152147&amp;opportunityid=152147">
                                        Advanced Analyst
                                    </a>
3) <ahref="index.gp?method=cappportal.showJob&amp;layoutid=2092&amp;inp1541=&amp;inp1375=153395&amp;opportunityid=153395">
                                        Advanced UX Researcher
                                    </a>
4) <ahref="index.gp?method=cappportal.showJob&amp;layoutid=2092&amp;inp1541=&amp;inp1375=151309&amp;opportunityid=151309">
                                        AI Engineer
                                    </a>
5) <ahref="index.gp?method=cappportal.showJob&amp;layoutid=2092&amp;inp1541=&amp;inp1375=150468&amp;opportunityid=150468">
                                        AI Scientist
                                    </a>
6) <ahref="index.gp?method=cappportal.showJob&amp;layoutid=2092&amp;inp1541=&amp;inp1375=151310&amp;opportunityid=151310">
                                        AI Scientist - NLP Focus
                                    </a>
7) <ahref="index.gp?method=cappportal.showJob&amp;layoutid=2092&amp;inp1541=&amp;inp1375=153351&amp;opportunityid=153351">
                                        AI Software Engineer (Apex Legends)
                                    </a>
8) <ahref="index.gp?method=cappportal.showJob&amp;layoutid=2092&amp;inp1541=&amp;inp1375=152737&amp;opportunityid=152737">
                                        AI Software Engineer (Frostbite)
                                    </a>
9) <ahref="index.gp?method=cappportal.showJob&amp;layoutid=2092&amp;inp1541=&amp;inp1375=154764&amp;opportunityid=154764">
                                        Analyste Qualité Sénior / Senior Quality Analyst
                                    </a>
10) <ahref="index.gp?method=cappportal.showJob&amp;layoutid=2092&amp;inp1541=&amp;inp1375=153948&amp;opportunityid=153948">
                                        Animator 1
                                    </a>
11) <ahref="index.gp?method=cappportal.showJob&amp;layoutid=2092&amp;inp1541=&amp;inp1375=151353&amp;opportunityid=151353">
                                        Applications Agreement Analyst
                                    </a>
12) <ahref="index.gp?method=cappportal.showJob&amp;layoutid=2092&amp;inp1541=&amp;inp1375=154668&amp;opportunityid=154668">
                                        AR Analyst I
                                    </a>
13) <ahref="index.gp?method=cappportal.showJob&amp;layoutid=2092&amp;inp1541=&amp;inp1375=153609&amp;opportunityid=153609">
                                        AR Specialist
                                    </a>
14) <ahref="index.gp?method=cappportal.showJob&amp;layoutid=2092&amp;inp1541=&amp;inp1375=154773&amp;opportunityid=154773">
                                        Artiste Audio / Audio Artist
                                    </a>

Post a Comment for "Using Lxml With Html, Requests, And Etree, It Gives Links, But Wont Let Me Search Links For Specific Text"