Skip to content

Instantly share code, notes, and snippets.

@clarissarjtai
Last active September 19, 2020 03:02
Show Gist options
  • Save clarissarjtai/0ea2ac0601e47921db0bb27e8c190df3 to your computer and use it in GitHub Desktop.
Save clarissarjtai/0ea2ac0601e47921db0bb27e8c190df3 to your computer and use it in GitHub Desktop.
Getting Instagram Post Time.
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