display text while downloading the search result page res requests get('join(sys argv[ :])res raise_for_status(todoretrieve top search result links todoopen browser tab for each result the user will specify the search terms using command line arguments when they launch the program these arguments will be stored as strings in list in sys argv step find all the results now you need to use beautiful soup to extract the top search result links from your downloaded html but how do you figure out the right selector for the jobfor exampleyou can' just search for all tagsbecause there are lots of links you don' care about in the html insteadyou must inspect the search result page with the browser' developer tools to try to find selector that will pick out only the links you want after doing search for beautiful soupyou can open the browser' developer tools and inspect some of the link elements on the page they can look complicatedsomething like pages of this< class="package -snippethref="hyperlink "view-source:/"/project/xml-parser/"it doesn' matter that the element looks incredibly complicated you just need to find the pattern that all the search result links have make your code look like the following#python searchpypi py opens several google results import requestssyswebbrowserbs --snip-retrieve top search result links soup bs beautifulsoup(res text'html parser'open browser tab for each result linkelems soup select(package-snippet'if you look at the elementsthoughthe search result links all have class="package-snippetlooking through the rest of the html sourceit looks like the package-snippet class is used only for search result links you don' have to know what the css class package-snippet is or what it does you're just going to use it as marker for the element you are looking for you can create beautifulsoup object from the downloaded page' html text and then use the selector package-snippetto find all elements that are within an element that has the package-snippet css class note that if the pypi website changes its layoutyou may need to update this program with new css selector string to pass to soup select(the rest of the program will still be up to date