Last active
September 19, 2020 03:02
-
-
Save clarissarjtai/0ea2ac0601e47921db0bb27e8c190df3 to your computer and use it in GitHub Desktop.
Getting Instagram Post Time.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from bs4 import BeautifulSoup as Soup | |
browser = webdriver.Chrome() | |
url = 'https://www.instagram.com/p/CEYqVrtp1HA/' | |
browser.get(url) | |
soup = Soup(browser.page_source,"lxml") # 抓取網頁原始碼 | |
arti = soup.article # find article標籤內容 | |
post_time = arti.find(class_ = "_1o9PC Nzb55").get('datetime') # 抓取特定classname裡的datetime標籤 | |
print(post_time) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment