Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from linkToSoup_selenium import * ## download or paste from https://pastebin.com/kEC9gPC8 ##
- #### for an API with blocker [cloudflare in this case] ####
- soup = linkToSoup_selenium('https://api-mainnet.magiceden.io/launchpads/planetarians')
- if soup is not None: print(json.loads(soup.text)['_id'])
- ## prints '6242a300ba826f001186ff68' ##
- ###########################################################
- ####### for a site that loads data with javascript #######
- soup = linkToSoup_selenium(
- l = 'https://www.cnbc.com/search/?query=green%20hydrogen'
- , ecx = '//span[@class="Card-title"]'
- # , clickFirst = [] # nothing needs to be clicked to proceed
- )
- if soup is not None: for c in soup.select('span.Card-title'): print(c.text)
- ## prints all the article headings ##
- ###########################################################
- #### for a site with 2 pop-up dialogs to be dealt with ####
- soup = linkToSoup_selenium(
- l = 'http://www.finewineandgoodspirits.com'
- # , ecx = [] # not necessary
- , clickFirst=[
- '//button[@id="ltkpopup-age-gate-yes"]', ## confirm age 21+
- '//div[@id="ltkpopup-close-button"]//a' ## close popup asking for email
- ]
- )
- if soup is not None: print(fSoup.select_one('.content_home .productContainer .productDiscHeader').text)
- ## prints 'Jack Daniel's Gentleman Jack Double Mellowed Tennessee Whiskey 80 Proof' ##
- ###########################################################
Advertisement
Add Comment
Please, Sign In to add comment