Advertisement
Guest User

Untitled

a guest
Oct 15th, 2022
432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | Source Code | 0 0
  1. import requests
  2. from bs4 import BeautifulSoup
  3.  
  4. res = requests.get("https://reading.udn.com/read/story/122749/6680114")
  5. soup = BeautifulSoup(res.text, "html.parser")
  6.  
  7. list_news = []
  8.  
  9. for i in soup.select(".story-list__news .story-list__title a"):
  10.     list_news.append(f"https://reading.udn.com{i.get('href')}")
  11.    
  12. print(list_news)
  13.  
  14. for link in list_news:
  15.     link_res = requests.get(link)
  16.     link_soup = BeautifulSoup(link_res.text, "html.parser")
  17.     print(link_soup.select(".article-content__editor"))
  18.     print("=" * 50)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement