I
I
Igor Raskin2019-03-31 17:55:49
Python
Igor Raskin, 2019-03-31 17:55:49

Python. beautifulsoup. json. How to get data?

Please tell me how to print the value of tittle= in the code below from the link page?
5ca0d498a7f5d946711105.png
And how to get everything that starts with the k59kT class in json format?
Thank you.

from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
def main():
    options = Options()
    options.add_argument("--headless")
    driver = webdriver.Chrome(
        options=options, executable_path="C:\Python37\Laba\chromedriver.exe"
    )
    try:
        driver.get("https://www.instagram.com/p/BvWM5KOnaQl/")
        soup = BeautifulSoup(driver.page_source, "lxml")
        class_k59kT=soup.find("ul", {"class": "k59kT"})
        print ("???")
    finally:
        driver.quit()
if __name__ == "__main__":
    main()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AWEme, 2019-03-31
@shinma

Please tell me how to print the value of tittle= in the code below from the page by reference?

Cling to the desired tag and tag.get('title')
I also recommend adding a little to the link https://www.instagram.com/p/BvWM5KOnaQl/?__a=1 , there may be a lot of interesting things.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question