程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

How to use a python crawler to get elements of a web page modified by JS

編輯:Python

Right click “ View page source code ” and f12 Of Elements Dissimilarity .

If you use it directly urllib.request.urlopen('...') then read() You can only get the web page source code , Original html, Not by js machining , Not what I need Elements.

I checked all day today , I've been trying to , I haven't been able to figure it out .

I can't use xpath Methods , because xpath Skills also need to be found manually , And my need is : Get a list of web pages from the search page url, And get several paragraphs of text from it , These words are only in Elements Only in the middle . The URLs of these pages are irregular , Out-of-service for i in range Method to obtain .




Take the answer :

You can put the original html Save as character content , Then use regular expression matching to get the corresponding content .



  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved